@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 +27 -0
- package/bin/dev.js +3 -2
- package/bin/ui5nps.js +261 -0
- package/components-package/nps.js +93 -82
- package/icons-collection/nps.js +30 -21
- package/lib/amd-to-es6/index.js +15 -10
- package/lib/cem/cem.js +12 -0
- package/lib/cem/validate.js +56 -47
- package/lib/copy-and-watch/index.js +105 -97
- package/lib/copy-list/index.js +16 -10
- package/lib/create-icons/index.js +19 -15
- package/lib/create-illustrations/index.js +28 -24
- package/lib/css-processors/css-processor-components.mjs +71 -61
- package/lib/css-processors/css-processor-themes.mjs +76 -66
- package/lib/generate-js-imports/illustrations.js +53 -54
- package/lib/generate-json-imports/i18n.js +14 -10
- package/lib/generate-json-imports/themes.js +15 -10
- package/lib/i18n/defaults.js +12 -7
- package/lib/i18n/toJSON.js +14 -10
- package/lib/icons-hash/icons-hash.mjs +149 -0
- package/lib/remove-dev-mode/remove-dev-mode.mjs +34 -24
- package/lib/rimraf/rimraf.js +31 -0
- package/package.json +8 -10
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 =
|
|
14
|
+
command = ["test", ...process.argv.slice(3)].join(" ");
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
child_process.execSync(`
|
|
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
|
|
36
|
-
|
|
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 =
|
|
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
|
|
75
|
+
eslintConfig = `--config "${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}"`;
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
const scripts = {
|
|
81
|
-
|
|
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:
|
|
86
|
-
all:
|
|
87
|
-
styleRelated: "
|
|
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:
|
|
91
|
-
all:
|
|
92
|
-
styleRelated: "
|
|
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: "
|
|
97
|
-
templates: `mkdirp 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: `
|
|
100
|
-
themes: `
|
|
101
|
-
|
|
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: "
|
|
105
|
-
defaultsjs: `
|
|
106
|
-
json: `
|
|
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: "
|
|
110
|
-
themes: `
|
|
111
|
-
i18n: `
|
|
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: "
|
|
124
|
+
default: "ui5nps build.jsImports.illustrationsLoaders",
|
|
115
125
|
illustrationsLoaders: createIllustrationsLoadersScript,
|
|
116
126
|
},
|
|
117
|
-
bundle: `vite build ${viteConfig} --mode testing
|
|
127
|
+
bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
|
|
118
128
|
bundle2: ``,
|
|
119
129
|
illustrations: createIllustrationsJSImportsScript,
|
|
120
130
|
},
|
|
121
|
-
copyProps: `
|
|
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: "
|
|
124
|
-
src: `
|
|
125
|
-
props: `
|
|
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:
|
|
129
|
-
devServer: '
|
|
130
|
-
src: '
|
|
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: '
|
|
133
|
-
bundle: `
|
|
143
|
+
props: 'ui5nps copyPropsWithWatch',
|
|
144
|
+
bundle: `ui5nps-script ${LIB}dev-server/dev-server.mjs ${viteConfig}`,
|
|
134
145
|
styles: {
|
|
135
|
-
default: '
|
|
136
|
-
themes: '
|
|
137
|
-
components: `
|
|
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 "
|
|
140
|
-
i18n: 'chokidar "src/i18n/messagebundle.properties" -c "
|
|
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: "
|
|
143
|
-
test: `
|
|
144
|
-
"test-cy-ci":
|
|
145
|
-
"test-cy-ci-suite-1":
|
|
146
|
-
"test-cy-ci-suite-2":
|
|
147
|
-
"test-cy-
|
|
148
|
-
"test-suite-
|
|
149
|
-
"test-
|
|
150
|
-
startWithScope: "
|
|
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: "
|
|
153
|
-
lint: `
|
|
163
|
+
prepare: "ui5nps scope.lint scope.testPages",
|
|
164
|
+
lint: `ui5nps-script "${LIB}scoping/lint-src.js"`,
|
|
154
165
|
testPages: {
|
|
155
|
-
default: "
|
|
156
|
-
clean: "rimraf test/pages/scoped
|
|
157
|
-
copy: `
|
|
158
|
-
replace: `
|
|
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: '
|
|
161
|
-
watch: '
|
|
162
|
-
bundle: `
|
|
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 ? "
|
|
166
|
-
generateCEM:
|
|
167
|
-
validateCEM:
|
|
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
|
|
package/icons-collection/nps.js
CHANGED
|
@@ -4,35 +4,37 @@ const LIB = path.join(__dirname, `../lib/`);
|
|
|
4
4
|
|
|
5
5
|
const createIconImportsCommand = (options) => {
|
|
6
6
|
if (!options.versions) {
|
|
7
|
-
return `
|
|
7
|
+
return `ui5nps-script "${LIB}/create-icons/index.js" "${options.collectionName}"`;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
const command
|
|
10
|
+
const command = { default: "ui5nps" };
|
|
11
11
|
options.versions.forEach((v) => {
|
|
12
12
|
command.default += ` build.icons.create${v}`;
|
|
13
|
-
command[`create${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: "
|
|
23
|
-
"json-imports": `
|
|
24
|
-
"icon-collection": `
|
|
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: "
|
|
30
|
-
"json-imports": `
|
|
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}`] = `
|
|
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
|
|
47
|
+
const tsOption = !options.legacy;
|
|
46
48
|
|
|
47
49
|
const scripts = {
|
|
48
|
-
|
|
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:
|
|
51
|
-
copyjson: "copy-and-watch
|
|
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:
|
|
62
|
+
default: hashesCheck(`ui5nps clean copy build.i18n typescript build.icons build.jsonImports`),
|
|
54
63
|
i18n: {
|
|
55
|
-
default: "
|
|
56
|
-
defaultsjs: `
|
|
57
|
-
json: `
|
|
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: "
|
|
61
|
-
i18n: `
|
|
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
|
},
|