@ui5/webcomponents-tools 1.20.0-rc.3 → 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 CHANGED
@@ -3,6 +3,30 @@
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
+
22
+ # [1.20.0](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.3...v1.20.0) (2023-12-04)
23
+
24
+ **Note:** Version bump only for package @ui5/webcomponents-tools
25
+
26
+
27
+
28
+
29
+
6
30
  # [1.20.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.2...v1.20.0-rc.3) (2023-11-30)
7
31
 
8
32
 
package/assets-meta.js CHANGED
@@ -25,6 +25,7 @@ const assetsMeta = {
25
25
  "ar",
26
26
  "bg",
27
27
  "ca",
28
+ "cnr",
28
29
  "cs",
29
30
  "cy",
30
31
  "da",
@@ -52,6 +53,7 @@ const assetsMeta = {
52
53
  "ko",
53
54
  "lt",
54
55
  "lv",
56
+ "mk",
55
57
  "ms",
56
58
  "nl",
57
59
  "no",
@@ -63,6 +65,7 @@ const assetsMeta = {
63
65
  "sh",
64
66
  "sk",
65
67
  "sl",
68
+ "sr",
66
69
  "sv",
67
70
  "th",
68
71
  "tr",
@@ -80,6 +83,7 @@ const assetsMeta = {
80
83
  "ar_SA",
81
84
  "bg",
82
85
  "ca",
86
+ // "cnr_ME" - cldr for not available yet
83
87
  "cs",
84
88
  "da",
85
89
  "de",
@@ -127,6 +131,7 @@ const assetsMeta = {
127
131
  "lt",
128
132
  "lv",
129
133
  "ms",
134
+ // "mk_MK" cldr not available yet
130
135
  "nb",
131
136
  "nl",
132
137
  "nl_BE",
@@ -139,6 +144,7 @@ const assetsMeta = {
139
144
  "sk",
140
145
  "sl",
141
146
  "sr",
147
+ // "sr_Cyrl_RS" - cldr not available yet
142
148
  "sr_Latn",
143
149
  "sv",
144
150
  "th",
@@ -15,6 +15,7 @@ const overrides = tsMode ? [{
15
15
  ],
16
16
  parserOptions: {
17
17
  "project": ["./tsconfig.json", "./packages/*/tsconfig.json"],
18
+ EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
18
19
  },
19
20
  rules: {
20
21
  "no-shadow": "off",
@@ -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 "dist/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
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 tsCommand = tsOption ? "tsc" : "";
19
- const tsWatchCommand = tsOption ? "tsc --watch" : "";
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
- prepare: {
58
- default: `${tsCrossEnv} nps clean prepare.all typescript generateAPI`,
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
- typescript: tsCommand,
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 dist/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
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 ${copySrcGenerated}`,
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 dist/generated/assets/i18n`,
84
+ json: `node "${LIB}/i18n/toJSON.js" src/i18n src/generated/assets/i18n`,
75
85
  },
76
86
  jsonImports: {
77
- default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
78
- themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes dist/generated/json-imports`,
79
- i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
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 dist/generated/js-imports && nps build.jsImports.illustrationsLoaders",
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
- srcGenerated: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.js" dist/generated/`,
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.api" "nps watch.src" "nps watch.typescript" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
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: tsWatchCommand,
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 prepare scope.testPages",
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",
@@ -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 dist/generated/assets/i18n && node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
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 dist/generated/json-imports && nps build.jsonImports.i18n",
59
- i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
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("dist/") && ctx.file.endsWith(".json")) {
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 `import { registerIllustrationLoader } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
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.js`);
10
- const outputFileDynamic = path.normalize(`${process.argv[3]}/i18n.js`);
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 = `import { registerI18nLoader } from "@ui5/webcomponents-base/dist/asset-registries/i18n.js";
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 = `import { registerI18nLoader } from "@ui5/webcomponents-base/dist/asset-registries/i18n.js";
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.js`);
8
- const outputFileDynamic = path.normalize(`${process.argv[3]}/Themes.js`);
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 = `import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
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 = `import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
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}/`, "/dist/generated/assets/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\assets\\");
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
- const inputFiles = await globby("src/**/parameters-bundle.css");
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, "/**/*.js")).flatMap(file => {
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(/bundle\.(.*?)\.js/g, `../bundle.scoped.$1.js`);
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.20.0-rc.3",
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": "^5.42.1",
25
- "@typescript-eslint/parser": "^5.42.1",
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": "db65adba918cc8605bcd8e0096778a63bf8ca8c2"
81
+ "gitHead": "b332f72d1e5a24ec4f0486631082aa139947f563"
82
82
  }