Skip to content

Commit

Permalink
only one assets dir
Browse files Browse the repository at this point in the history
  • Loading branch information
jloleysens committed Mar 5, 2024
1 parent f93f9b0 commit 7743827
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/dev/build/tasks/create_cdn_assets_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7743827

Please sign in to comment.