@ui5/webcomponents-tools 0.0.0-cc312800a → 0.0.0-cf50976ce
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 +184 -0
- package/README.md +5 -6
- package/assets-meta.js +7 -1
- package/bin/dev.js +1 -5
- package/components-package/nps.js +55 -51
- package/components-package/postcss.themes.js +6 -3
- package/components-package/vite.config.js +12 -0
- package/components-package/wdio.js +71 -29
- package/components-package/wdio.sync.js +360 -0
- package/icons-collection/nps.js +41 -13
- package/lib/copy-and-watch/index.js +24 -1
- package/lib/copy-list/index.js +28 -0
- package/lib/create-icons/index.js +101 -58
- package/lib/create-illustrations/index.js +161 -0
- package/lib/create-new-component/index.js +12 -4
- package/lib/dev-server/dev-server.js +66 -0
- package/lib/dev-server/virtual-index-html-plugin.js +52 -0
- package/lib/esm-abs-to-rel/index.js +58 -0
- package/lib/generate-json-imports/i18n.js +38 -31
- package/lib/generate-json-imports/themes.js +31 -24
- package/lib/hbs2lit/src/compiler.js +12 -3
- package/lib/hbs2lit/src/includesReplacer.js +5 -5
- package/lib/hbs2lit/src/litVisitor2.js +31 -6
- package/lib/hbs2lit/src/svgProcessor.js +3 -3
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +4 -11
- package/lib/hbs2ui5/index.js +37 -21
- package/lib/i18n/defaults.js +49 -57
- package/lib/i18n/toJSON.js +12 -11
- package/lib/jsdoc/plugin.js +9 -0
- package/lib/jsdoc/template/publish.js +13 -2
- package/lib/postcss-combine-duplicated-selectors/index.js +178 -0
- package/lib/postcss-css-to-esm/index.js +16 -4
- package/lib/postcss-css-to-json/index.js +18 -2
- package/lib/postcss-p/postcss-p.mjs +14 -0
- package/lib/replace-global-core/index.js +25 -0
- package/lib/scoping/lint-src.js +1 -1
- package/lib/scoping/missing-dependencies.js +65 -0
- package/lib/scoping/report-tags-usage.js +28 -0
- package/lib/scoping/scope-test-pages.js +1 -1
- package/lib/test-runner/test-runner.js +63 -0
- package/package.json +26 -39
- package/bin/init-ui5-package.js +0 -3
- package/components-package/rollup.js +0 -195
- package/lib/documentation/index.js +0 -165
- package/lib/documentation/templates/api-component-since.js +0 -3
- package/lib/documentation/templates/api-css-variables-section.js +0 -24
- package/lib/documentation/templates/api-events-section.js +0 -35
- package/lib/documentation/templates/api-methods-section.js +0 -26
- package/lib/documentation/templates/api-properties-section.js +0 -40
- package/lib/documentation/templates/api-slots-section.js +0 -28
- package/lib/documentation/templates/template.js +0 -38
- package/lib/hash/config.js +0 -10
- package/lib/hash/generate.js +0 -19
- package/lib/hash/upToDate.js +0 -31
- package/lib/init-package/index.js +0 -123
- package/lib/init-package/resources/.eslintignore +0 -3
- package/lib/init-package/resources/bundle.es5.js +0 -25
- package/lib/init-package/resources/bundle.esm.js +0 -31
- package/lib/init-package/resources/config/.eslintrc.js +0 -1
- package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
- package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
- package/lib/init-package/resources/config/rollup.config.js +0 -1
- package/lib/init-package/resources/config/wdio.conf.js +0 -1
- package/lib/init-package/resources/package-scripts.js +0 -11
- package/lib/init-package/resources/src/Assets.js +0 -5
- package/lib/init-package/resources/src/MyFirstComponent.hbs +0 -1
- package/lib/init-package/resources/src/MyFirstComponent.js +0 -56
- package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
- package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
- package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
- package/lib/init-package/resources/src/themes/MyFirstComponent.css +0 -11
- package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
- package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
- package/lib/init-package/resources/test/pages/index.html +0 -56
- package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
- package/lib/polyfill-placeholder/index.js +0 -5
- package/lib/serve/index.js +0 -46
- package/lib/serve/serve.json +0 -3
- package/package-lock.json +0 -48
@@ -8,10 +8,10 @@ const DEFAULT_THEME = assets.themes.default;
|
|
8
8
|
const getDefaultThemeCode = packageName => {
|
9
9
|
return `import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
|
10
10
|
|
11
|
-
import defaultThemeBase from "@ui5/webcomponents-
|
11
|
+
import defaultThemeBase from "@ui5/webcomponents-theming/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
|
12
12
|
import defaultTheme from "./${DEFAULT_THEME}/parameters-bundle.css.js";
|
13
13
|
|
14
|
-
registerThemePropertiesLoader("@ui5/webcomponents-
|
14
|
+
registerThemePropertiesLoader("@ui5/webcomponents-theming", "${DEFAULT_THEME}", () => defaultThemeBase);
|
15
15
|
registerThemePropertiesLoader("${packageName}", "${DEFAULT_THEME}", () => defaultTheme);
|
16
16
|
`;
|
17
17
|
};
|
@@ -38,8 +38,20 @@ module.exports = function (opts) {
|
|
38
38
|
|
39
39
|
const filePath = `${targetFile}.js`;
|
40
40
|
const defaultTheme = opts.includeDefaultTheme ? getDefaultThemeCode(opts.packageName) : ``;
|
41
|
-
|
41
|
+
|
42
|
+
// it seems slower to read the old content, but writing the same content with no real changes
|
43
|
+
// (as in initial build and then watch mode) will cause an unnecessary dev server refresh
|
44
|
+
let oldContent = "";
|
45
|
+
try {
|
46
|
+
oldContent = fs.readFileSync(filePath).toString();
|
47
|
+
} catch (e) {
|
48
|
+
// file not found
|
49
|
+
}
|
50
|
+
const content = `${defaultTheme}export default {packageName:"${opts.packageName}",fileName:"${targetFile.substr(targetFile.lastIndexOf("themes"))}",content:${css}}`
|
51
|
+
if (content !== oldContent) {
|
52
|
+
fs.writeFileSync(filePath, content);
|
53
|
+
}
|
42
54
|
}
|
43
55
|
};
|
44
56
|
};
|
45
|
-
module.exports.postcss = true;
|
57
|
+
module.exports.postcss = true;
|
@@ -23,9 +23,25 @@ module.exports = function (opts) {
|
|
23
23
|
mkdirp.sync(path.dirname(targetFile));
|
24
24
|
|
25
25
|
const filePath = `${targetFile}.json`;
|
26
|
-
|
26
|
+
const data = {
|
27
|
+
packageName: opts.packageName,
|
28
|
+
fileName: targetFile.substr(targetFile.lastIndexOf("themes")),
|
29
|
+
content: css
|
30
|
+
};
|
31
|
+
// it seems slower to read the old content, but writing the same content with no real changes
|
32
|
+
// (as in initial build and then watch mode) will cause an unnecessary dev server refresh
|
33
|
+
let oldContent = "";
|
34
|
+
try {
|
35
|
+
oldContent = fs.readFileSync(filePath).toString();
|
36
|
+
} catch (e) {
|
37
|
+
// file not found
|
38
|
+
}
|
39
|
+
const content = JSON.stringify({_: data});
|
40
|
+
if (content !== oldContent) {
|
41
|
+
fs.writeFileSync(filePath, content);
|
42
|
+
}
|
27
43
|
}
|
28
44
|
};
|
29
45
|
};
|
30
46
|
|
31
|
-
module.exports.postcss = true;
|
47
|
+
module.exports.postcss = true;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import 'zx/globals';
|
2
|
+
|
3
|
+
// don't print executed commands and their output
|
4
|
+
$.verbose = false;
|
5
|
+
|
6
|
+
const inputFiles = await globby("src/**/parameters-bundle.css");
|
7
|
+
|
8
|
+
const restArgs = process.argv.slice(2);
|
9
|
+
|
10
|
+
// run all postcss processes in parallel as passing the glob directly to postcss makes them processed sequentially.
|
11
|
+
// and the amount of imports give a big speed up when run in parallel
|
12
|
+
await Promise.all(inputFiles.map(file => {
|
13
|
+
return $`postcss ${file} --config config/postcss.themes --base src --dir dist/css/ ${restArgs}`;
|
14
|
+
}));
|
@@ -0,0 +1,25 @@
|
|
1
|
+
const fs = require("fs").promises;
|
2
|
+
|
3
|
+
const basePath = process.argv[2];
|
4
|
+
|
5
|
+
const replaceGlobalCoreUsage = async (srcPath) => {
|
6
|
+
|
7
|
+
const original = (await fs.readFile(srcPath)).toString();
|
8
|
+
let replaced = original.replace(/sap\.ui\.getCore\(\)/g, `Core`);
|
9
|
+
|
10
|
+
if (original !== replaced) {
|
11
|
+
replaced = `import Core from 'sap/ui/core/Core';
|
12
|
+
${replaced}`;
|
13
|
+
return fs.writeFile(srcPath, replaced);
|
14
|
+
}
|
15
|
+
};
|
16
|
+
|
17
|
+
const generate = async () => {
|
18
|
+
const { globby } = await import("globby");
|
19
|
+
const fileNames = await globby(basePath + "**/*.js");
|
20
|
+
return Promise.all(fileNames.map(replaceGlobalCoreUsage).filter(x => !!x));
|
21
|
+
};
|
22
|
+
|
23
|
+
generate().then(() => {
|
24
|
+
console.log("Success: Replaced global core usage in:", basePath);
|
25
|
+
});
|
package/lib/scoping/lint-src.js
CHANGED
@@ -10,7 +10,7 @@ const errors = [];
|
|
10
10
|
glob.sync(path.join(process.cwd(), "src/**/*.css")).forEach(file => {
|
11
11
|
let content = String(fs.readFileSync(file));
|
12
12
|
tags.forEach(tag => {
|
13
|
-
if (content.match(new RegExp(`(^|[
|
13
|
+
if (content.match(new RegExp(`(^|[^\.\-_A-Za-z0-9"\[])(${tag})([^\-_A-Za-z0-9]|$)`, "g"))) {
|
14
14
|
errors.push(`Warning! ${tag} found in ${file}`);
|
15
15
|
}
|
16
16
|
});
|
@@ -0,0 +1,65 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const glob = require("glob");
|
3
|
+
const path = require("path");
|
4
|
+
const process = require("process");
|
5
|
+
|
6
|
+
const projectPath = process.argv[2];
|
7
|
+
|
8
|
+
// gather all tags from all files
|
9
|
+
const tagsToFiles = new Map();
|
10
|
+
const filesToTags = new Map();
|
11
|
+
|
12
|
+
let files = [
|
13
|
+
...glob.sync(path.join("packages/main/src/**/*.js")),
|
14
|
+
...glob.sync(path.join("packages/fiori/src/**/*.js")),
|
15
|
+
];
|
16
|
+
files.forEach(file => {
|
17
|
+
let matches = file.match(/([a-zA-Z0-9_]+)\.js$/);
|
18
|
+
const name = matches[1];
|
19
|
+
|
20
|
+
const content = `${fs.readFileSync(file)}`;
|
21
|
+
matches = content.match(/tag: "(.*?)",/);
|
22
|
+
if (matches) {
|
23
|
+
const tag = matches[1];
|
24
|
+
tagsToFiles.set(tag, name);
|
25
|
+
filesToTags.set(name, tag);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
|
29
|
+
// Process the package
|
30
|
+
files = glob.sync(path.join(projectPath, "src/**/*.js"));
|
31
|
+
tagsToFiles.forEach((file, tag) => {
|
32
|
+
const sourcePath = path.join(projectPath, "src/", `${file}.js`);
|
33
|
+
if (!fs.existsSync(sourcePath)) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
const sourceContent = `${fs.readFileSync(sourcePath)}`.split("\n").join(" ");
|
37
|
+
|
38
|
+
const hbsPath = path.join(projectPath, "src/", `${file}.hbs`);
|
39
|
+
const hbsContent = fs.existsSync(hbsPath) ? `${fs.readFileSync(hbsPath)}` : "";
|
40
|
+
|
41
|
+
const hbsPopoverPath = path.join(projectPath, "src/", `${file}Popover.hbs`);
|
42
|
+
const hbsPopoverContent = fs.existsSync(hbsPopoverPath) ? `${fs.readFileSync(hbsPopoverPath)}` : "";
|
43
|
+
|
44
|
+
// deps
|
45
|
+
let deps = [];
|
46
|
+
let matches = sourceContent.match(/static get dependencies\(\) \{\s+return \[(.*?)\]/);
|
47
|
+
if (matches) {
|
48
|
+
deps = matches[1].split(",").map(x => x.trim()).filter(x => !!x);
|
49
|
+
}
|
50
|
+
|
51
|
+
// tags
|
52
|
+
matches = [
|
53
|
+
...hbsContent.matchAll(/<ui5-[a-z0-9-]+/g),
|
54
|
+
...hbsPopoverContent.matchAll(/<ui5-[a-z0-9-]+/g),
|
55
|
+
];
|
56
|
+
if (matches) {
|
57
|
+
matches.forEach(match => {
|
58
|
+
const tagUsed = match[0].substr(1);
|
59
|
+
const dep = tagsToFiles.get(tagUsed);
|
60
|
+
if (!deps.includes(dep)) {
|
61
|
+
console.log(`${file} used ${tagUsed}`);
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const glob = require("glob");
|
3
|
+
const path = require("path");
|
4
|
+
const process = require("process");
|
5
|
+
|
6
|
+
// gather all tags from all files
|
7
|
+
const tags = new Set();
|
8
|
+
const files = glob.sync(path.join(process.argv[2], "src/**/*.js"));
|
9
|
+
files.forEach(file => {
|
10
|
+
const content = `${fs.readFileSync(file)}`;
|
11
|
+
const matches = content.match(/tag: "(.*?)",/);
|
12
|
+
if (matches) {
|
13
|
+
tags.add(matches[1]);
|
14
|
+
}
|
15
|
+
});
|
16
|
+
|
17
|
+
// report all usages of any tag within any file, which is not the tag definition and is not hasAttribute
|
18
|
+
files.forEach(file => {
|
19
|
+
const content = `${fs.readFileSync(file)}`;
|
20
|
+
const lines = content.split("\n");
|
21
|
+
lines.forEach(line => {
|
22
|
+
tags.forEach(tag => {
|
23
|
+
if (line.includes(`"${tag}"`) && !line.includes(`tag: "${tag}",`) && !line.includes(`hasAttribute("${tag}")`)) {
|
24
|
+
console.log(`${file}: ${line.trim()}`);
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
28
|
+
});
|
@@ -27,7 +27,7 @@ const replaceTagsAny = content => {
|
|
27
27
|
// Replace bundle names and HTML tag names in test pages
|
28
28
|
glob.sync(path.join(root, "/**/*.html")).forEach(file => {
|
29
29
|
let content = String(fs.readFileSync(file));
|
30
|
-
content = content.replace(/bundle\.(.*?)\.js/g,
|
30
|
+
content = content.replace(/bundle\.(.*?)\.js/g, `../bundle.scoped.$1.js`);
|
31
31
|
content = replaceTagsHTML(content);
|
32
32
|
fs.writeFileSync(file, content);
|
33
33
|
});
|
@@ -0,0 +1,63 @@
|
|
1
|
+
const child_process = require("child_process");
|
2
|
+
const { readFileSync } = require("fs");
|
3
|
+
const path = require("path");
|
4
|
+
|
5
|
+
// search for dev-server port
|
6
|
+
// start in current folder
|
7
|
+
// traversing upwards in case of mono repo tests and dev-server running in root folder of repository
|
8
|
+
let devServerFolder = process.cwd();
|
9
|
+
let devServerPort;
|
10
|
+
while (true) {
|
11
|
+
try {
|
12
|
+
devServerPort = readFileSync(path.join(devServerFolder, ".dev-server-port")).toString();
|
13
|
+
break; // found
|
14
|
+
} catch (e) {
|
15
|
+
// file not found
|
16
|
+
if (devServerFolder === path.dirname(devServerFolder)) {
|
17
|
+
break; // reached root folder "/"
|
18
|
+
}
|
19
|
+
devServerFolder = path.dirname(devServerFolder);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
// check if we are in a monorepo and extract path from package.json
|
24
|
+
let packageRepositoryPath = "";
|
25
|
+
const pkg = require(path.join(process.cwd(), "package.json"));
|
26
|
+
packageRepositoryPath = pkg.repository.directory;
|
27
|
+
|
28
|
+
// construct base url
|
29
|
+
// use devServerPort if a dev server is running, otherwise let the baseUrl in the wdio config be used
|
30
|
+
// if a dev server is running in the root of a mono repo, append tha package path like this
|
31
|
+
// http://localhost:${devServerPort}/packages/main/
|
32
|
+
let baseUrl = "";
|
33
|
+
if (devServerPort) {
|
34
|
+
console.log(`Found port ${devServerPort} from '${path.join(devServerFolder, ".dev-server-port")}'`);
|
35
|
+
const devServerInRoot = !devServerFolder.includes(packageRepositoryPath);
|
36
|
+
if (devServerInRoot) {
|
37
|
+
baseUrl = `--base-url http://localhost:${devServerPort}/${packageRepositoryPath}/`;
|
38
|
+
} else {
|
39
|
+
baseUrl = `--base-url http://localhost:${devServerPort}/`;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
if (!baseUrl) {
|
44
|
+
console.log("No dev server running, running tests served from `dist`, make sure it is up to date");
|
45
|
+
}
|
46
|
+
|
47
|
+
// add single spec parameter if passed
|
48
|
+
let spec = "";
|
49
|
+
if (process.argv.length === 3) {
|
50
|
+
const specFile = process.argv[2];
|
51
|
+
spec = `--spec ${specFile}`;
|
52
|
+
}
|
53
|
+
|
54
|
+
// more parameters - pass them to wdio
|
55
|
+
let restParams = "";
|
56
|
+
if (process.argv.length > 3) {
|
57
|
+
restParams = process.argv.slice(2).join(" ");
|
58
|
+
}
|
59
|
+
|
60
|
+
// run wdio with calculated parameters
|
61
|
+
const cmd = `yarn cross-env WDIO_LOG_LEVEL=error wdio config/wdio.conf.js ${spec} ${baseUrl} ${restParams}`;
|
62
|
+
console.log(`executing: ${cmd}`);
|
63
|
+
child_process.execSync(cmd, {stdio: 'inherit'});
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-cf50976ce",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -13,8 +13,7 @@
|
|
13
13
|
"scripts": {},
|
14
14
|
"bin": {
|
15
15
|
"wc-dev": "bin/dev.js",
|
16
|
-
"wc-create-ui5-element": "bin/create-ui5-element.js"
|
17
|
-
"wc-init-ui5-package": "bin/init-ui5-package.js"
|
16
|
+
"wc-create-ui5-element": "bin/create-ui5-element.js"
|
18
17
|
},
|
19
18
|
"repository": {
|
20
19
|
"type": "git",
|
@@ -22,65 +21,53 @@
|
|
22
21
|
"directory": "packages/tools"
|
23
22
|
},
|
24
23
|
"dependencies": {
|
25
|
-
"@
|
26
|
-
"@
|
27
|
-
"@
|
28
|
-
"@
|
29
|
-
"@
|
30
|
-
"@
|
31
|
-
"@
|
32
|
-
"@rollup/plugin-url": "^6.0.0",
|
33
|
-
"@wdio/cli": "^7.2.0",
|
34
|
-
"@wdio/dot-reporter": "^7.2.0",
|
35
|
-
"@wdio/local-runner": "^7.2.0",
|
36
|
-
"@wdio/mocha-framework": "^7.2.0",
|
37
|
-
"@wdio/spec-reporter": "^7.2.0",
|
38
|
-
"@wdio/sync": "^7.2.0",
|
39
|
-
"@webcomponents/webcomponentsjs": "^2.5.0",
|
24
|
+
"@wdio/cli": "^7.19.7",
|
25
|
+
"@wdio/devtools-service": "^7.19.7",
|
26
|
+
"@wdio/dot-reporter": "^7.19.7",
|
27
|
+
"@wdio/local-runner": "^7.19.7",
|
28
|
+
"@wdio/mocha-framework": "^7.19.7",
|
29
|
+
"@wdio/spec-reporter": "^7.19.7",
|
30
|
+
"@wdio/static-server-service": "^7.19.5",
|
40
31
|
"chai": "^4.3.4",
|
41
32
|
"child_process": "^1.0.2",
|
42
33
|
"chokidar": "^3.5.1",
|
43
|
-
"chokidar-cli": "^
|
44
|
-
"clean-css": "^5.1.1",
|
45
|
-
"colors": "^1.4.0",
|
34
|
+
"chokidar-cli": "^3.0.0",
|
46
35
|
"command-line-args": "^5.1.1",
|
47
36
|
"concurrently": "^6.0.0",
|
48
37
|
"cross-env": "^7.0.3",
|
49
|
-
"cssnano": "^4.1.
|
38
|
+
"cssnano": "^4.1.11",
|
50
39
|
"escodegen": "^2.0.0",
|
51
40
|
"eslint": "^7.22.0",
|
52
41
|
"eslint-config-airbnb-base": "^14.2.1",
|
53
42
|
"eslint-plugin-import": "^2.22.1",
|
54
43
|
"esprima": "^4.0.1",
|
55
|
-
"folder-hash": "^4.0.1",
|
56
44
|
"getopts": "^2.3.0",
|
57
45
|
"glob": "^7.1.6",
|
46
|
+
"glob-parent": "^6.0.2",
|
47
|
+
"globby": "^13.1.1",
|
58
48
|
"handlebars": "^4.7.7",
|
59
|
-
"is-port-reachable": "^3.
|
49
|
+
"is-port-reachable": "^3.1.0",
|
60
50
|
"jsdoc": "^3.6.6",
|
61
51
|
"json-beautify": "^1.1.1",
|
62
52
|
"mkdirp": "^1.0.4",
|
63
|
-
"npm-run-all": "^4.1.3",
|
64
53
|
"nps": "^5.10.0",
|
65
|
-
"postcss": "^8.
|
66
|
-
"postcss-cli": "^
|
67
|
-
"postcss-
|
68
|
-
"postcss-
|
54
|
+
"postcss": "^8.4.5",
|
55
|
+
"postcss-cli": "^9.1.0",
|
56
|
+
"postcss-import": "^14.0.2",
|
57
|
+
"postcss-selector-parser": "^6.0.10",
|
69
58
|
"properties-reader": "^2.2.0",
|
70
|
-
"puppeteer": "^8.0.0",
|
71
59
|
"recursive-readdir": "^2.2.2",
|
60
|
+
"resolve": "^1.20.0",
|
72
61
|
"rimraf": "^3.0.2",
|
73
|
-
"
|
74
|
-
"
|
75
|
-
"
|
76
|
-
"
|
77
|
-
"rollup-plugin-string": "^3.0.0",
|
78
|
-
"rollup-plugin-terser": "^7.0.2",
|
79
|
-
"rollup-plugin-visualizer": "^4.2.0",
|
80
|
-
"serve": "github:vercel/serve#a85bd9d03ae267a492aac683616e028c0bfc6447",
|
81
|
-
"wdio-chromedriver-service": "^7.0.0"
|
62
|
+
"slash": "3.0.0",
|
63
|
+
"vite": "^2.9.12",
|
64
|
+
"wdio-chromedriver-service": "^7.3.2",
|
65
|
+
"zx": "^4.3.0"
|
82
66
|
},
|
83
67
|
"peerDependencies": {
|
84
68
|
"chromedriver": "*"
|
69
|
+
},
|
70
|
+
"devDependencies": {
|
71
|
+
"yargs": "^17.5.1"
|
85
72
|
}
|
86
73
|
}
|
package/bin/init-ui5-package.js
DELETED
@@ -1,195 +0,0 @@
|
|
1
|
-
const process = require("process");
|
2
|
-
const fs = require("fs");
|
3
|
-
const os = require("os");
|
4
|
-
const { babel } = require("@rollup/plugin-babel");
|
5
|
-
const { nodeResolve } = require("@rollup/plugin-node-resolve");
|
6
|
-
const url = require("@rollup/plugin-url");
|
7
|
-
const { terser } = require("rollup-plugin-terser");
|
8
|
-
const json = require("@rollup/plugin-json");
|
9
|
-
const colors = require("colors/safe");
|
10
|
-
const notify = require("rollup-plugin-notify");
|
11
|
-
const filesize = require("rollup-plugin-filesize");
|
12
|
-
const livereload = require("rollup-plugin-livereload");
|
13
|
-
|
14
|
-
const packageFile = JSON.parse(fs.readFileSync("./package.json"));
|
15
|
-
const packageName = packageFile.name;
|
16
|
-
const DEPLOY_PUBLIC_PATH = process.env.DEPLOY_PUBLIC_PATH || "";
|
17
|
-
|
18
|
-
function ui5DevImportCheckerPlugin() {
|
19
|
-
return {
|
20
|
-
name: "ui5-dev-import-checker-plugin",
|
21
|
-
transform(code, file) {
|
22
|
-
const re = new RegExp(`^import.*"${packageName}/`);
|
23
|
-
if (re.test(code)) {
|
24
|
-
throw new Error(`illegal import in ${file}`);
|
25
|
-
}
|
26
|
-
},
|
27
|
-
};
|
28
|
-
}
|
29
|
-
|
30
|
-
const reportedForPackages = new Set(); // sometimes writeBundle is called more than once per bundle -> suppress extra messages
|
31
|
-
function ui5DevReadyMessagePlugin() {
|
32
|
-
return {
|
33
|
-
name: "ui5-dev-message-ready-plugin",
|
34
|
-
writeBundle: (assets, bundle) => {
|
35
|
-
if (reportedForPackages.has(packageName)) {
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
console.log(colors.blue(`${colors.bold(packageName)} successfully built!`));
|
39
|
-
|
40
|
-
if (fs.existsSync(".port")) {
|
41
|
-
const port = `${fs.readFileSync(".port")}`;
|
42
|
-
if (port) {
|
43
|
-
console.log(colors.blue(`Navigate to: ${colors.bold(`http://localhost:${port}/test-resources/pages/`)}`));
|
44
|
-
}
|
45
|
-
}
|
46
|
-
reportedForPackages.add(packageName);
|
47
|
-
},
|
48
|
-
};
|
49
|
-
}
|
50
|
-
|
51
|
-
const getPlugins = ({ transpile }) => {
|
52
|
-
const plugins = [];
|
53
|
-
if (!process.env.DEV) {
|
54
|
-
plugins.push(filesize(
|
55
|
-
{
|
56
|
-
reporter(options, bundle, {
|
57
|
-
minSize, gzipSize, brotliSize, bundleSize,
|
58
|
-
fileName,
|
59
|
-
// "showBeforeSizes: release"
|
60
|
-
lastVersion,
|
61
|
-
// "showBeforeSizes: "release" or "showBeforeSizes": "build"
|
62
|
-
bundleSizeBefore, brotliSizeBefore, minSizeBefore, gzipSizeBefore,
|
63
|
-
}) {
|
64
|
-
// If a promise is returned, it will be awaited before rendering.
|
65
|
-
return `${fileName.padEnd(35)} ${minSize} / gzipped: ${gzipSize}`;
|
66
|
-
},
|
67
|
-
},
|
68
|
-
|
69
|
-
));
|
70
|
-
}
|
71
|
-
|
72
|
-
const publicPath = DEPLOY_PUBLIC_PATH;
|
73
|
-
|
74
|
-
plugins.push(ui5DevImportCheckerPlugin());
|
75
|
-
|
76
|
-
if (!transpile) {
|
77
|
-
plugins.push(json({
|
78
|
-
include: [
|
79
|
-
/.*assets\/.*\.json/,
|
80
|
-
],
|
81
|
-
namedExports: false,
|
82
|
-
}));
|
83
|
-
}
|
84
|
-
|
85
|
-
if (transpile) {
|
86
|
-
plugins.push(url({
|
87
|
-
limit: 0,
|
88
|
-
include: [
|
89
|
-
/.*assets\/.*\.json/,
|
90
|
-
],
|
91
|
-
emitFiles: true,
|
92
|
-
fileName: "[name].[hash][extname]",
|
93
|
-
publicPath,
|
94
|
-
}));
|
95
|
-
}
|
96
|
-
|
97
|
-
if (transpile) {
|
98
|
-
plugins.push(babel({
|
99
|
-
presets: ["@babel/preset-env"],
|
100
|
-
exclude: /node_modules\/(?!(lit-html|@ui5\/webcomponents))/, // exclude all node_modules/ except lit-html and all starting with @ui5/webcomponents
|
101
|
-
sourcemap: true,
|
102
|
-
babelHelpers: "bundled",
|
103
|
-
}));
|
104
|
-
}
|
105
|
-
|
106
|
-
plugins.push(nodeResolve());
|
107
|
-
|
108
|
-
if (!process.env.DEV) {
|
109
|
-
plugins.push(terser());
|
110
|
-
}
|
111
|
-
|
112
|
-
if (process.env.DEV) {
|
113
|
-
plugins.push(notify());
|
114
|
-
}
|
115
|
-
|
116
|
-
const es6DevMain = process.env.DEV && !transpile && packageName === "@ui5/webcomponents";
|
117
|
-
if (es6DevMain && os.platform() !== "win32") {
|
118
|
-
plugins.push(livereload({
|
119
|
-
watch: [
|
120
|
-
"dist/resources/bundle.esm.js",
|
121
|
-
"dist/**/*.html",
|
122
|
-
"dist/**/*.json",
|
123
|
-
],
|
124
|
-
}));
|
125
|
-
}
|
126
|
-
|
127
|
-
if (process.env.DEV) {
|
128
|
-
plugins.push(ui5DevReadyMessagePlugin());
|
129
|
-
}
|
130
|
-
|
131
|
-
return plugins;
|
132
|
-
};
|
133
|
-
|
134
|
-
const getES6Config = (input = "bundle.esm.js") => {
|
135
|
-
return [{
|
136
|
-
input,
|
137
|
-
output: {
|
138
|
-
dir: "dist/resources",
|
139
|
-
format: "esm",
|
140
|
-
sourcemap: true,
|
141
|
-
},
|
142
|
-
moduleContext: id => {
|
143
|
-
if (typeof id === "string" && id.includes("url-search-params-polyfill")) {
|
144
|
-
// suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
|
145
|
-
return "window";
|
146
|
-
}
|
147
|
-
},
|
148
|
-
watch: {
|
149
|
-
clearScreen: false,
|
150
|
-
},
|
151
|
-
plugins: getPlugins({ transpile: false }),
|
152
|
-
}];
|
153
|
-
};
|
154
|
-
|
155
|
-
const getES5Config = (input = "bundle.es5.js") => {
|
156
|
-
return [{
|
157
|
-
input,
|
158
|
-
output: {
|
159
|
-
dir: "dist/resources",
|
160
|
-
format: "iife",
|
161
|
-
inlineDynamicImports: true,
|
162
|
-
name: "sap-ui-webcomponents-bundle",
|
163
|
-
extend: "true", // Whether or not to extend the global variable defined by the name option in umd or iife formats.
|
164
|
-
sourcemap: true,
|
165
|
-
},
|
166
|
-
moduleContext: id => {
|
167
|
-
if (id.includes("url-search-params-polyfill")) {
|
168
|
-
// suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
|
169
|
-
return "window";
|
170
|
-
}
|
171
|
-
},
|
172
|
-
watch: {
|
173
|
-
clearScreen: false,
|
174
|
-
},
|
175
|
-
plugins: getPlugins({ transpile: true }),
|
176
|
-
}];
|
177
|
-
};
|
178
|
-
|
179
|
-
let config = getES6Config();
|
180
|
-
|
181
|
-
if (process.env.ES5_BUILD && fs.existsSync("bundle.es5.js")) {
|
182
|
-
config = config.concat(getES5Config());
|
183
|
-
}
|
184
|
-
|
185
|
-
if (process.env.SCOPE) {
|
186
|
-
if (fs.existsSync("bundle.scoped.esm.js")) {
|
187
|
-
config = config.concat(getES6Config("bundle.scoped.esm.js"));
|
188
|
-
|
189
|
-
if (fs.existsSync("bundle.scoped.es5.js") && process.env.ES5_BUILD) {
|
190
|
-
config = config.concat(getES5Config("bundle.scoped.es5.js"));
|
191
|
-
}
|
192
|
-
}
|
193
|
-
}
|
194
|
-
|
195
|
-
module.exports = config;
|