@ui5/webcomponents-tools 2.15.0-rc.0 → 2.15.0-rc.3

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 CHANGED
@@ -3,6 +3,33 @@
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
+ # [2.15.0-rc.3](https://github.com/UI5/webcomponents/compare/v2.15.0-rc.2...v2.15.0-rc.3) (2025-10-02)
7
+
8
+ **Note:** Version bump only for package @ui5/webcomponents-tools
9
+
10
+
11
+
12
+
13
+
14
+ # [2.15.0-rc.2](https://github.com/UI5/webcomponents/compare/v2.15.0-rc.1...v2.15.0-rc.2) (2025-09-25)
15
+
16
+ **Note:** Version bump only for package @ui5/webcomponents-tools
17
+
18
+
19
+
20
+
21
+
22
+ # [2.15.0-rc.1](https://github.com/UI5/webcomponents/compare/v2.15.0-rc.0...v2.15.0-rc.1) (2025-09-25)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **ui5-illustrated-message:** fix imports filter ([#12271](https://github.com/UI5/webcomponents/issues/12271)) ([f62d703](https://github.com/UI5/webcomponents/commit/f62d703b58aa4460dbc5a293c277290b48ca851f))
28
+
29
+
30
+
31
+
32
+
6
33
  # [2.15.0-rc.0](https://github.com/UI5/webcomponents/compare/v2.14.0...v2.15.0-rc.0) (2025-09-11)
7
34
 
8
35
  **Note:** Version bump only for package @ui5/webcomponents-tools
package/bin/dev.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const child_process = require("child_process");
4
+ const { comma } = require("postcss/lib/list");
4
5
 
5
6
  let command = process.argv[2];
6
7
  const argument = process.argv[3];
@@ -10,7 +11,7 @@ if (command === "watch") {
10
11
  command = `watch.${argument}`;
11
12
  }
12
13
  } else if (command === "test") {
13
- command = `test ${process.argv.slice(3).join(" ")}`;
14
+ command = ["test", ...process.argv.slice(3)].join(" ");
14
15
  }
15
16
 
16
- child_process.execSync(`npx nps "${command}"`, {stdio: 'inherit'});
17
+ child_process.execSync(`ui5nps "${command}"`, {stdio: 'inherit'});
package/bin/ui5nps.js ADDED
@@ -0,0 +1,261 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const fs = require("fs");
6
+ const path = require("path");
7
+ const { exec } = require("child_process");
8
+ var { parseArgsStringToArgv } = require('string-argv');
9
+
10
+ const SCRIPT_NAMES = [
11
+ "package-scripts.js",
12
+ "package-scripts.cjs",
13
+ "package-scripts.mjs"
14
+ ]
15
+
16
+ /**
17
+ * Parser for UI5 package scripts with support for parallel and sequential execution
18
+ */
19
+ class Parser {
20
+ scripts;
21
+ envs;
22
+ parsedScripts = new Map();
23
+ resolvedScripts = new Map();
24
+
25
+ constructor() {
26
+ const { scripts, envs } = this.getScripts();
27
+
28
+ this.scripts = scripts;
29
+ this.envs = envs;
30
+
31
+ // Parse scripts on initialization
32
+ this.parseScripts();
33
+
34
+ [...this.parsedScripts.keys()].forEach(key => {
35
+ this.resolveScripts(`${key}`);
36
+ });
37
+ }
38
+
39
+ /**
40
+ * Recursively parses script definitions from package-scripts file
41
+ * @param {Object} scripts - Script definitions object
42
+ * @param {string} parentKey - Parent key for nested scripts
43
+ */
44
+ parseScripts(scripts = this.scripts, parentKey = "") {
45
+ for (const [key, value] of Object.entries(scripts)) {
46
+ if (key === "__ui5envs") continue; // Skip envs key
47
+
48
+ if (parentKey && key === "default") {
49
+ this.parsedScripts.set(parentKey, value);
50
+ }
51
+
52
+ const fullKey = parentKey ? `${parentKey}.${key}` : key;
53
+
54
+ if (typeof value === "string") {
55
+ this.parsedScripts.set(fullKey, value);
56
+ } else if (typeof value === "object") {
57
+ this.parseScripts(value, fullKey);
58
+ } else {
59
+ throw new Error(`Invalid script definition for key: ${fullKey}`);
60
+ }
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Resolves script commands and determines if they should run in parallel
66
+ * @param {string} commandName - Name of the command to resolve
67
+ * @returns {Object} Resolved command object with commands array and parallel flag
68
+ */
69
+ resolveScripts(commandName) {
70
+ if (this.resolvedScripts.has(commandName)) {
71
+ return this.resolvedScripts.get(commandName);
72
+ }
73
+
74
+ let executableCommand = this.parsedScripts.get(commandName);
75
+ if (executableCommand === undefined) {
76
+ throw new Error(`Command "${commandName}" not found in scripts`);
77
+ }
78
+
79
+ if (!executableCommand.startsWith("ui5nps") || executableCommand.startsWith("ui5nps-script")) {
80
+ this.resolvedScripts.set(commandName, { commandName, commands: [executableCommand], parallel: false });
81
+ return this.resolvedScripts.get(commandName);
82
+ }
83
+
84
+ const parts = executableCommand.trim().split(" ").filter(Boolean).slice(1); // Remove "ui5nps" or ui5nps-p part
85
+ const commands = [];
86
+ for (const part of parts) {
87
+ if (!this.parsedScripts.has(part)) {
88
+ throw new Error(`Referenced command "${part}" not found in scripts`);
89
+ }
90
+
91
+ const parsedScript = this.parsedScripts.get(part);
92
+
93
+ if (parsedScript && (parsedScript.startsWith("ui5nps") || parsedScript.startsWith("ui5nps-p"))) {
94
+ this.resolveScripts(part);
95
+ }
96
+
97
+ commands.push(this.resolvedScripts.get(part) || { commandName: part, commands: [parsedScript], parallel: parsedScript.startsWith("ui5nps-p") });
98
+ }
99
+
100
+
101
+ this.resolvedScripts.set(commandName, { commandName, commands, parallel: executableCommand.startsWith("ui5nps-p") });
102
+
103
+ return this.resolvedScripts.get(commandName);
104
+ }
105
+
106
+ /**
107
+ * Loads and validates package-scripts file
108
+ * @returns {Object} Object containing scripts and environment variables
109
+ */
110
+ getScripts() {
111
+ let packageScriptPath;
112
+
113
+ for (const scriptName of SCRIPT_NAMES) {
114
+ const filePath = path.join(process.cwd(), scriptName);
115
+ if (fs.existsSync(filePath)) {
116
+ packageScriptPath = filePath;
117
+ break;
118
+ }
119
+ }
120
+
121
+ // Package-script file should be in the current working directory
122
+ if (!packageScriptPath) {
123
+ console.error("No package-scripts.js/cjs/mjs file found in the current directory.");
124
+ process.exit(1);
125
+ }
126
+
127
+ const packageScript = require(packageScriptPath);
128
+ let scripts;
129
+ let envs;
130
+
131
+ if (packageScript.__esModule) {
132
+ scripts = packageScript.default.scripts;
133
+ } else {
134
+ scripts = packageScript.scripts;
135
+ }
136
+
137
+ // Package-script should provide default export with scripts object
138
+ if (!scripts || typeof scripts !== "object") {
139
+ console.error("No valid 'scripts' object found in package-scripts file.");
140
+ process.exit(1);
141
+ }
142
+
143
+ envs = scripts.__ui5envs;
144
+
145
+ // Package-script should provide default export with scripts object
146
+ if (envs && typeof envs !== "object") {
147
+ console.error("No valid 'envs' object found in package-scripts file.");
148
+ process.exit(1);
149
+ }
150
+
151
+ return { scripts, envs };
152
+ }
153
+
154
+ /**
155
+ * Executes a command or command object (with parallel/sequential support)
156
+ * @param {string|Object} command - Command string or command object with commands array
157
+ * @returns {Promise} Promise that resolves when command(s) complete
158
+ */
159
+ async executeCommand(command, commandName = "unknown") {
160
+ if (typeof command === "string" && command) {
161
+ return new Promise(async (resolve, reject) => {
162
+ if (command.trim().startsWith("ui5nps-script")) {
163
+ const argv = parseArgsStringToArgv(command);
164
+ const importedContent = require(argv[1]);
165
+ let _ui5mainFn;
166
+
167
+ if (importedContent.__esModule) {
168
+ _ui5mainFn = importedContent.default._ui5mainFn;
169
+ } else {
170
+ _ui5mainFn = importedContent._ui5mainFn;
171
+ }
172
+
173
+ console.log(` | Executing command ${commandName} as module.`);
174
+ const result = _ui5mainFn(argv);
175
+
176
+ if (result instanceof Promise) {
177
+ return result.then(resolve).catch(reject);
178
+ } else {
179
+ return resolve();
180
+ }
181
+ }
182
+
183
+ console.log(` | Executing command ${commandName} as command.\n Running: ${command}`);
184
+ const child = exec(command, { stdio: "inherit", env: { ...process.env, ...this.envs } });
185
+
186
+ child.stdout.on("data", (data) => {
187
+ console.log(data);
188
+ });
189
+
190
+ child.stderr.on("data", (data) => {
191
+ console.error(data);
192
+ });
193
+
194
+ child.on("error", (err) => {
195
+ console.error("Failed to start:", err);
196
+ reject(err);
197
+ });
198
+
199
+ child.on("close", (code) => {
200
+ code === 0 ? resolve() : reject(new Error(`Exit ${code}`));
201
+ });
202
+ });
203
+ } else if (typeof command === "object" && command.commands) {
204
+ if (command.parallel) {
205
+ // Execute commands in parallel
206
+ const promises = command.commands.filter(Boolean).map(cmd => this.executeCommand(cmd, cmd.commandName || commandName));
207
+ await Promise.all(promises);
208
+ } else {
209
+ // Execute commands sequentially
210
+ for (const cmd of command.commands) {
211
+ await this.executeCommand(cmd, cmd.commandName || commandName);
212
+ }
213
+ }
214
+ }
215
+ }
216
+
217
+ /**
218
+ * Main execution method for a named command
219
+ * @param {string} commandName - Name of the command to execute
220
+ * @returns {Promise} Promise that resolves when execution completes
221
+ */
222
+ async execute(commandName) {
223
+ const command = this.resolvedScripts.get(commandName);
224
+
225
+ if (!command) {
226
+ throw new Error(`Command "${commandName}" not found in scripts`);
227
+ }
228
+
229
+ return this.executeCommand(this.resolvedScripts.get(commandName), commandName);
230
+ }
231
+ }
232
+
233
+ const parser = new Parser();
234
+
235
+ // Basic input validation
236
+ const commands = process.argv.slice(2);
237
+ if (commands.length === 0) {
238
+ console.error("Usage: ui5nps <command> [command2] [command3] ...");
239
+ console.error("No commands provided.");
240
+ process.exit(1);
241
+ }
242
+
243
+ if (commands.includes("--help") || commands.includes("-h")) {
244
+ console.log("Usage: ui5nps <command> [command2] [command3] ...");
245
+ console.log("Available commands:");
246
+ for (const [key, value] of parser.parsedScripts.entries()) {
247
+ console.log(` - ${key}: ${value}`);
248
+ }
249
+ process.exit(0);
250
+ }
251
+
252
+ (async () => {
253
+ process.env = { ...process.env, ...parser.envs };
254
+
255
+ for (const commandName of commands) {
256
+ await parser.execute(commandName);
257
+ }
258
+ })().catch(error => {
259
+ console.error("Error executing commands:", error);
260
+ process.exit(1);
261
+ });
@@ -3,49 +3,47 @@ const fs = require("fs");
3
3
  const LIB = path.join(__dirname, `../lib/`);
4
4
  let websiteBaseUrl = "/";
5
5
 
6
+ const isPreview = !!process.env.PR_NUMBER;
7
+ const getPreviewBaseUrl = () => {
8
+ if (process.env.DEPLOYMENT_TYPE === "netlify_preview") {
9
+ return "/";
10
+ }
11
+ return `/webcomponents/pr-${process.env.PR_NUMBER}/`;
12
+ }
13
+
6
14
  if (process.env.DEPLOY) {
7
15
  websiteBaseUrl = "/webcomponents/";
8
16
  } else if (process.env.DEPLOY_NIGHTLY) {
9
17
  websiteBaseUrl = "/webcomponents/nightly/";
10
- }
11
-
12
- const cypressEnvVariables = (options, predefinedVars) => {
13
- let variables = [];
14
- const { cypress_code_coverage, cypress_acc_tests } = options.internal ?? {};
15
-
16
- // Handle environment variables like TEST_SUITE
17
- if (predefinedVars) {
18
- variables = [...predefinedVars];
19
- }
20
-
21
- // The coverage task is always registered and requires an explicit variable whether to generate a report or not
22
- variables.push(`CYPRESS_COVERAGE=${!!cypress_code_coverage}`);
23
-
24
- if (cypress_acc_tests) {
25
- variables.push("CYPRESS_UI5_ACC=true");
26
- }
27
-
28
- return variables.length ? `cross-env ${variables.join(" ")}` : "";
18
+ } else if (isPreview) {
19
+ websiteBaseUrl = getPreviewBaseUrl();
29
20
  }
30
21
 
31
22
  const getScripts = (options) => {
32
-
33
23
  // The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
34
24
  const illustrationsData = options.illustrationsData || [];
35
- const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
36
- const createIllustrationsJSImportsScript = illustrations.join(" && ");
37
-
25
+ const createIllustrationsJSImportsScript = {
26
+ default: `ui5nps-p ${illustrationsData.map(illustrations => `build.illustrations.build-${illustrations.set}-${illustrations.collection}`).join(" ")}` // concurently,
27
+ }
28
+ illustrationsData.forEach((illustration) => {
29
+ createIllustrationsJSImportsScript[`build-${illustration.set}-${illustration.collection}`] = `ui5nps-script "${LIB}create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`
30
+ });
38
31
  // The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
39
- const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.set} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.filterOut.join(" ")}`).join(" && ");
32
+ const createIllustrationsLoadersScript = {
33
+ default: `ui5nps-p ${illustrationsData.map(illustrations => `build.jsImports.illustrationsLoaders.generate-${illustrations.set}-${illustrations.collection}`).join(" ")}` // concurently,
34
+ }
35
+ illustrationsData.forEach((illustrations) => {
36
+ createIllustrationsLoadersScript[`generate-${illustrations.set}-${illustrations.collection}`] = `ui5nps-script ${LIB}generate-js-imports/illustrations.js ${illustrations.path} ${illustrations.dynamicImports.outputFile} ${illustrations.set} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.filterOut.join(",")}`
37
+ });
38
+
40
39
 
41
- const tsOption = !options.legacy || options.jsx;
40
+ const tsOption = !!(!options.legacy || options.jsx);
42
41
  const tsCommandOld = tsOption ? "tsc" : "";
43
42
  let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
44
43
  // this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
45
44
  if (options.noWatchTS) {
46
45
  tsWatchCommandStandalone = "";
47
46
  }
48
- const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
49
47
 
50
48
  if (tsOption) {
51
49
  try {
@@ -74,97 +72,110 @@ const getScripts = (options) => {
74
72
  eslintConfig = "";
75
73
  } else {
76
74
  // no custom configuration - use default from tools project
77
- eslintConfig = `--config "${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}"`;
75
+ eslintConfig = `--config "${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}"`;
78
76
  }
79
77
 
80
78
  const scripts = {
81
- clean: 'rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
79
+ __ui5envs: {
80
+ UI5_CEM_MODE: options.dev,
81
+ UI5_TS: `${tsOption}`,
82
+ CYPRESS_COVERAGE: !!(options.internal?.cypress_code_coverage),
83
+ CYPRESS_UI5_ACC: !!(options.internal?.cypress_acc_tests),
84
+ },
85
+ clean: {
86
+ "default": "ui5nps clean.generated clean.dist scope.testPages.clean",
87
+ "generated": `ui5nps-script "${LIB}/rimraf/rimraf.js src/generated`,
88
+ "dist": `ui5nps-script "${LIB}/rimraf/rimraf.js dist`,
89
+ },
82
90
  lint: `eslint . ${eslintConfig}`,
83
91
  lintfix: `eslint . ${eslintConfig} --fix`,
84
92
  generate: {
85
- default: `${tsCrossEnv} nps prepare.all`,
86
- all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copyProps" "nps build.illustrations"',
87
- styleRelated: "nps build.styles build.jsonImports build.jsImports",
93
+ default: `ui5nps prepare.all`,
94
+ all: `ui5nps-p build.templates build.i18n prepare.styleRelated copyProps build.illustrations`, // concurently
95
+ styleRelated: "ui5nps build.styles build.jsonImports build.jsImports",
88
96
  },
89
97
  prepare: {
90
- default: `${tsCrossEnv} nps clean prepare.all ${options.legacy ? "copy" : ""} copyProps prepare.typescript generateAPI`,
91
- all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
92
- styleRelated: "nps build.styles build.jsonImports build.jsImports",
98
+ default: `ui5nps clean prepare.all copy copyProps prepare.typescript generateAPI`,
99
+ all: `ui5nps-p build.templates build.i18n prepare.styleRelated build.illustrations`, // concurently
100
+ styleRelated: "ui5nps build.styles build.jsonImports build.jsImports",
93
101
  typescript: tsCommandOld,
94
102
  },
95
103
  build: {
96
- default: "nps prepare lint build.bundle", // build.bundle2
97
- templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
104
+ default: "ui5nps prepare lint build.bundle", // build.bundle2
105
+ templates: options.legacy ? `mkdirp src/generated/templates && node "${LIB}hbs2ui5/index.js" -d src/ -o src/generated/templates` : "",
98
106
  styles: {
99
- default: `concurrently "nps build.styles.themes" "nps build.styles.components"`,
100
- themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
101
- components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
107
+ default: `ui5nps-p build.styles.themes build.styles.components`, // concurently
108
+ themes: `ui5nps-script "${LIB}css-processors/css-processor-themes.mjs"`,
109
+ themesWithWatch: `ui5nps-script "${LIB}css-processors/css-processor-themes.mjs" -w`,
110
+ components: `ui5nps-script "${LIB}css-processors/css-processor-components.mjs"`,
111
+ componentsWithWatch: `ui5nps-script "${LIB}css-processors/css-processor-components.mjs" -w`,
102
112
  },
103
113
  i18n: {
104
- default: "nps build.i18n.defaultsjs build.i18n.json",
105
- defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
106
- json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
114
+ default: "ui5nps build.i18n.defaultsjs build.i18n.json",
115
+ defaultsjs: `ui5nps-script "${LIB}i18n/defaults.js" src/i18n src/generated/i18n`,
116
+ json: `ui5nps-script "${LIB}i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
107
117
  },
108
118
  jsonImports: {
109
- default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
110
- themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes src/generated/json-imports`,
111
- i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n src/generated/json-imports`,
119
+ default: "ui5nps build.jsonImports.themes build.jsonImports.i18n",
120
+ themes: `ui5nps-script "${LIB}generate-json-imports/themes.js" src/themes src/generated/json-imports`,
121
+ i18n: `ui5nps-script "${LIB}generate-json-imports/i18n.js" src/i18n src/generated/json-imports`,
112
122
  },
113
123
  jsImports: {
114
- default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
124
+ default: "ui5nps build.jsImports.illustrationsLoaders",
115
125
  illustrationsLoaders: createIllustrationsLoadersScript,
116
126
  },
117
- bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
127
+ bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
118
128
  bundle2: ``,
119
129
  illustrations: createIllustrationsJSImportsScript,
120
130
  },
121
- copyProps: `node "${LIB}/copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
131
+ copyProps: `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
132
+ copyPropsWithWatch: `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/ --watch --safe --skip-initial-copy`,
122
133
  copy: {
123
- default: "nps copy.src copy.props",
124
- src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
125
- props: `node "${LIB}/copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
134
+ default: options.legacy ? "ui5nps copy.src copy.props" : "",
135
+ src: options.legacy ? `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/` : "",
136
+ props: options.legacy ? `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/` : "",
126
137
  },
127
138
  watch: {
128
- default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" ${options.legacy ? '"nps watch.src"' : ""} "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
129
- devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
130
- src: 'nps "copy.src --watch --safe --skip-initial-copy"',
139
+ default: `ui5nps-p watch.templates watch.typescript watch.src watch.styles watch.i18n watch.props`, // concurently
140
+ devServer: 'ui5nps-p watch.default watch.bundle', // concurently
141
+ src: options.legacy ? 'ui5nps "copy.src --watch --safe --skip-initial-copy"' : "",
131
142
  typescript: tsWatchCommandStandalone,
132
- props: 'nps "copyProps --watch --safe --skip-initial-copy"',
133
- bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
143
+ props: 'ui5nps copyPropsWithWatch',
144
+ bundle: `ui5nps-script ${LIB}dev-server/dev-server.mjs ${viteConfig}`,
134
145
  styles: {
135
- default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
136
- themes: 'nps "build.styles.themes -w"',
137
- components: `nps "build.styles.components -w"`,
146
+ default: 'ui5nps-p watch.styles.themes watch.styles.components', // concurently
147
+ themes: 'ui5nps build.styles.themesWithWatch',
148
+ components: `ui5nps build.styles.componentsWithWatch`,
138
149
  },
139
- templates: 'chokidar "src/**/*.hbs" -i "src/generated" -c "nps build.templates"',
140
- i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
150
+ templates: options.legacy ? 'chokidar "src/**/*.hbs" -i "src/generated" -c "ui5nps build.templates"' : "",
151
+ i18n: 'chokidar "src/i18n/messagebundle.properties" -c "ui5nps build.i18n.defaultsjs"'
141
152
  },
142
- start: "nps prepare watch.devServer",
143
- test: `node "${LIB}/test-runner/test-runner.js"`,
144
- "test-cy-ci": `${cypressEnvVariables(options)} yarn cypress run --component --browser chrome`,
145
- "test-cy-ci-suite-1": `${cypressEnvVariables(options, ["TEST_SUITE=SUITE1"])} yarn cypress run --component --browser chrome`,
146
- "test-cy-ci-suite-2": `${cypressEnvVariables(options, ["TEST_SUITE=SUITE2"])} yarn cypress run --component --browser chrome`,
147
- "test-cy-open": `${cypressEnvVariables(options)} yarn cypress open --component --browser chrome`,
148
- "test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
149
- "test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
150
- startWithScope: "nps scope.prepare scope.watchWithBundle",
153
+ start: "ui5nps prepare watch.devServer",
154
+ test: `ui5nps-script "${LIB}/test-runner/test-runner.js"`,
155
+ "test-cy-ci": `cypress run --component --browser chrome`,
156
+ "test-cy-ci-suite-1": `cypress run --component --browser chrome --spec "**/specs/[A-C]*.cy.{js,jsx,ts,tsx},**/specs/[^D-Z]*.cy.{js,jsx,ts,tsx}"`,
157
+ "test-cy-ci-suite-2": `cypress run --component --browser chrome --spec "**/specs/[D-L]*.cy.{js,jsx,ts,tsx}"`,
158
+ "test-cy-ci-suite-3": `cypress run --component --browser chrome --spec "**/specs/[M-S]*.cy.{js,jsx,ts,tsx}"`,
159
+ "test-cy-ci-suite-4": `cypress run --component --browser chrome --spec "**/specs/[T-Z]*.cy.{js,jsx,ts,tsx}"`,
160
+ "test-cy-open": `cypress open --component --browser chrome`,
161
+ startWithScope: "ui5nps scope.prepare scope.watchWithBundle",
151
162
  scope: {
152
- prepare: "nps scope.lint scope.testPages",
153
- lint: `node "${LIB}/scoping/lint-src.js"`,
163
+ prepare: "ui5nps scope.lint scope.testPages",
164
+ lint: `ui5nps-script "${LIB}scoping/lint-src.js"`,
154
165
  testPages: {
155
- default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
156
- clean: "rimraf test/pages/scoped",
157
- copy: `node "${LIB}/copy-and-watch/index.js" --silent "test/pages/**/*" test/pages/scoped`,
158
- replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
166
+ default: "ui5nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
167
+ "clean": `ui5nps-script "${LIB}/rimraf/rimraf.js test/pages/scoped`,
168
+ copy: `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "test/pages/**/*" test/pages/scoped`,
169
+ replace: `ui5nps-script "${LIB}scoping/scope-test-pages.js" test/pages/scoped demo`,
159
170
  },
160
- watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
161
- watch: 'concurrently "nps watch.templates" "nps watch.props" "nps watch.styles"',
162
- bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
171
+ watchWithBundle: 'ui5nps-p scope.watch scope.bundle', // concurently
172
+ watch: 'ui5nps-p watch.templates watch.props watch.styles', // concurently
173
+ bundle: `ui5nps-script ${LIB}dev-server/dev-server.mjs ${viteConfig}`,
163
174
  },
164
175
  generateAPI: {
165
- default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
166
- generateCEM: `${options.dev ? "cross-env UI5_CEM_MODE='dev'" : ""} cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs"`,
167
- validateCEM: `${options.dev ? "cross-env UI5_CEM_MODE='dev'" : ""} node "${LIB}/cem/validate.js"`,
176
+ default: tsOption ? "ui5nps generateAPI.generateCEM generateAPI.validateCEM" : "",
177
+ generateCEM: `ui5nps-script "${LIB}cem/cem.js" analyze --config "${LIB}cem/custom-elements-manifest.config.mjs"`,
178
+ validateCEM: `ui5nps-script "${LIB}cem/validate.js"`,
168
179
  },
169
180
  };
170
181
 
@@ -4,35 +4,37 @@ const LIB = path.join(__dirname, `../lib/`);
4
4
 
5
5
  const createIconImportsCommand = (options) => {
6
6
  if (!options.versions) {
7
- return `node "${LIB}/create-icons/index.js" "${options.collectionName}"`;
7
+ return `ui5nps-script "${LIB}/create-icons/index.js" "${options.collectionName}"`;
8
8
  }
9
9
 
10
- const command = { default: "nps" };
10
+ const command = { default: "ui5nps" };
11
11
  options.versions.forEach((v) => {
12
12
  command.default += ` build.icons.create${v}`;
13
- command[`create${v}`] = `node "${LIB}/create-icons/index.js" "${options.collectionName}" "${v}"`;
13
+ command[`create${v}`] = `ui5nps-script "${LIB}/create-icons/index.js" "${options.collectionName}" "${v}"`;
14
14
  });
15
15
 
16
16
  return command;
17
17
  }
18
18
 
19
+ const hashesCheck = cmd => `(node "${LIB}/icons-hash/icons-hash.mjs" check) || (${cmd} && node "${LIB}/icons-hash/icons-hash.mjs" save)`;
20
+
19
21
  const copyIconAssetsCommand = (options) => {
20
22
  if (!options.versions) {
21
- return {
22
- default: "nps copy.json-imports copy.icon-collection",
23
- "json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
24
- "icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json" src/generated/assets/`,
23
+ return {
24
+ default: "ui5nps copy.json-imports copy.icon-collection",
25
+ "json-imports": `ui5nps-script "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
26
+ "icon-collection": `ui5nps-script "${LIB}/copy-and-watch/index.js" --silent "src/*.json" src/generated/assets/`,
25
27
  }
26
28
  }
27
29
 
28
- const command = {
29
- default: "nps copy.json-imports ",
30
- "json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
30
+ const command = {
31
+ default: "ui5nps copy.json-imports ",
32
+ "json-imports": `ui5nps-script "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
31
33
  };
32
34
 
33
35
  options.versions.forEach((v) => {
34
36
  command.default += ` copy.icon-collection${v}`;
35
- command[`icon-collection${v}`] = `node "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json" src/generated/assets/${v}/`;
37
+ command[`icon-collection${v}`] = `ui5nps-script "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json" src/generated/assets/${v}/`;
36
38
  });
37
39
 
38
40
  return command;
@@ -42,23 +44,30 @@ const getScripts = (options) => {
42
44
  const createJSImportsCmd = createIconImportsCommand(options);
43
45
  const copyAssetsCmd = copyIconAssetsCommand(options);
44
46
  const tsCommand = !options.legacy ? "tsc --build" : "";
45
- const tsCrossEnv = !options.legacy ? "cross-env UI5_TS=true" : "";
47
+ const tsOption = !options.legacy;
46
48
 
47
49
  const scripts = {
48
- clean: "rimraf dist && rimraf src/generated",
50
+ __ui5envs: {
51
+ UI5_TS: `${tsOption}`,
52
+ },
53
+ clean: {
54
+ default: "ui5nps clean.generated clean.dist",
55
+ "generated": `ui5nps-script "${LIB}/rimraf/rimraf.js src/generated`,
56
+ "dist": `ui5nps-script "${LIB}/rimraf/rimraf.js dist`,
57
+ },
49
58
  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/",
59
+ generate: hashesCheck(`ui5nps clean copy build.i18n build.icons build.jsonImports copyjson`),
60
+ copyjson: `ui5nps-script "${LIB}copy-and-watch/index.js" "src/generated/**/*.json" dist/generated`,
52
61
  build: {
53
- default: `${tsCrossEnv} nps clean copy build.i18n typescript build.icons build.jsonImports`,
62
+ default: hashesCheck(`ui5nps clean copy build.i18n typescript build.icons build.jsonImports`),
54
63
  i18n: {
55
- default: "nps build.i18n.defaultsjs build.i18n.json",
56
- defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
57
- json: `mkdirp src/generated/assets/i18n && node "${LIB}/i18n/toJSON.js" src/i18n src/generated/assets/i18n`,
64
+ default: "ui5nps build.i18n.defaultsjs build.i18n.json",
65
+ defaultsjs: `ui5nps-script "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
66
+ json: `ui5nps-script "${LIB}/i18n/toJSON.js" src/i18n src/generated/assets/i18n`,
58
67
  },
59
68
  jsonImports: {
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`,
69
+ default: "ui5nps build.jsonImports.i18n",
70
+ i18n: `ui5nps-script "${LIB}/generate-json-imports/i18n.js" src/generated/assets/i18n src/generated/json-imports`,
62
71
  },
63
72
  icons: createJSImportsCmd,
64
73
  },