@ui5/webcomponents-tools 1.20.0 → 1.21.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/components-package/eslint.js +1 -0
- package/components-package/nps.js +31 -20
- package/icons-collection/nps.js +6 -4
- package/lib/dev-server/custom-hot-update-plugin.js +1 -1
- package/lib/generate-js-imports/illustrations.js +2 -1
- package/lib/generate-json-imports/i18n.js +9 -4
- package/lib/generate-json-imports/themes.js +9 -4
- package/lib/postcss-css-to-json/index.js +1 -1
- package/lib/postcss-p/postcss-p.mjs +2 -2
- package/lib/scoping/get-all-tags.js +1 -1
- package/lib/scoping/scope-test-pages.js +2 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [1.21.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0-rc.0...v1.21.0-rc.1) (2023-12-08)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
# [1.21.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0...v1.21.0-rc.0) (2023-12-07)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
# [1.20.0](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.3...v1.20.0) (2023-12-04)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @ui5/webcomponents-tools
|
@@ -11,14 +11,17 @@ const getScripts = (options) => {
|
|
11
11
|
const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
|
12
12
|
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
13
13
|
|
14
|
-
// The script creates the "
|
14
|
+
// The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
|
15
15
|
const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.prefix || '\"\"'} ${illustrations.dynamicImports.filterOut.join(" ")}`).join(" && ");
|
16
16
|
|
17
17
|
const tsOption = options.typescript;
|
18
|
-
const
|
19
|
-
|
18
|
+
const tsCommandOld = tsOption ? "tsc" : "";
|
19
|
+
let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
|
20
|
+
// this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
|
21
|
+
if (options.noWatchTS) {
|
22
|
+
tsWatchCommandStandalone = "";
|
23
|
+
}
|
20
24
|
const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
|
21
|
-
const copySrcGenerated = tsOption ? "" : "copy.srcGenerated";
|
22
25
|
|
23
26
|
if (tsOption) {
|
24
27
|
try {
|
@@ -54,48 +57,56 @@ const getScripts = (options) => {
|
|
54
57
|
clean: 'rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
|
55
58
|
lint: `eslint . ${eslintConfig}`,
|
56
59
|
lintfix: `eslint . ${eslintConfig} --fix`,
|
57
|
-
|
58
|
-
default: `${tsCrossEnv} nps
|
60
|
+
generate: {
|
61
|
+
default: `${tsCrossEnv} nps prepare.all`,
|
59
62
|
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
|
60
63
|
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
61
64
|
},
|
62
|
-
|
65
|
+
prepare: {
|
66
|
+
default: `${tsCrossEnv} nps clean prepare.all copy prepare.typescript generateAPI`,
|
67
|
+
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
|
68
|
+
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
69
|
+
typescript: tsCommandOld,
|
70
|
+
},
|
71
|
+
copyGenerated: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.{js,json}" dist/generated/`,
|
63
72
|
build: {
|
64
|
-
default: "nps prepare lint build.bundle",
|
65
|
-
templates: `mkdirp
|
73
|
+
default: "nps prepare lint build.bundle", // build.bundle2
|
74
|
+
templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
|
66
75
|
styles: {
|
67
|
-
default: `nps build.styles.themes build.styles.components
|
76
|
+
default: `concurrently "nps build.styles.themes" "nps build.styles.components"`,
|
77
|
+
default2: `nps build.styles.themes build.styles.components`,
|
68
78
|
themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
|
69
79
|
components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
|
70
80
|
},
|
71
81
|
i18n: {
|
72
82
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
73
83
|
defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
74
|
-
json: `node "${LIB}/i18n/toJSON.js" src/i18n
|
84
|
+
json: `node "${LIB}/i18n/toJSON.js" src/i18n src/generated/assets/i18n`,
|
75
85
|
},
|
76
86
|
jsonImports: {
|
77
|
-
default: "mkdirp
|
78
|
-
themes: `node "${LIB}/generate-json-imports/themes.js"
|
79
|
-
i18n: `node "${LIB}/generate-json-imports/i18n.js"
|
87
|
+
default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
|
88
|
+
themes: `node "${LIB}/generate-json-imports/themes.js" src/generated/assets/themes src/generated/json-imports`,
|
89
|
+
i18n: `node "${LIB}/generate-json-imports/i18n.js" src/generated/assets/i18n src/generated/json-imports`,
|
80
90
|
},
|
81
91
|
jsImports: {
|
82
|
-
default: "mkdirp
|
92
|
+
default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
|
83
93
|
illustrationsLoaders: createIllustrationsLoadersScript,
|
84
94
|
},
|
85
95
|
bundle: `vite build ${viteConfig}`,
|
96
|
+
bundle2: ``,
|
86
97
|
illustrations: createIllustrationsJSImportsScript,
|
87
98
|
},
|
88
99
|
copy: {
|
89
100
|
default: "nps copy.src copy.props",
|
90
|
-
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
91
|
-
|
101
|
+
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
|
102
|
+
// srcGenerated2: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.{js,json}" dist/generated/`,
|
92
103
|
props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
|
93
104
|
},
|
94
105
|
watch: {
|
95
|
-
default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.
|
106
|
+
default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" "nps watch.api" "nps watch.src" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
|
96
107
|
devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
|
97
108
|
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
|
98
|
-
typescript:
|
109
|
+
typescript: tsWatchCommandStandalone,
|
99
110
|
props: 'nps "copy.props --watch --safe --skip-initial-copy"',
|
100
111
|
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
101
112
|
styles: {
|
@@ -117,7 +128,7 @@ const getScripts = (options) => {
|
|
117
128
|
"test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
|
118
129
|
startWithScope: "nps scope.prepare scope.watchWithBundle",
|
119
130
|
scope: {
|
120
|
-
prepare: "nps scope.lint
|
131
|
+
prepare: "nps scope.lint scope.testPages",
|
121
132
|
lint: `node "${LIB}/scoping/lint-src.js"`,
|
122
133
|
testPages: {
|
123
134
|
default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
|
package/icons-collection/nps.js
CHANGED
@@ -41,22 +41,24 @@ const copyIconAssetsCommand = (options) => {
|
|
41
41
|
const getScripts = (options) => {
|
42
42
|
const createJSImportsCmd = createIconImportsCommand(options);
|
43
43
|
const copyAssetsCmd = copyIconAssetsCommand(options);
|
44
|
-
const tsCommand = options.typescript ? "tsc" : "";
|
44
|
+
const tsCommand = options.typescript ? "tsc --build" : "";
|
45
45
|
const tsCrossEnv = options.typescript ? "cross-env UI5_TS=true" : "";
|
46
46
|
|
47
47
|
const scripts = {
|
48
48
|
clean: "rimraf dist && rimraf src/generated",
|
49
49
|
copy: copyAssetsCmd,
|
50
|
+
generate: `${tsCrossEnv} nps clean copy build.i18n build.icons build.jsonImports copyjson`,
|
51
|
+
copyjson: "copy-and-watch \"src/generated/**/*.json\" dist/generated/",
|
50
52
|
build: {
|
51
53
|
default: `${tsCrossEnv} nps clean copy build.i18n typescript build.icons build.jsonImports`,
|
52
54
|
i18n: {
|
53
55
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
54
56
|
defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
55
|
-
json: `mkdirp
|
57
|
+
json: `mkdirp src/generated/assets/i18n && node "${LIB}/i18n/toJSON.js" src/i18n src/generated/assets/i18n`,
|
56
58
|
},
|
57
59
|
jsonImports: {
|
58
|
-
default: "mkdirp
|
59
|
-
i18n: `node "${LIB}/generate-json-imports/i18n.js"
|
60
|
+
default: "mkdirp src/generated/json-imports && nps build.jsonImports.i18n",
|
61
|
+
i18n: `node "${LIB}/generate-json-imports/i18n.js" src/generated/assets/i18n src/generated/json-imports`,
|
60
62
|
},
|
61
63
|
icons: createJSImportsCmd,
|
62
64
|
},
|
@@ -22,7 +22,7 @@ const customHotUpdate = async () => {
|
|
22
22
|
name: 'custom-hot-update',
|
23
23
|
handleHotUpdate(ctx) {
|
24
24
|
// custom check for generated json files
|
25
|
-
if (ctx.file.includes("
|
25
|
+
if (ctx.file.includes("src/") && ctx.file.endsWith(".json")) {
|
26
26
|
const stat = fs.statSync(ctx.file);
|
27
27
|
|
28
28
|
// metadata change only
|
@@ -20,7 +20,8 @@ const generateAvailableIllustrationsArray = (fileNames, exclusionPatterns = [])
|
|
20
20
|
};
|
21
21
|
|
22
22
|
const generateDynamicImportsFileContent = (dynamicImports, availableIllustrations, collection, prefix = "") => {
|
23
|
-
return
|
23
|
+
return `// @ts-nocheck
|
24
|
+
import { registerIllustrationLoader } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
24
25
|
|
25
26
|
export const loadIllustration = async (illustrationName) => {
|
26
27
|
const collectionAndPrefix = "${collection}/${prefix}";
|
@@ -1,13 +1,16 @@
|
|
1
1
|
const fs = require("fs").promises;
|
2
2
|
const path = require('path');
|
3
3
|
|
4
|
+
const isTypeScript = process.env.UI5_TS;
|
5
|
+
const ext = isTypeScript ? 'ts' : 'js';
|
6
|
+
|
4
7
|
const generate = async () => {
|
5
8
|
|
6
9
|
const packageName = JSON.parse(await fs.readFile("package.json")).name;
|
7
10
|
|
8
11
|
const inputFolder = path.normalize(process.argv[2]);
|
9
|
-
const outputFile = path.normalize(`${process.argv[3]}/i18n-static
|
10
|
-
const outputFileDynamic = path.normalize(`${process.argv[3]}/i18n
|
12
|
+
const outputFile = path.normalize(`${process.argv[3]}/i18n-static.${ext}`);
|
13
|
+
const outputFileDynamic = path.normalize(`${process.argv[3]}/i18n.${ext}`);
|
11
14
|
|
12
15
|
// All languages present in the file system
|
13
16
|
const files = await fs.readdir(inputFolder);
|
@@ -32,7 +35,8 @@ const generate = async () => {
|
|
32
35
|
const assetsImportsString = languages.map(key => `import _${key} from "../assets/i18n/messagebundle_${key}.json";`).join("\n");
|
33
36
|
|
34
37
|
// static imports
|
35
|
-
contentStatic =
|
38
|
+
contentStatic = `// @ts-nocheck
|
39
|
+
import { registerI18nLoader } from "@ui5/webcomponents-base/dist/asset-registries/i18n.js";
|
36
40
|
|
37
41
|
${assetsImportsString}
|
38
42
|
|
@@ -59,7 +63,8 @@ localeIds.forEach(localeId => {
|
|
59
63
|
const dynamicImportsString = languages.map(key => ` case "${key}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-messagebundle-${key}" */ "../assets/i18n/messagebundle_${key}.json")).default;`).join("\n");
|
60
64
|
|
61
65
|
// Resulting file content
|
62
|
-
contentDynamic =
|
66
|
+
contentDynamic = `// @ts-nocheck
|
67
|
+
import { registerI18nLoader } from "@ui5/webcomponents-base/dist/asset-registries/i18n.js";
|
63
68
|
|
64
69
|
const importMessageBundle = async (localeId) => {
|
65
70
|
switch (localeId) {
|
@@ -2,10 +2,13 @@ const fs = require("fs").promises;
|
|
2
2
|
const path = require('path');
|
3
3
|
const assets = require("../../assets-meta.js");
|
4
4
|
|
5
|
+
const isTypeScript = process.env.UI5_TS;
|
6
|
+
const ext = isTypeScript ? 'ts' : 'js';
|
7
|
+
|
5
8
|
const generate = async () => {
|
6
9
|
const inputFolder = path.normalize(process.argv[2]);
|
7
|
-
const outputFile = path.normalize(`${process.argv[3]}/Themes-static
|
8
|
-
const outputFileDynamic = path.normalize(`${process.argv[3]}/Themes
|
10
|
+
const outputFile = path.normalize(`${process.argv[3]}/Themes-static.${ext}`);
|
11
|
+
const outputFileDynamic = path.normalize(`${process.argv[3]}/Themes.${ext}`);
|
9
12
|
|
10
13
|
// All supported optional themes
|
11
14
|
const allThemes = assets.themes.all;
|
@@ -26,7 +29,8 @@ const generate = async () => {
|
|
26
29
|
|
27
30
|
|
28
31
|
// static imports file content
|
29
|
-
const contentStatic =
|
32
|
+
const contentStatic = `// @ts-nocheck
|
33
|
+
import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
|
30
34
|
|
31
35
|
${importLines}
|
32
36
|
|
@@ -47,7 +51,8 @@ ${availableThemesArray}
|
|
47
51
|
|
48
52
|
|
49
53
|
// dynamic imports file content
|
50
|
-
const contentDynamic =
|
54
|
+
const contentDynamic = `// @ts-nocheck
|
55
|
+
import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
|
51
56
|
|
52
57
|
const loadThemeProperties = async (themeName) => {
|
53
58
|
switch (themeName) {
|
@@ -19,7 +19,7 @@ module.exports = function (opts) {
|
|
19
19
|
let css = root.toString();
|
20
20
|
css = proccessCSS(css);
|
21
21
|
|
22
|
-
const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/
|
22
|
+
const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/src/generated/assets/").replace(`\\${opts.toReplace}\\`, "\\src\\generated\\assets\\");
|
23
23
|
mkdirp.sync(path.dirname(targetFile));
|
24
24
|
|
25
25
|
const filePath = `${targetFile}.json`;
|
@@ -3,8 +3,8 @@ import 'zx/globals';
|
|
3
3
|
// don't print executed commands and their output
|
4
4
|
$.verbose = false;
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
let inputFiles = await globby("src/**/parameters-bundle.css");
|
7
|
+
// inputFiles = inputFiles.filter(x => x.includes("fiori_3"))
|
8
8
|
const restArgs = process.argv.slice(2);
|
9
9
|
|
10
10
|
// run all postcss processes in parallel as passing the glob directly to postcss makes them processed sequentially.
|
@@ -10,7 +10,7 @@ const getTag = file => {
|
|
10
10
|
|
11
11
|
const getPackageTags = (packageDir) => {
|
12
12
|
const srcDir = path.join(packageDir, "src/");
|
13
|
-
return glob.sync(path.join(srcDir, "/**/*.
|
13
|
+
return glob.sync(path.join(srcDir, "/**/*.ts")).flatMap(file => {
|
14
14
|
const tag = getTag(file);
|
15
15
|
return [tag];
|
16
16
|
}).filter(item => !!item);
|
@@ -18,6 +18,7 @@ const replaceTagsHTML = content => {
|
|
18
18
|
|
19
19
|
// Replace tags in any content
|
20
20
|
const replaceTagsAny = content => {
|
21
|
+
console.log(tags.length);
|
21
22
|
tags.forEach(tag => {
|
22
23
|
content = content.replace(new RegExp(`(^|[^\-_A-Za-z0-9])(${tag})([^\-_A-Za-z0-9]|$)`, "g"), `$1$2-${suffix}$3`);
|
23
24
|
});
|
@@ -27,7 +28,7 @@ const replaceTagsAny = content => {
|
|
27
28
|
// Replace bundle names and HTML tag names in test pages
|
28
29
|
glob.sync(path.join(root, "/**/*.html")).forEach(file => {
|
29
30
|
let content = String(fs.readFileSync(file));
|
30
|
-
content = content.replace(
|
31
|
+
content = content.replace("%VITE_BUNDLE_PATH%", "%VITE_BUNDLE_PATH_SCOPED%");
|
31
32
|
content = replaceTagsHTML(content);
|
32
33
|
fs.writeFileSync(file, content);
|
33
34
|
});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.21.0-rc.1",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -21,8 +21,8 @@
|
|
21
21
|
"directory": "packages/tools"
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
|
-
"@typescript-eslint/eslint-plugin": "^
|
25
|
-
"@typescript-eslint/parser": "^
|
24
|
+
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
25
|
+
"@typescript-eslint/parser": "^6.9.0",
|
26
26
|
"@wdio/cli": "^7.19.7",
|
27
27
|
"@wdio/dot-reporter": "^7.19.7",
|
28
28
|
"@wdio/local-runner": "^7.19.7",
|
@@ -78,5 +78,5 @@
|
|
78
78
|
"devDependencies": {
|
79
79
|
"yargs": "^17.5.1"
|
80
80
|
},
|
81
|
-
"gitHead": "
|
81
|
+
"gitHead": "b332f72d1e5a24ec4f0486631082aa139947f563"
|
82
82
|
}
|