From 6f0ff0c3d0bf4c1a0db3fa88afd9f566321c417c Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Tue, 5 Mar 2024 10:56:44 +0100 Subject: [PATCH 1/3] added flag to help --- src/dev/build/cli.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/dev/build/cli.ts b/src/dev/build/cli.ts index 9a967e1cc85c9..e9acd8245af02 100644 --- a/src/dev/build/cli.ts +++ b/src/dev/build/cli.ts @@ -43,6 +43,7 @@ if (showHelp) { --docker-cross-compile {dim Produce arm64 and amd64 Docker images} --docker-contexts {dim Only build the Docker build contexts} --skip-canvas-shareable-runtime {dim Don't build the Canvas shareable runtime} + --skip-cdn-assets {dim Don't build CDN assets} --skip-docker-ubi {dim Don't build the docker ubi image} --skip-docker-ubuntu {dim Don't build the docker ubuntu image} --skip-docker-fips {dim Don't build the docker fips image} From f93f9b00b14f8d85c5b985f9e490733c20cf1d7c Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Tue, 5 Mar 2024 10:57:18 +0100 Subject: [PATCH 2/3] read from multiple sources and copy plugin static assets into archive --- src/dev/build/tasks/create_cdn_assets_task.ts | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/dev/build/tasks/create_cdn_assets_task.ts b/src/dev/build/tasks/create_cdn_assets_task.ts index a9ec8beb0955c..b64a664b4d533 100644 --- a/src/dev/build/tasks/create_cdn_assets_task.ts +++ b/src/dev/build/tasks/create_cdn_assets_task.ts @@ -38,17 +38,27 @@ export const CreateCdnAssets: Task = { const manifest = Jsonc.parse(readFileSync(path, 'utf8')) as any; if (manifest?.plugin?.id) { const pluginRoot = resolve(dirname(path)); + const assetsSources = [ + resolve(pluginRoot, 'public', 'assets'), + resolve(pluginRoot, 'assets'), + ]; + // packages/core/apps/core-apps-server-internal/src/core_app.ts + const assetsDest = resolve(assets, buildSha, 'plugins', manifest.plugin.id, 'assets'); - try { - // packages/core/plugins/core-plugins-server-internal/src/plugins_service.ts - const assetsSource = resolve(pluginRoot, 'assets'); - const assetsDest = resolve('plugins', manifest.plugin.id, 'assets'); - await access(assetsSource); - await mkdirp(assetsDest); - await copyAll(assetsSource, assetsDest); - } catch (e) { - // assets are optional - if (!(e.code === 'ENOENT' && e.syscall === 'access')) throw e; + for (const assetsSource of assetsSources) { + try { + await access(assetsSource); + await mkdirp(assetsDest); + await copyAll(assetsSource, assetsDest); + } catch (e) { + if (e.code === 'ENOENT' && e.syscall === 'access') { + // miss, check the next asset source path + continue; + } + throw e; + } + // found and copied assets, no need to look further + break; } try { From 7743827936e95abb227b6d8fd3198bde2a29973e Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Tue, 5 Mar 2024 11:58:49 +0100 Subject: [PATCH 3/3] only one assets dir --- src/dev/build/tasks/create_cdn_assets_task.ts | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/dev/build/tasks/create_cdn_assets_task.ts b/src/dev/build/tasks/create_cdn_assets_task.ts index b64a664b4d533..2555795d50d80 100644 --- a/src/dev/build/tasks/create_cdn_assets_task.ts +++ b/src/dev/build/tasks/create_cdn_assets_task.ts @@ -38,27 +38,15 @@ export const CreateCdnAssets: Task = { const manifest = Jsonc.parse(readFileSync(path, 'utf8')) as any; if (manifest?.plugin?.id) { const pluginRoot = resolve(dirname(path)); - const assetsSources = [ - resolve(pluginRoot, 'public', 'assets'), - resolve(pluginRoot, 'assets'), - ]; // packages/core/apps/core-apps-server-internal/src/core_app.ts + const assetsSource = resolve(pluginRoot, 'public', 'assets'); const assetsDest = resolve(assets, buildSha, 'plugins', manifest.plugin.id, 'assets'); - - for (const assetsSource of assetsSources) { - try { - await access(assetsSource); - await mkdirp(assetsDest); - await copyAll(assetsSource, assetsDest); - } catch (e) { - if (e.code === 'ENOENT' && e.syscall === 'access') { - // miss, check the next asset source path - continue; - } - throw e; - } - // found and copied assets, no need to look further - break; + try { + await access(assetsSource); + await mkdirp(assetsDest); + await copyAll(assetsSource, assetsDest); + } catch (e) { + if (!(e.code === 'ENOENT' && e.syscall === 'access')) throw e; } try {