Skip to content

Commit 257c603

Browse files
J9remmrflos
authored andcommitted
refactor(pdfjs-dist): move to javascripts/vendor folder
1 parent 0aedec7 commit 257c603

File tree

368 files changed

+14
-21
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

368 files changed

+14
-21
lines changed

includes/ComposerScriptsHelper.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ public static function postInstall(Event $event)
2929
public static function postUpdate(Event $event)
3030
{
3131
self::postInstall($event);
32+
3233
// update pdfjs-dist
34+
// Context
35+
36+
// `pdfjs-dist` is available as javascript library via `yarn` but as pre-build package.
37+
// To use it as viewer in `<iframe>`, we have to download the official viewer package not available via `yarn`.
3338

3439
// first get list of files
3540
$data = self::getPdfJsDistFiles();
@@ -86,9 +91,9 @@ private static function extractPdfJsDistFileUrl(array $data): array
8691
private static function updatePdfJsDist(array $params)
8792
{
8893
if (!empty($params['url'])) {
89-
if (is_dir('tools/attach/libs/vendor/')) {
90-
if (!is_dir('tools/attach/libs/vendor/pdfjs-dist/') ||
91-
self::pdfJsDistNeedsUpdate('tools/attach/libs/vendor/pdfjs-dist/revision.json', $params)) {
94+
if (is_dir('javascripts/vendor/')) {
95+
if (!is_dir('javascripts/vendor/pdfjs-dist/') ||
96+
self::pdfJsDistNeedsUpdate('javascripts/vendor/pdfjs-dist/revision.json', $params)) {
9297
try {
9398
$zipContent = file_get_contents($params['url'], false, stream_context_create([
9499
'http' => [
@@ -103,13 +108,13 @@ private static function updatePdfJsDist(array $params)
103108
if (file_put_contents($tmpFilename, $zipContent) !== false) {
104109
$zip = new ZipArchive();
105110
if ($zip->open($tmpFilename)) {
106-
if (is_dir('tools/attach/libs/vendor/pdfjs-dist/')) {
107-
self::deleteFolder('tools/attach/libs/vendor/pdfjs-dist/');
111+
if (is_dir('javascripts/vendor/pdfjs-dist/')) {
112+
self::deleteFolder('javascripts/vendor/pdfjs-dist/');
108113
}
109-
if (!is_dir('tools/attach/libs/vendor/pdfjs-dist/')) {
110-
$zip->extractTo('tools/attach/libs/vendor/pdfjs-dist/');
114+
if (!is_dir('javascripts/vendor/pdfjs-dist/')) {
115+
$zip->extractTo('javascripts/vendor/pdfjs-dist/');
111116
file_put_contents(
112-
'tools/attach/libs/vendor/pdfjs-dist/revision.json',
117+
'javascripts/vendor/pdfjs-dist/revision.json',
113118
json_encode([
114119
'major_revision' => $params['major_revision'],
115120
'minor_revision' => $params['minor_revision'],
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tools/attach/libs/vendor/pdfjs-dist/build/pdf.sandbox.js.map renamed to javascripts/vendor/pdfjs-dist/build/pdf.sandbox.js.map

File renamed without changes.
File renamed without changes.

tools/attach/libs/vendor/pdfjs-dist/build/pdf.worker.js.map renamed to javascripts/vendor/pdfjs-dist/build/pdf.worker.js.map

File renamed without changes.
File renamed without changes.

tools/attach/libs/vendor/pdfjs-dist/web/cmaps/78-EUC-H.bcmap renamed to javascripts/vendor/pdfjs-dist/web/cmaps/78-EUC-H.bcmap

File renamed without changes.

0 commit comments

Comments
 (0)