Skip to content

feat(Assets): add Assets-fetch.js #7345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions packages/main/scripts/generateI18n.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,19 @@ spawnSync('npx', ['prettier', '--write', path.resolve(SRC_I18N_PROPERTIES, 'i18n
stdio: [0, 1, 2],
});

// generate Assets.js and Assets-static.js
// generate Assets.js and Assets-fetch.js
const jsonImports = await readdir(TARGET_I18N_JSON_IMPORTS);

const assets = [`import '@ui5/webcomponents/dist/Assets.js';`, `import '@ui5/webcomponents-fiori/dist/Assets.js';`];
const assetsStatic = [
`import '@ui5/webcomponents/dist/Assets-static.js';`,
`import '@ui5/webcomponents-fiori/dist/Assets-static.js';`,
const assetsFetch = [
`import '@ui5/webcomponents/dist/Assets-fetch.js';`,
//todo: currently the fiori package doesn't include `Assets-fetch` - clarify if this is intended
// `import '@ui5/webcomponents-fiori/dist/Assets-fetch.js';`,
];

for (const file of jsonImports) {
if (file.includes('-static')) {
assetsStatic.push(`import './json-imports/${file}';`);
if (file.includes('-fetch')) {
assetsFetch.push(`import './json-imports/${file}';`);
} else {
assets.push(`import './json-imports/${file}';`);
}
Expand All @@ -75,7 +76,8 @@ await writeFile(
path.resolve(DIST_DIR, 'Assets.js'),
await prettier.format(assets.join('\n'), { ...prettierConfig, parser: 'babel' }),
);

await writeFile(
path.resolve(DIST_DIR, 'Assets-static.js'),
await prettier.format(assetsStatic.join('\n'), { ...prettierConfig, parser: 'babel' }),
path.resolve(DIST_DIR, 'Assets-fetch.js'),
await prettier.format(assetsFetch.join('\n'), { ...prettierConfig, parser: 'babel' }),
);
Loading