@ui5/create-webcomponents-package 0.0.0-e818f286e → 0.0.0-ebd9a4db3

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +1591 -0
  2. package/README.md +28 -12
  3. package/create-package.js +252 -0
  4. package/package.json +6 -3
  5. package/template/.eslintignore +4 -0
  6. package/template/.eslintrc.cjs +5 -0
  7. package/template/.npsrc.json +3 -0
  8. package/template/cypress/component/MyFirstComponent.cy.tsx +13 -0
  9. package/template/cypress/fixtures/example.json +5 -0
  10. package/template/cypress/support/commands.ts +37 -0
  11. package/template/cypress/support/component-index.html +12 -0
  12. package/template/cypress/support/component.ts +36 -0
  13. package/template/cypress/tsconfig.template.json +19 -0
  14. package/template/cypress.config.ts +10 -0
  15. package/template/env +1 -0
  16. package/template/gitignore +4 -0
  17. package/template/npmrc +2 -0
  18. package/template/{package-scripts.js → package-scripts.cjs} +1 -1
  19. package/template/package.json +35 -0
  20. package/template/src/{Assets.js → Assets.ts} +1 -1
  21. package/template/src/MyFirstComponent.ts +56 -0
  22. package/template/src/MyFirstComponentTemplate.tsx +9 -0
  23. package/template/{bundle.esm.js → src/bundle.esm.ts} +4 -5
  24. package/template/src/i18n/messagebundle.properties +3 -2
  25. package/template/src/i18n/messagebundle_de.properties +1 -1
  26. package/template/src/i18n/messagebundle_en.properties +1 -1
  27. package/template/src/i18n/messagebundle_es.properties +1 -1
  28. package/template/src/i18n/messagebundle_fr.properties +1 -1
  29. package/template/src/themes/MyFirstComponent.css +16 -10
  30. package/template/src/themes/sap_horizon_dark/parameters-bundle.css +3 -0
  31. package/template/src/themes/sap_horizon_hcb/parameters-bundle.css +3 -0
  32. package/template/test/pages/css/index.css +89 -0
  33. package/template/test/pages/img/logo.png +0 -0
  34. package/template/test/pages/index.html +42 -43
  35. package/template/tsconfig.template.json +14 -0
  36. package/template/vite.config.js +14 -0
  37. package/index.js +0 -169
  38. package/template/config/postcss.components/postcss.config.js +0 -1
  39. package/template/config/postcss.themes/postcss.config.js +0 -1
  40. package/template/config/wdio.conf.js +0 -1
  41. package/template/src/MyFirstComponent.hbs +0 -1
  42. package/template/src/MyFirstComponent.js +0 -67
  43. package/template/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  44. package/template/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  45. package/template/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  46. package/template/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
  47. package/template/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
  48. package/template/test/specs/Demo.spec.js +0 -12
  49. /package/template/src/themes/{sap_belize → sap_horizon}/parameters-bundle.css +0 -0
  50. /package/template/src/themes/{sap_belize_hcb → sap_horizon_hcw}/parameters-bundle.css +0 -0
package/README.md CHANGED
@@ -1,22 +1,38 @@
1
- ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
2
-
3
- # UI5 Web Components - Create Package
1
+ # ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_water.png)UI5 Web Components - Create Package
4
2
 
5
3
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)
6
4
 
7
5
  Provides an `npm init` script for creating new "UI5 Web Components" packages.
8
6
 
9
- ## Usage
7
+ ## Usage with npm
8
+
9
+ ```
10
+ Usage:
11
+
12
+ # npm 6.x
13
+ npm init @ui5/webcomponents-package [OPTIONS]
14
+ # npm 7+, an extra double-dash is needed:
15
+ npm init @ui5/webcomponents-package -- [OPTIONS]
10
16
 
11
- with `npm`
17
+ Options:
18
+ --name <string> - defines the package name
19
+ --test-setup <"cypress" | "manual"> - defines whether the predefined test setup should be added or it will be configured manually.
20
+ --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
21
+ ```
12
22
 
13
- - `npm init @ui5/webcomponents-package` (the user will be asked for **name**, **port**, **tag**);
14
- - `npm init @ui5/webcomponents-package <NEW-PACKAGE-NAME>` (the user will be asked for **port** and **tag** only).
23
+ The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
24
+ components package.
15
25
 
16
- And with `yarn`
26
+ ## Usage with yarn
17
27
 
18
- - `yarn create @ui5/webcomponents-package`
19
- - `yarn create @ui5/webcomponents-package <NEW-PACKAGE-NAME>`.
28
+ ```
29
+ Usage:
30
+ yarn create @ui5/webcomponents-package [OPTIONS]
31
+ Options:
32
+ --name <string> - defines the package name
33
+ --test-setup <"cypress" | "manual"> - defines whether the predefined test setup should be added or it will be configured manually.
34
+ --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
35
+ ```
20
36
 
21
37
  The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
22
38
  components package.
@@ -24,10 +40,10 @@ components package.
24
40
  ## Resources
25
41
  - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
26
42
  - [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
27
- - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
43
+ - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/play/)
28
44
 
29
45
  ## Support
30
- 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/).
46
+ 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://ui5-slack-invite.cfapps.eu10.hana.ondemand.com/).
31
47
 
32
48
  ## Contribute
33
49
  Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
@@ -0,0 +1,252 @@
1
+ #!/usr/bin/env node
2
+ import fs from "fs/promises";
3
+ import path, { dirname } from "path";
4
+ import prompts from "prompts";
5
+ import parser from "npm-config-user-agent-parser";
6
+ import yargs from "yargs/yargs";
7
+ import { hideBin } from "yargs/helpers";
8
+ import { fileURLToPath } from "url";
9
+ import * as prettier from "prettier";
10
+
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+ const argv = yargs(hideBin(process.argv)).argv;
14
+ const VERSION = JSON.parse(
15
+ await fs.readFile(path.join(__dirname, "package.json")),
16
+ ).version;
17
+
18
+ // Constants
19
+ const SUPPORTED_TEST_SETUPS = ["cypress", "manual"];
20
+ const SRC_DIR = path.join(__dirname, "template");
21
+ const DEST_DIR = process.cwd();
22
+
23
+ const FILES_TO_RENAME = {
24
+ "eslintignore": ".eslintignore",
25
+ "eslintrc.cjs": ".eslintrc.cjs",
26
+ "npsrc.json": ".npsrc.json",
27
+ "npmrc": ".npmrc",
28
+ "env": ".env",
29
+ "gitignore": ".gitignore",
30
+ "tsconfig.template.json": "tsconfig.json",
31
+ "cypress/tsconfig.template.json": "cypress/tsconfig.json"
32
+ };
33
+ const FILES_TO_COPY = ["test/pages/img/logo.png"];
34
+
35
+ // Validation Patterns
36
+ const PackageNamePattern =
37
+ /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
38
+ const TagPattern = /^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/;
39
+
40
+ // Utility Functions
41
+ const isPackageNameValid = name =>
42
+ typeof name === "string" && PackageNamePattern.test(name);
43
+ const isTagValid = tag => typeof tag === "string" && TagPattern.test(tag);
44
+ const isTestSetupValid = setup =>
45
+ typeof setup === "string" && SUPPORTED_TEST_SETUPS.includes(setup);
46
+
47
+ async function collectFiles(dir, fileList = []) {
48
+ const entries = await fs.readdir(dir, { withFileTypes: true });
49
+
50
+ for (const entry of entries) {
51
+ const fullPath = path.join(dir, entry.name);
52
+ if (entry.isDirectory()) {
53
+ await collectFiles(fullPath, fileList);
54
+ } else if (entry.isFile()) {
55
+ fileList.push(fullPath);
56
+ }
57
+ }
58
+
59
+ return fileList;
60
+ }
61
+
62
+ /**
63
+ * Hyphanates the given PascalCase string, f.e.:
64
+ * Foo -> "my-foo" (adds preffix)
65
+ * FooBar -> "foo-bar"
66
+ */
67
+ const hyphenateComponentName = componentName => {
68
+ const result = componentName
69
+ .replace(/([a-z])([A-Z])/g, "$1-$2")
70
+ .toLowerCase();
71
+ return result.includes("-") ? result : `my-${result}`;
72
+ };
73
+
74
+ const replacePlaceholders = (content, replacements) =>
75
+ content.replace(/{{(.*?)}}/g, (_, key) => replacements[key.trim()] || "");
76
+
77
+ const generateFilesContent = async (
78
+ packageName,
79
+ componentName,
80
+ skipSubfolder,
81
+ testSetup,
82
+ ) => {
83
+ // All variables that will be replaced in the content of the template folder/
84
+ const vars = {
85
+ INIT_PACKAGE_VAR_NAME: packageName,
86
+ INIT_PACKAGE_VERSION: VERSION,
87
+ INIT_PACKAGE_VAR_TAG: argv.tag || hyphenateComponentName(componentName),
88
+ INIT_PACKAGE_VAR_CLASS_NAME: componentName,
89
+ INIT_PACKAGE_CYPRESS_ROOT_TSCONFIG:
90
+ testSetup === "cypress"
91
+ ? `"tsBuildInfoFile": "dist/.tsbuildinfo",\n"rootDir": "src",\n"composite": true,`
92
+ : "",
93
+ INIT_PACKAGE_CYPRESS_DEV_DEPS:
94
+ testSetup === "cypress"
95
+ ? `"@ui5/cypress-ct-ui5-webc": "^0.0.4",\n"cypress": "^13.11.0",`
96
+ : "",
97
+ INIT_PACKAGE_CYPRESS_TEST_COMMANDS:
98
+ testSetup === "cypress"
99
+ ? `"test": "cypress run --component --browser chrome",\n"test:open": "cypress open --component --browser chrome",`
100
+ : "",
101
+ INIT_PACKAGE_CYPRESS_ESLINT_IGNORES:
102
+ testSetup === "cypress" ? `cypress/*\ncypress.config.*` : "",
103
+ };
104
+
105
+ const packageBaseName = packageName.includes("@")
106
+ ? packageName.slice(packageName.lastIndexOf("/") + 1)
107
+ : packageName;
108
+ const destDir = skipSubfolder
109
+ ? path.join(DEST_DIR)
110
+ : path.join(DEST_DIR, packageBaseName);
111
+
112
+ await processFiles(destDir, vars, testSetup);
113
+
114
+ console.log("\nPackage successfully created!\nNext steps:\n");
115
+ console.log(`$ cd ${destDir}`);
116
+
117
+ try {
118
+ const userAgent = parser(process.env.npm_config_user_agent);
119
+ userAgent.yarn
120
+ ? console.log(`$ yarn\n$ yarn start`)
121
+ : console.log(`$ npm i\n$ npm start`);
122
+ } catch {
123
+ console.log(`$ npm i\n$ npm start`);
124
+ }
125
+
126
+ console.log("\n");
127
+ };
128
+
129
+ async function processFiles(destDir, replacements, testSetup) {
130
+ const files = await collectFiles(SRC_DIR);
131
+ const FILE_PATHS_TO_SKIP = [
132
+ testSetup !== "cypress" ? "cypress" : undefined,
133
+ ].filter(Boolean);
134
+
135
+ for (const file of files) {
136
+ const relativePath = path.relative(SRC_DIR, file);
137
+ let destPath = path.join(destDir, relativePath);
138
+
139
+ if (FILE_PATHS_TO_SKIP.some(filePath => file.includes(filePath))) {
140
+ // console.log(`Skipped: ${file} -> ${destPath}`);
141
+ continue;
142
+ }
143
+
144
+ // Component related file based on the user input
145
+ destPath = destPath.replace(
146
+ "/MyFirstComponent",
147
+ `/${replacements.INIT_PACKAGE_VAR_CLASS_NAME}`,
148
+ );
149
+
150
+ // Files that need to be renamed
151
+ if (FILES_TO_RENAME[relativePath]) {
152
+ destPath = destPath.replace(
153
+ relativePath,
154
+ FILES_TO_RENAME[relativePath],
155
+ );
156
+ }
157
+
158
+ await fs.mkdir(path.dirname(destPath), { recursive: true });
159
+
160
+ if (FILES_TO_COPY.includes(relativePath)) {
161
+ // Image like files that doesn't need proccessing
162
+ await fs.copyFile(file, destPath);
163
+ } else {
164
+ const content = await fs.readFile(file, { encoding: "utf8" });
165
+ const replaced = replacePlaceholders(content, replacements);
166
+ let formatted;
167
+ try {
168
+ formatted = await prettier.format(replaced, {
169
+ useTabs: true,
170
+ tabWidth: 4,
171
+ quoteProps: "consistent",
172
+ arrowParens: "avoid",
173
+ filepath: file,
174
+ });
175
+ // console.log(`Formatted: ${file} -> ${destPath}`);
176
+ } catch {
177
+ // console.log(`Not formatted: ${file} -> ${destPath}`);
178
+ formatted = replaced;
179
+ }
180
+
181
+ await fs.writeFile(destPath, formatted);
182
+ }
183
+
184
+ // console.log(`Processed: ${file} -> ${destPath}`);
185
+ }
186
+ }
187
+
188
+ const createWebcomponentsPackage = async () => {
189
+ let response;
190
+ if (argv.name && !isPackageNameValid(argv.name)) {
191
+ throw new Error(
192
+ "The package name should be a string, starting with letter and containing the following symbols [a-z, A-Z, 0-9].",
193
+ );
194
+ }
195
+
196
+ if (argv.testSetup && !isTestSetupValid(argv.testSetup)) {
197
+ throw new Error(
198
+ `The test setup should be a string and one of the following options: ${SUPPORTED_TEST_SETUPS.join(", ")}`,
199
+ );
200
+ }
201
+
202
+ let packageName = argv.name || "my-package";
203
+ let componentName = "MyComponent";
204
+ let testSetup = argv.testSetup || "manual";
205
+ const skipSubfolder = !!argv.skipSubfolder;
206
+
207
+ if (argv.skip) {
208
+ return generateFilesContent(
209
+ packageName,
210
+ componentName,
211
+ skipSubfolder,
212
+ testSetup,
213
+ );
214
+ }
215
+
216
+ if (!argv.name) {
217
+ response = await prompts({
218
+ type: "text",
219
+ name: "name",
220
+ message: "Package name:",
221
+ validate: value =>
222
+ isPackageNameValid(value)
223
+ ? true
224
+ : "Package name should be a string, starting with a letter and containing the following symbols [a-z, A-Z ,0-9, _, -].",
225
+ });
226
+ packageName = response.name;
227
+ }
228
+
229
+ if (!argv.testSetup) {
230
+ response = await prompts({
231
+ type: "select",
232
+ name: "testSetup",
233
+ message: "How would you like to set up testing?",
234
+ choices: [
235
+ { title: "Cypress", value: "cypress" },
236
+ { title: "I'll set it up manually", value: "manual" },
237
+ ],
238
+ initial: 0,
239
+ });
240
+
241
+ testSetup = response.testSetup;
242
+ }
243
+
244
+ return generateFilesContent(
245
+ packageName,
246
+ componentName,
247
+ skipSubfolder,
248
+ testSetup,
249
+ );
250
+ };
251
+
252
+ createWebcomponentsPackage();
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@ui5/create-webcomponents-package",
3
- "version": "0.0.0-e818f286e",
3
+ "version": "0.0.0-ebd9a4db3",
4
4
  "description": "UI5 Web Components: create package",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
7
+ "type": "module",
7
8
  "private": false,
8
9
  "keywords": [
9
10
  "openui5",
@@ -11,7 +12,7 @@
11
12
  "ui5"
12
13
  ],
13
14
  "bin": {
14
- "create-webcomponents-package": "index.js"
15
+ "create-webcomponents-package": "create-package.js"
15
16
  },
16
17
  "repository": {
17
18
  "type": "git",
@@ -21,6 +22,8 @@
21
22
  "dependencies": {
22
23
  "mkdirp": "^1.0.4",
23
24
  "npm-config-user-agent-parser": "^1.0.0",
24
- "prompts": "^2.4.1"
25
+ "prettier": "^3.5.3",
26
+ "prompts": "^2.4.1",
27
+ "yargs": "^17.5.1"
25
28
  }
26
29
  }
@@ -1,3 +1,7 @@
1
1
  # Note: Changes to this file also must be applied to the top level .eslintignore file.
2
2
  dist
3
3
  test
4
+ src/generated
5
+ .eslintrc.cjs
6
+
7
+ {{INIT_PACKAGE_CYPRESS_ESLINT_IGNORES}}
@@ -0,0 +1,5 @@
1
+ const config = require("@ui5/webcomponents-tools/components-package/eslint.js");
2
+
3
+ // This eslint config is defined @ui5/webcomponents-tools,
4
+ // Feel free to override part of the configuration or provide entirely new config to fit your dev requirements.
5
+ module.exports = config;
@@ -0,0 +1,3 @@
1
+ {
2
+ "config": "./package-scripts.cjs"
3
+ }
@@ -0,0 +1,13 @@
1
+ import {{INIT_PACKAGE_VAR_CLASS_NAME}} from "../../src/{{INIT_PACKAGE_VAR_CLASS_NAME}}.js";
2
+
3
+ describe('{{INIT_PACKAGE_VAR_CLASS_NAME}}.cy.tsx', () => {
4
+ it('playground', () => {
5
+ cy.mount(<{{INIT_PACKAGE_VAR_CLASS_NAME}} />)
6
+
7
+ cy.get("[{{INIT_PACKAGE_VAR_TAG}}]")
8
+ .click();
9
+
10
+ cy.get("[{{INIT_PACKAGE_VAR_TAG}}]")
11
+ .should("have.prop", "count", 1)
12
+ })
13
+ })
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "Using fixtures to represent data",
3
+ "email": "hello@cypress.io",
4
+ "body": "Fixtures are a great way to mock data for responses to routes"
5
+ }
@@ -0,0 +1,37 @@
1
+ /// <reference types="cypress" />
2
+ // ***********************************************
3
+ // This example commands.ts shows you how to
4
+ // create various custom commands and overwrite
5
+ // existing commands.
6
+ //
7
+ // For more comprehensive examples of custom
8
+ // commands please read more here:
9
+ // https://on.cypress.io/custom-commands
10
+ // ***********************************************
11
+ //
12
+ //
13
+ // -- This is a parent command --
14
+ // Cypress.Commands.add('login', (email, password) => { ... })
15
+ //
16
+ //
17
+ // -- This is a child command --
18
+ // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
19
+ //
20
+ //
21
+ // -- This is a dual command --
22
+ // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
23
+ //
24
+ //
25
+ // -- This will overwrite an existing command --
26
+ // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
27
+ //
28
+ // declare global {
29
+ // namespace Cypress {
30
+ // interface Chainable {
31
+ // login(email: string, password: string): Chainable<void>
32
+ // drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
33
+ // dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
34
+ // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
35
+ // }
36
+ // }
37
+ // }
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
+ <title>Components App</title>
8
+ </head>
9
+ <body>
10
+ <div data-cy-root></div>
11
+ </body>
12
+ </html>
@@ -0,0 +1,36 @@
1
+ // ***********************************************************
2
+ // This example support/component.ts is processed and
3
+ // loaded automatically before your test files.
4
+ //
5
+ // This is a great place to put global configuration and
6
+ // behavior that modifies Cypress.
7
+ //
8
+ // You can change the location of this file or turn off
9
+ // automatically serving support files with the
10
+ // 'supportFile' configuration option.
11
+ //
12
+ // You can read more here:
13
+ // https://on.cypress.io/configuration
14
+ // ***********************************************************
15
+
16
+ // Import commands.js using ES2015 syntax:
17
+ import './commands'
18
+
19
+ import { mount } from '@ui5/cypress-ct-ui5-webc'
20
+
21
+ // Augment the Cypress namespace to include type definitions for
22
+ // your custom command.
23
+ // Alternatively, can be defined in cypress/support/component.d.ts
24
+ // with a <reference path="./component" /> at the top of your spec.
25
+ declare global {
26
+ namespace Cypress {
27
+ interface Chainable {
28
+ mount: typeof mount
29
+ }
30
+ }
31
+ }
32
+
33
+ Cypress.Commands.add('mount', mount)
34
+
35
+ // Example use:
36
+ // cy.mount(MyComponent)
@@ -0,0 +1,19 @@
1
+ {
2
+ "include": [
3
+ "./**/*"
4
+ ],
5
+ "compilerOptions": {
6
+ "module": "NodeNext",
7
+ "moduleResolution": "nodenext",
8
+ "jsx": "react-jsx",
9
+ "jsxImportSource": "@ui5/webcomponents-base",
10
+ "types": [
11
+ "cypress"
12
+ ]
13
+ },
14
+ "references": [
15
+ {
16
+ "path": "../"
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,10 @@
1
+ import { defineConfig } from "cypress";
2
+
3
+ export default defineConfig({
4
+ component: {
5
+ devServer: {
6
+ framework: "@ui5/cypress-ct-ui5-webc" as any,
7
+ bundler: "vite",
8
+ },
9
+ },
10
+ });
package/template/env ADDED
@@ -0,0 +1 @@
1
+ VITE_BUNDLE_PATH="../../dist/bundle.esm.js"
@@ -0,0 +1,4 @@
1
+ node_modules
2
+ dist
3
+ src/generated
4
+ .dev-server-port
package/template/npmrc ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect the chromedriver version
2
+ detect_chromedriver_version=true
@@ -1,7 +1,7 @@
1
1
  const getScripts = require("@ui5/webcomponents-tools/components-package/nps.js"); //eslint-disable-line
2
2
 
3
3
  const options = {
4
- port: INIT_PACKAGE_VAR_PORT,
4
+ port: 8080,
5
5
  };
6
6
 
7
7
  const scripts = getScripts(options);
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "{{INIT_PACKAGE_VAR_NAME}}",
3
+ "version": "0.0.1",
4
+ "ui5": {
5
+ "webComponentsPackage": true
6
+ },
7
+ "type": "module",
8
+ "scripts": {
9
+ "clean": "wc-dev clean",
10
+ "lint": "wc-dev lint",
11
+ "start": "wc-dev start",
12
+ "watch": "wc-dev watch",
13
+ "build": "wc-dev build",
14
+ {{INIT_PACKAGE_CYPRESS_TEST_COMMANDS}}
15
+ "create-ui5-element": "wc-create-ui5-element",
16
+ "prepublishOnly": "npm run build"
17
+ },
18
+ "exports": {
19
+ "./src/*": "./src/*",
20
+ "./dist/*": "./dist/*",
21
+ "./package.json": "./package.json",
22
+ "./bundle.js": "./bundle.js",
23
+ "./*": "./dist/*"
24
+ },
25
+ "dependencies": {
26
+ "@ui5/webcomponents-base": "{{INIT_PACKAGE_VERSION}}",
27
+ "@ui5/webcomponents-theming": "{{INIT_PACKAGE_VERSION}}"
28
+ },
29
+ "devDependencies": {
30
+ {{INIT_PACKAGE_CYPRESS_DEV_DEPS}}
31
+ "@ui5/webcomponents-tools": "{{INIT_PACKAGE_VERSION}}",
32
+ "chromedriver": "*",
33
+ "typescript": "^5.6.2"
34
+ }
35
+ }
@@ -1,5 +1,5 @@
1
1
  import "@ui5/webcomponents-theming/dist/Assets.js"; // Theming
2
2
 
3
- // own INIT_PACKAGE_VAR_NAME package assets
3
+ // own {{INIT_PACKAGE_VAR_NAME}} package assets
4
4
  import "./generated/json-imports/Themes.js";
5
5
  import "./generated/json-imports/i18n.js";
@@ -0,0 +1,56 @@
1
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
3
+ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
4
+ import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
5
+ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
6
+ import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
7
+
8
+ // Template
9
+ import {{INIT_PACKAGE_VAR_CLASS_NAME}}Template from "./{{INIT_PACKAGE_VAR_CLASS_NAME}}Template.js";
10
+
11
+ // Styles
12
+ import {{INIT_PACKAGE_VAR_CLASS_NAME}}Css from "./generated/themes/{{INIT_PACKAGE_VAR_CLASS_NAME}}.css.js";
13
+
14
+ import { COUNT } from "./generated/i18n/i18n-defaults.js";
15
+
16
+ /**
17
+ * @class
18
+ *
19
+ * <h3 class="comment-api-title">Overview</h3>
20
+ *
21
+ * The <code>{{INIT_PACKAGE_VAR_TAG}}</code> component is a demo component that displays some text.
22
+ *
23
+ * @constructor
24
+ * @extends UI5Element
25
+ * @public
26
+ */
27
+ @customElement({
28
+ tag: "{{INIT_PACKAGE_VAR_TAG}}",
29
+ renderer: jsxRenderer,
30
+ styles: {{INIT_PACKAGE_VAR_CLASS_NAME}}Css,
31
+ template: {{INIT_PACKAGE_VAR_CLASS_NAME}}Template,
32
+ })
33
+ class {{INIT_PACKAGE_VAR_CLASS_NAME}} extends UI5Element {
34
+ @i18n("{{INIT_PACKAGE_VAR_NAME}}")
35
+ static i18nBundle: I18nBundle;
36
+
37
+ /**
38
+ * Defines the component count.
39
+ * @default 0
40
+ * @public
41
+ */
42
+ @property({ type: Number })
43
+ count = 0;
44
+
45
+ onClick() {
46
+ this.count++;
47
+ }
48
+
49
+ get counterText() {
50
+ return {{INIT_PACKAGE_VAR_CLASS_NAME}}.i18nBundle.getText(COUNT);
51
+ }
52
+ }
53
+
54
+ {{INIT_PACKAGE_VAR_CLASS_NAME}}.define();
55
+
56
+ export default {{INIT_PACKAGE_VAR_CLASS_NAME}};
@@ -0,0 +1,9 @@
1
+ import type {{INIT_PACKAGE_VAR_CLASS_NAME}} from "./{{INIT_PACKAGE_VAR_CLASS_NAME}}.js";
2
+
3
+ export default function {{INIT_PACKAGE_VAR_CLASS_NAME}}Template(this: {{INIT_PACKAGE_VAR_CLASS_NAME}}) {
4
+ return (
5
+ <div class="root" onClick={this.onClick}>
6
+ {this.counterText} :: {this.count}
7
+ </div>
8
+ );
9
+ }
@@ -6,15 +6,15 @@ import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
6
6
  import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
7
7
  import { getTheme, setTheme } from "@ui5/webcomponents-base/dist/config/Theme.js";
8
8
  import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/config/NoConflict.js";
9
- import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
10
9
  import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
11
10
 
12
11
  // Enable additional themes and i18n texts
13
- import "./dist/Assets.js";
12
+ import "./Assets.js";
14
13
 
15
- // Import your web components here from the dist/ directory
16
- import "./dist/INIT_PACKAGE_VAR_CLASS_NAME.js";
14
+ // Import your web components here from the src/ directory
15
+ import "./{{INIT_PACKAGE_VAR_CLASS_NAME}}.js";
17
16
 
17
+ // @ts-expect-error
18
18
  window["sap-ui-webcomponents-bundle"] = {
19
19
  renderFinished,
20
20
  configuration: {
@@ -25,7 +25,6 @@ window["sap-ui-webcomponents-bundle"] = {
25
25
  getNoConflict,
26
26
  setNoConflict,
27
27
  getCalendarType,
28
- getRTL,
29
28
  getFirstDayOfWeek,
30
29
  },
31
30
  };