@ui5/webcomponents-tools 0.0.0-ef27ca1aa → 0.0.0-f24ff9019
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 +752 -0
- package/README.md +6 -6
- package/assets-meta.js +23 -3
- package/bin/dev.js +12 -1
- package/components-package/eslint.js +34 -0
- package/components-package/nps.js +112 -44
- package/components-package/postcss.components.js +18 -15
- package/components-package/postcss.themes.js +23 -16
- package/components-package/vite.config.js +13 -0
- package/components-package/wdio.js +405 -297
- package/components-package/wdio.sync.js +368 -0
- package/icons-collection/nps.js +52 -11
- package/lib/copy-and-watch/index.js +145 -0
- package/lib/copy-list/index.js +28 -0
- package/lib/create-icons/index.js +124 -54
- package/lib/create-illustrations/index.js +175 -0
- package/lib/create-new-component/index.js +72 -93
- package/lib/create-new-component/jsFileContentTemplate.js +73 -0
- package/lib/create-new-component/tsFileContentTemplate.js +80 -0
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- 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-custom-elements-manifest/index.js +327 -0
- package/lib/generate-js-imports/illustrations.js +83 -0
- package/lib/generate-json-imports/i18n.js +98 -47
- package/lib/generate-json-imports/themes.js +67 -17
- package/lib/hbs2lit/index.js +2 -4
- package/lib/hbs2lit/src/compiler.js +30 -9
- package/lib/hbs2lit/src/includesReplacer.js +23 -17
- package/lib/hbs2lit/src/litVisitor2.js +125 -26
- package/lib/hbs2lit/src/svgProcessor.js +12 -5
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +35 -7
- package/lib/hbs2ui5/index.js +69 -30
- package/lib/i18n/defaults.js +66 -54
- package/lib/i18n/toJSON.js +13 -10
- package/lib/jsdoc/config.json +1 -1
- package/lib/jsdoc/configTypescript.json +29 -0
- package/lib/jsdoc/plugin.js +65 -4
- package/lib/jsdoc/preprocess.js +146 -0
- package/lib/jsdoc/template/publish.js +32 -4
- package/lib/postcss-combine-duplicated-selectors/index.js +178 -0
- package/lib/postcss-css-to-esm/index.js +64 -16
- package/lib/postcss-css-to-json/index.js +31 -11
- package/lib/postcss-new-files/index.js +36 -0
- package/lib/postcss-p/postcss-p.mjs +14 -0
- package/lib/postcss-scope-vars/index.js +24 -0
- package/lib/replace-global-core/index.js +25 -0
- package/lib/scoping/get-all-tags.js +37 -0
- package/lib/scoping/lint-src.js +31 -0
- package/lib/scoping/missing-dependencies.js +65 -0
- package/lib/scoping/report-tags-usage.js +28 -0
- package/lib/scoping/scope-test-pages.js +40 -0
- package/lib/test-runner/test-runner.js +71 -0
- package/package.json +54 -54
- package/bin/init-ui5-package.js +0 -3
- package/components-package/rollup.js +0 -134
- package/components-package/serve.json +0 -3
- package/lib/documentation/index.js +0 -143
- 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/init-package/index.js +0 -119
- 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 -34
- 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/Demo.hbs +0 -1
- package/lib/init-package/resources/src/Demo.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/Demo.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/test/pages/index.html +0 -51
- package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
package/README.md
CHANGED
@@ -1,24 +1,24 @@
|
|
1
|
-

|
2
|
+
|
2
3
|
|
3
4
|
# UI5 Web Components - Tools
|
4
5
|
|
5
|
-
[](https://travis-ci.org/SAP/ui5-webcomponents)
|
6
6
|
[](https://www.npmjs.com/package/@ui5/webcomponents)
|
7
7
|
|
8
8
|
Provides libraries, configuration files and build artifacts,
|
9
9
|
used by other UI5 Web Components packages, such as `main` and `fiori`.
|
10
10
|
|
11
11
|
## Resources
|
12
|
-
- [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/
|
12
|
+
- [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
|
13
13
|
- [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
|
14
14
|
- [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
|
15
15
|
|
16
16
|
## Support
|
17
|
-
We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/
|
17
|
+
We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://join-ui5-slack.herokuapp.com/).
|
18
18
|
|
19
19
|
## Contribute
|
20
|
-
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/
|
20
|
+
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
|
21
21
|
|
22
22
|
## License
|
23
23
|
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
|
24
|
-
This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/
|
24
|
+
This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/main/LICENSE.txt) file.
|
package/assets-meta.js
CHANGED
@@ -1,13 +1,23 @@
|
|
1
1
|
const assetsMeta = {
|
2
2
|
"themes": {
|
3
|
-
"default": "
|
3
|
+
"default": "sap_horizon",
|
4
4
|
"all": [
|
5
5
|
"sap_fiori_3",
|
6
6
|
"sap_fiori_3_dark",
|
7
7
|
"sap_belize",
|
8
8
|
"sap_belize_hcb",
|
9
|
-
"sap_belize_hcw"
|
10
|
-
|
9
|
+
"sap_belize_hcw",
|
10
|
+
"sap_fiori_3_hcb",
|
11
|
+
"sap_fiori_3_hcw",
|
12
|
+
"sap_horizon",
|
13
|
+
"sap_horizon_dark",
|
14
|
+
"sap_horizon_hcb",
|
15
|
+
"sap_horizon_hcw",
|
16
|
+
"sap_horizon_exp",
|
17
|
+
"sap_horizon_dark_exp",
|
18
|
+
"sap_horizon_hcb_exp",
|
19
|
+
"sap_horizon_hcw_exp",
|
20
|
+
],
|
11
21
|
},
|
12
22
|
"languages": {
|
13
23
|
"default": "en",
|
@@ -16,17 +26,25 @@ const assetsMeta = {
|
|
16
26
|
"bg",
|
17
27
|
"ca",
|
18
28
|
"cs",
|
29
|
+
"cy",
|
19
30
|
"da",
|
20
31
|
"de",
|
21
32
|
"el",
|
22
33
|
"en",
|
34
|
+
"en_GB",
|
35
|
+
"en_US_sappsd",
|
36
|
+
"en_US_saprigi",
|
37
|
+
"en_US_saptrc",
|
23
38
|
"es",
|
39
|
+
"es_MX",
|
24
40
|
"et",
|
25
41
|
"fi",
|
26
42
|
"fr",
|
43
|
+
"fr_CA",
|
27
44
|
"hi",
|
28
45
|
"hr",
|
29
46
|
"hu",
|
47
|
+
"in",
|
30
48
|
"it",
|
31
49
|
"iw",
|
32
50
|
"ja",
|
@@ -38,6 +56,7 @@ const assetsMeta = {
|
|
38
56
|
"nl",
|
39
57
|
"no",
|
40
58
|
"pl",
|
59
|
+
"pt_PT",
|
41
60
|
"pt",
|
42
61
|
"ro",
|
43
62
|
"ru",
|
@@ -120,6 +139,7 @@ const assetsMeta = {
|
|
120
139
|
"sk",
|
121
140
|
"sl",
|
122
141
|
"sr",
|
142
|
+
"sr_Latn",
|
123
143
|
"sv",
|
124
144
|
"th",
|
125
145
|
"tr",
|
package/bin/dev.js
CHANGED
@@ -2,4 +2,15 @@
|
|
2
2
|
|
3
3
|
const child_process = require("child_process");
|
4
4
|
|
5
|
-
|
5
|
+
let command = process.argv[2];
|
6
|
+
const argument = process.argv[3];
|
7
|
+
|
8
|
+
if (command === "watch") {
|
9
|
+
if (["src", "test", "bundles", "styles", "templates", "samples"].includes(argument)) {
|
10
|
+
command = `watch.${argument}`;
|
11
|
+
}
|
12
|
+
} else if (command === "test") {
|
13
|
+
command = `test ${process.argv.slice(3).join(" ")}`;
|
14
|
+
}
|
15
|
+
|
16
|
+
child_process.execSync(`npx nps "${command}"`, {stdio: 'inherit'});
|
@@ -1,3 +1,36 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const path = require("path");
|
3
|
+
const tsMode = fs.existsSync(path.join(process.cwd(), "tsconfig.json"));
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Typescript Rules
|
7
|
+
*/
|
8
|
+
const overrides = tsMode ? [{
|
9
|
+
files: ["*.ts"],
|
10
|
+
parser: "@typescript-eslint/parser",
|
11
|
+
plugins: ["@typescript-eslint"],
|
12
|
+
extends: [
|
13
|
+
"plugin:@typescript-eslint/recommended",
|
14
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
15
|
+
],
|
16
|
+
parserOptions: {
|
17
|
+
"project": ["./tsconfig.json", "./packages/*/tsconfig.json"],
|
18
|
+
},
|
19
|
+
rules: {
|
20
|
+
"no-shadow": "off",
|
21
|
+
"@typescript-eslint/no-shadow": ["error"],
|
22
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
23
|
+
"@typescript-eslint/no-floating-promises": "off",
|
24
|
+
"@typescript-eslint/no-explicit-any": "off",
|
25
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
26
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
27
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
28
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
29
|
+
"@typescript-eslint/no-empty-function": "off",
|
30
|
+
"lines-between-class-members": "off",
|
31
|
+
}
|
32
|
+
}] : [];
|
33
|
+
|
1
34
|
module.exports = {
|
2
35
|
"env": {
|
3
36
|
"browser": true,
|
@@ -5,6 +38,7 @@ module.exports = {
|
|
5
38
|
},
|
6
39
|
"root": true,
|
7
40
|
"extends": "airbnb-base",
|
41
|
+
overrides,
|
8
42
|
"parserOptions": {
|
9
43
|
"ecmaVersion": 2018,
|
10
44
|
"sourceType": "module"
|
@@ -1,73 +1,141 @@
|
|
1
1
|
const path = require("path");
|
2
|
-
|
2
|
+
const fs = require("fs");
|
3
|
+
const resolve = require("resolve");
|
3
4
|
const LIB = path.join(__dirname, `../lib/`);
|
4
|
-
const
|
5
|
-
const serveConfig = path.join(__dirname, `serve.json`);
|
6
|
-
const polyfillPath = path.join(NODE_MODULES_PATH, `/@webcomponents/webcomponentsjs/**/*.*`);
|
5
|
+
const preprocessJSDocScript = resolve.sync("@ui5/webcomponents-tools/lib/jsdoc/preprocess.js");
|
7
6
|
|
8
7
|
const getScripts = (options) => {
|
9
8
|
|
10
|
-
|
9
|
+
// The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
|
10
|
+
const illustrationsData = options.illustrationsData || [];
|
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
|
+
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
13
|
+
|
14
|
+
// The script creates the "dist/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
|
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
|
+
|
17
|
+
const tsOption = options.typescript;
|
18
|
+
const tsCommand = tsOption ? "tsc" : "";
|
19
|
+
const tsWatchCommand = tsOption ? "tsc --watch" : "";
|
20
|
+
const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
|
21
|
+
const copySrcGenerated = tsOption ? "" : "copy.srcGenerated";
|
22
|
+
|
23
|
+
if (tsOption) {
|
24
|
+
try {
|
25
|
+
require("typescript");
|
26
|
+
} catch(e) {
|
27
|
+
console.error(`TypeScript is not found. Try to install it by running \`npm install --save-dev typescript\` if you are using npm or by running \`yarn add --dev typescript\` if you are using yarn.`);
|
28
|
+
process.exit(e.code);
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
let viteConfig;
|
33
|
+
if (fs.existsSync("config/vite.config.js")) {
|
34
|
+
// old project setup where config file is in separate folder
|
35
|
+
viteConfig = "-c config/vite.config.js";
|
36
|
+
} else if (fs.existsSync("vite.config.js")) {
|
37
|
+
// preferred way of custom configuration in root project folder
|
38
|
+
viteConfig = "";
|
39
|
+
} else {
|
40
|
+
// no custom configuration - use default from tools project
|
41
|
+
viteConfig = `-c "${require.resolve("@ui5/webcomponents-tools/components-package/vite.config.js")}"`;
|
42
|
+
}
|
43
|
+
|
44
|
+
let eslintConfig;
|
45
|
+
if (fs.existsSync(".eslintrc.js") || fs.existsSync(".eslintrc.cjs")) {
|
46
|
+
// preferred way of custom configuration in root project folder
|
47
|
+
eslintConfig = "";
|
48
|
+
} else {
|
49
|
+
// no custom configuration - use default from tools project
|
50
|
+
eslintConfig = `--config "${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}"`;
|
51
|
+
}
|
11
52
|
|
12
53
|
const scripts = {
|
13
|
-
clean:
|
14
|
-
lint:
|
15
|
-
|
54
|
+
clean: 'rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
|
55
|
+
lint: `eslint . ${eslintConfig}`,
|
56
|
+
lintfix: `eslint . ${eslintConfig} --fix`,
|
57
|
+
prepare: {
|
58
|
+
default: `${tsCrossEnv} nps clean prepare.all typescript generateAPI`,
|
59
|
+
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
|
60
|
+
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
61
|
+
},
|
62
|
+
typescript: tsCommand,
|
16
63
|
build: {
|
17
|
-
default: "nps lint
|
18
|
-
templates: `mkdirp dist/generated/templates && node "${LIB}/hbs2ui5/index.js" -d src/ -o
|
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`,
|
19
66
|
styles: {
|
20
|
-
default:
|
21
|
-
themes: "postcss
|
22
|
-
components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/",
|
67
|
+
default: `nps build.styles.themes build.styles.components ${copySrcGenerated}`,
|
68
|
+
themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
|
69
|
+
components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
|
23
70
|
},
|
24
71
|
i18n: {
|
25
72
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
26
|
-
defaultsjs: `
|
27
|
-
json: `
|
73
|
+
defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
74
|
+
json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
|
28
75
|
},
|
29
76
|
jsonImports: {
|
30
77
|
default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
|
31
|
-
themes: `node "${LIB}/generate-json-imports/themes.js"`,
|
32
|
-
i18n: `node "${LIB}/generate-json-imports/i18n.js"`,
|
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`,
|
33
80
|
},
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
81
|
+
jsImports: {
|
82
|
+
default: "mkdirp dist/generated/js-imports && nps build.jsImports.illustrationsLoaders",
|
83
|
+
illustrationsLoaders: createIllustrationsLoadersScript,
|
84
|
+
},
|
85
|
+
bundle: `vite build ${viteConfig}`,
|
86
|
+
illustrations: createIllustrationsJSImportsScript,
|
40
87
|
},
|
41
88
|
copy: {
|
42
|
-
default: "nps copy.src copy.
|
43
|
-
src: "copy-and-watch
|
44
|
-
|
45
|
-
|
89
|
+
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/`,
|
92
|
+
props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
|
46
93
|
},
|
47
94
|
watch: {
|
48
|
-
default:
|
49
|
-
|
50
|
-
|
51
|
-
|
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"`,
|
96
|
+
devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
|
97
|
+
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
|
98
|
+
typescript: tsWatchCommand,
|
99
|
+
props: 'nps "copy.props --watch --safe --skip-initial-copy"',
|
100
|
+
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
52
101
|
styles: {
|
53
102
|
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
|
54
103
|
themes: 'nps "build.styles.themes -w"',
|
55
|
-
components:
|
104
|
+
components: {
|
105
|
+
default: 'concurrently "nps watch.styles.components.existingFiles" "nps watch.styles.components.newFiles"',
|
106
|
+
existingFiles: `nps "build.styles.components -w"`,
|
107
|
+
newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
|
108
|
+
},
|
56
109
|
},
|
57
|
-
templates:
|
58
|
-
|
110
|
+
templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
|
111
|
+
api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
|
112
|
+
i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
|
59
113
|
},
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
114
|
+
start: "nps prepare watch.devServer",
|
115
|
+
test: `node "${LIB}/test-runner/test-runner.js"`,
|
116
|
+
"test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
|
117
|
+
"test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
|
118
|
+
startWithScope: "nps scope.prepare scope.watchWithBundle",
|
119
|
+
scope: {
|
120
|
+
prepare: "nps scope.lint prepare scope.testPages",
|
121
|
+
lint: `node "${LIB}/scoping/lint-src.js"`,
|
122
|
+
testPages: {
|
123
|
+
default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
|
124
|
+
clean: "rimraf test/pages/scoped",
|
125
|
+
copy: `node "${LIB}/copy-and-watch/index.js" --silent "test/pages/**/*" test/pages/scoped`,
|
126
|
+
replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
|
127
|
+
},
|
128
|
+
watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
|
129
|
+
watch: 'concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.props" "nps watch.styles"',
|
130
|
+
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
66
131
|
},
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
132
|
+
generateAPI: {
|
133
|
+
default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest",
|
134
|
+
prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
|
135
|
+
prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
|
136
|
+
preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
|
137
|
+
jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
|
138
|
+
cleanup: "rimraf jsdoc-dist/"
|
71
139
|
},
|
72
140
|
};
|
73
141
|
|
@@ -1,21 +1,24 @@
|
|
1
1
|
const postcssImport = require('postcss-import');
|
2
2
|
const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
|
3
|
+
const postcssScopeVars = require('../lib/postcss-scope-vars/index.js');
|
3
4
|
const cssnano = require('cssnano');
|
4
|
-
const fs = require("fs")
|
5
|
+
const fs = require("fs")
|
5
6
|
|
6
|
-
|
7
|
+
|
8
|
+
const packageJSON = JSON.parse(fs.readFileSync("./package.json"))
|
7
9
|
|
8
10
|
module.exports = {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
11
|
+
plugins: [
|
12
|
+
postcssImport(),
|
13
|
+
cssnano({
|
14
|
+
preset: [
|
15
|
+
'default', {
|
16
|
+
mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
|
17
|
+
mergeRules: false, // https://github.com/cssnano/cssnano/issues/730
|
18
|
+
},
|
19
|
+
]
|
20
|
+
}),
|
21
|
+
postcssScopeVars({version: packageJSON.version}),
|
22
|
+
postcssCSStoESM({ toReplace: 'src', includeDefaultTheme: true, packageName: packageJSON.name }),
|
23
|
+
]
|
24
|
+
}
|
@@ -1,23 +1,30 @@
|
|
1
1
|
const postcssImport = require('postcss-import');
|
2
|
-
const combineSelectors = require('postcss-combine-duplicated-selectors');
|
2
|
+
const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
|
3
3
|
const postcssCSStoJSON = require('../lib/postcss-css-to-json/index.js');
|
4
4
|
const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
|
5
|
+
const postcssScopeVars = require('../lib/postcss-scope-vars/index.js');
|
5
6
|
const cssnano = require('cssnano');
|
7
|
+
const fs = require("fs");
|
8
|
+
|
9
|
+
|
10
|
+
const packageJSON = JSON.parse(fs.readFileSync("./package.json"))
|
11
|
+
const packageName = packageJSON.name;
|
6
12
|
|
7
13
|
module.exports = {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
plugins: [
|
15
|
+
postcssScopeVars({version: packageJSON.version}),
|
16
|
+
postcssImport(),
|
17
|
+
combineSelectors({
|
18
|
+
removeDuplicatedProperties: true
|
19
|
+
}),
|
20
|
+
cssnano({
|
21
|
+
preset: [
|
22
|
+
'default', {
|
23
|
+
mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
|
24
|
+
},
|
25
|
+
]
|
26
|
+
},),
|
27
|
+
postcssCSStoJSON({ toReplace: 'src', packageName }),
|
28
|
+
postcssCSStoESM({ toReplace: 'src', packageName }),
|
29
|
+
]
|
23
30
|
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// vite.config.js
|
2
|
+
import { defineConfig } from 'vite';
|
3
|
+
import virtualIndex from '../lib/dev-server/virtual-index-html-plugin.js';
|
4
|
+
|
5
|
+
export default defineConfig(async () => {
|
6
|
+
const data = await virtualIndex();
|
7
|
+
return {
|
8
|
+
build: {
|
9
|
+
emptyOutDir: false,
|
10
|
+
},
|
11
|
+
plugins: [data],
|
12
|
+
}
|
13
|
+
})
|