@ui5/create-webcomponents-package 0.0.0-6298a142d → 0.0.0-6827fdc09

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 (43) hide show
  1. package/CHANGELOG.md +1277 -0
  2. package/README.md +13 -14
  3. package/create-package.js +152 -211
  4. package/package.json +4 -1
  5. package/template/.eslintignore +3 -2
  6. package/template/.npsrc.json +3 -0
  7. package/template/cypress/component/DemoCounter.tsx +13 -0
  8. package/template/cypress/fixtures/example.json +5 -0
  9. package/template/cypress/support/commands.ts +37 -0
  10. package/template/cypress/support/component-index.html +12 -0
  11. package/template/cypress/support/component.ts +36 -0
  12. package/template/cypress/tsconfig.json +19 -0
  13. package/template/cypress.config.ts +10 -0
  14. package/template/gitignore +2 -2
  15. package/template/{package-scripts.js → package-scripts.cjs} +0 -1
  16. package/template/package.json +35 -0
  17. package/template/src/Assets.ts +1 -1
  18. package/template/src/DemoCounter.ts +56 -0
  19. package/template/src/DemoCounterTemplate.tsx +9 -0
  20. package/template/src/bundle.esm.ts +7 -0
  21. package/template/src/i18n/messagebundle.properties +1 -1
  22. package/template/src/i18n/messagebundle_de.properties +1 -1
  23. package/template/src/i18n/messagebundle_en.properties +1 -1
  24. package/template/src/i18n/messagebundle_es.properties +1 -1
  25. package/template/src/i18n/messagebundle_fr.properties +1 -1
  26. package/template/src/themes/{MyFirstComponent.css → DemoCounter.css} +6 -1
  27. package/template/test/pages/css/index.css +64 -13
  28. package/template/test/pages/img/logo.png +0 -0
  29. package/template/test/pages/index.html +35 -39
  30. package/template/tsconfig.json +13 -14
  31. package/template/vite.config.js +14 -0
  32. package/template/bundle.esm.js +0 -31
  33. package/template/config/postcss.components/postcss.config.js +0 -1
  34. package/template/config/postcss.themes/postcss.config.js +0 -1
  35. package/template/config/vite.config.js +0 -4
  36. package/template/config/wdio.conf.js +0 -1
  37. package/template/src/Assets.js +0 -5
  38. package/template/src/MyFirstComponent.hbs +0 -1
  39. package/template/src/MyFirstComponent.js +0 -80
  40. package/template/src/MyFirstComponent.ts +0 -62
  41. package/template/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  42. package/template/test/specs/Demo.spec.js +0 -13
  43. /package/template/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/README.md CHANGED
@@ -1,6 +1,4 @@
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
 
@@ -17,11 +15,11 @@ Usage:
17
15
  npm init @ui5/webcomponents-package -- [OPTIONS]
18
16
 
19
17
  Options:
20
- --name <string> - defines the package name
21
- --componentName <string> - defines the component class name that will be created in your new package
22
- --tag <string> - defines the tag name of the sample web component that will be created in your new package. The tag will be derived from the component name if not provided.
23
- --enable-typescript - enables TypeScript support for the package
24
- --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
18
+ --name <string> - defines the package name
19
+ --component-name <string> - defines the component class name that will be created in your new package
20
+ --tag <string> - defines the tag name of the sample web component that will be created in your new package
21
+ --test-setup <"cypress" | "manual"> - defines whether the predefined test setup should be added or it will be configured manually.
22
+ --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
25
23
  ```
26
24
 
27
25
  The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
@@ -33,10 +31,11 @@ components package.
33
31
  Usage:
34
32
  yarn create @ui5/webcomponents-package [OPTIONS]
35
33
  Options:
36
- --name <string> - defines the package name
37
- --tag <string> - defines the tag name of the sample web component that will be created in your new package
38
- --enable-typescript - enables TypeScript support for the package
39
- --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
34
+ --name <string> - defines the package name
35
+ --component-name <string> - defines the component class name that will be created in your new package
36
+ --tag <string> - defines the tag name of the sample web component that will be created in your new package
37
+ --test-setup <"cypress" | "manual"> - defines whether the predefined test setup should be added or it will be configured manually.
38
+ --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
40
39
  ```
41
40
 
42
41
  The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
@@ -45,10 +44,10 @@ components package.
45
44
  ## Resources
46
45
  - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
47
46
  - [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
48
- - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
47
+ - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/play/)
49
48
 
50
49
  ## Support
51
- 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/).
50
+ 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/).
52
51
 
53
52
  ## Contribute
54
53
  Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
package/create-package.js CHANGED
@@ -1,209 +1,169 @@
1
1
  #!/usr/bin/env node
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const mkdirp = require("mkdirp");
6
- const prompts = require("prompts");
7
- const parser = require("npm-config-user-agent-parser");
8
- const yargs = require("yargs/yargs");
9
- const { hideBin } = require("yargs/helpers");
10
-
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 { globby } from "globby";
8
+ import { hideBin } from "yargs/helpers";
9
+ import { fileURLToPath } from "url";
10
+ import * as prettier from "prettier";
11
+
12
+ const __filename = fileURLToPath(import.meta.url);
13
+ const __dirname = dirname(__filename);
11
14
  const argv = yargs(hideBin(process.argv)).argv;
12
-
13
- const version = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"))).version;
14
-
15
- // from where all the files will be copied
16
- const TEMPLATE_DIR = path.join(`${__dirname}`, `template/`);
17
-
18
- // String utils
19
- const isTSRelatedFile = sourcePath => {
20
- return ["Assets.ts", "MyFirstComponent.ts", "tsconfig.json", "global.d.ts"].some(fileName => sourcePath.includes(fileName));
21
- };
22
- const isJSRelatedFile = sourcePath => {
23
- return ["Assets.js", "MyFirstComponent.js"].some(fileName => sourcePath.includes(fileName));
24
- };
25
- const isGitIgnore = sourcePath => {
26
- return sourcePath.includes("gitignore");
27
- };
28
- const isNPMRC = sourcePath => {
29
- return sourcePath.includes("npmrc");
15
+ const VERSION = JSON.parse(
16
+ await fs.readFile(path.join(__dirname, "package.json")),
17
+ ).version;
18
+
19
+ // Constants
20
+ const SUPPORTED_TEST_SETUPS = ["cypress", "manual"];
21
+ const SRC_DIR = "template";
22
+ const FILES_TO_RENAME = {
23
+ "npmrc": ".npmrc",
24
+ "gitignore": ".gitignore",
30
25
  };
26
+ const FILES_TO_COPY = ["test/pages/img/logo.png"];
27
+
28
+ // Validation Patterns
29
+ const PackageNamePattern =
30
+ /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
31
+
32
+ // Utility Functions
33
+ const isPackageNameValid = name =>
34
+ typeof name === "string" && PackageNamePattern.test(name);
35
+ const isTestSetupValid = setup =>
36
+ typeof setup === "string" && SUPPORTED_TEST_SETUPS.includes(setup);
37
+
38
+ const replacePlaceholders = (content, replacements) =>
39
+ content.replace(/{{(.*?)}}/g, (_, key) => replacements[key.trim()] || "");
40
+
41
+ const generateFilesContent = async (
42
+ packageName,
43
+ skipSubfolder,
44
+ testSetup,
45
+ ) => {
46
+ // All variables that will be replaced in the content of the template folder/
47
+ const vars = {
48
+ INIT_PACKAGE_VAR_NAME: packageName,
49
+ INIT_PACKAGE_VERSION: VERSION,
50
+ INIT_PACKAGE_CYPRESS_ROOT_TSCONFIG:
51
+ testSetup === "cypress"
52
+ ? `"tsBuildInfoFile": "dist/.tsbuildinfo",\n"rootDir": "src",\n"composite": true,`
53
+ : "",
54
+ INIT_PACKAGE_CYPRESS_DEV_DEPS:
55
+ testSetup === "cypress"
56
+ ? `"@ui5/cypress-ct-ui5-webc": "^0.0.3",\n"cypress": "^13.11.0",`
57
+ : "",
58
+ INIT_PACKAGE_CYPRESS_TEST_COMMANDS:
59
+ testSetup === "cypress"
60
+ ? `"test": "cypress run --component --browser chrome",\n"test:open": "cypress open --component --browser chrome",`
61
+ : "",
62
+ INIT_PACKAGE_CYPRESS_ESLINT_IGNORES:
63
+ testSetup === "cypress" ? `cypress/*\ncypress.config.*` : "",
64
+ };
31
65
 
32
- // Validation of user input
33
- const ComponentNamePattern = /^[A-Z][A-Za-z0-9]+$/;
34
- const NamespacePattern = /^[a-z][a-z0-9\.\-]+$/;
35
- const isPackageNameValid = name => typeof name === "string" && name.match(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/);
36
- const isComponentNameValid = name => typeof name === "string" && ComponentNamePattern.test(name);
37
- const isNamespaceValid = name => typeof name === "string" && NamespacePattern.test(name);
38
- const isTagValid = tag => typeof tag === "string" && tag.match(/^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/);
66
+ const packageBaseName = packageName.includes("@")
67
+ ? packageName.slice(packageName.lastIndexOf("/") + 1)
68
+ : packageName;
69
+ const destDir = skipSubfolder
70
+ ? path.join("./")
71
+ : path.join("./", packageBaseName);
39
72
 
40
- /**
41
- * Hyphanates the given PascalCase string, f.e.:
42
- * Foo -> "my-foo" (adds preffix)
43
- * FooBar -> "foo-bar"
44
- */
45
- const hyphaneteComponentName = (componentName) => {
46
- const result = componentName.replace(/([a-z])([A-Z])/g, '$1-$2' ).toLowerCase();
73
+ await processFiles(destDir, vars, testSetup);
47
74
 
48
- return result.includes("-") ? result : `my-${result}`;
49
- };
75
+ console.log("\nPackage successfully created!\nNext steps:\n");
76
+ console.log(`$ cd ${destDir}`);
50
77
 
51
- // Utils for building the file structure
52
- const replaceVarsInFileContent = (vars, content) => {
53
- for (let key in vars) {
54
- const re = new RegExp(key, "g");
55
- content = content.replace(re, vars[key]);
78
+ try {
79
+ const userAgent = parser(process.env.npm_config_user_agent);
80
+ userAgent.yarn
81
+ ? console.log(`$ yarn\n$ yarn start`)
82
+ : console.log(`$ npm i\n$ npm start`);
83
+ } catch {
84
+ console.log(`$ npm i\n$ npm start`);
56
85
  }
57
- return content;
58
- };
59
86
 
60
- const replaceVarsInFileName = (vars, fileName) => {
61
- return fileName.replace(/MyFirstComponent/, vars.INIT_PACKAGE_VAR_CLASS_NAME);
87
+ console.log("\n");
62
88
  };
63
89
 
64
- const copyFile = (vars, sourcePath, destPath) => {
65
- const ignoreJsRelated = vars.INIT_PACKAGE_VAR_TYPESCRIPT && isJSRelatedFile(sourcePath);
66
- const ignoreTsRelated = !vars.INIT_PACKAGE_VAR_TYPESCRIPT && isTSRelatedFile(sourcePath);
67
-
68
- if (ignoreJsRelated || ignoreTsRelated) {
69
- return;
70
- }
71
-
72
- let content = fs.readFileSync(sourcePath, { encoding: "UTF-8" });
73
- content = replaceVarsInFileContent(vars, content);
74
- destPath = replaceVarsInFileName(vars, destPath);
75
-
76
- fs.writeFileSync(destPath, content);
90
+ async function processFiles(destDir, replacements, testSetup) {
91
+ const files = await globby(`${SRC_DIR}/**/*`, { dot: true });
92
+ const FILE_PATHS_TO_SKIP = [
93
+ testSetup !== "cypress" ? "cypress" : undefined,
94
+ ].filter(Boolean);
77
95
 
78
- // Rename "gitignore" to ".gitignore" (npm init won't include ".gitignore", so we add it as "gitignore" and rename it later)
79
- if (isGitIgnore(sourcePath)) {
80
- fs.renameSync(destPath, destPath.replace("gitignore", ".gitignore"))
81
- }
96
+ for (const file of files) {
97
+ const relativePath = path.relative(SRC_DIR, file);
98
+ let destPath = path.join(destDir, relativePath);
82
99
 
83
- // Rename "npmrc" to ".npmrc" (npm init won't include ".npmrc", so we add it as "npmrc" and rename it later)
84
- if (isNPMRC(sourcePath)) {
85
- fs.renameSync(destPath, destPath.replace("npmrc", ".npmrc"));
86
- }
87
- };
88
-
89
- const copyFiles = (vars, sourcePath, destPath) => {
90
- const isDir = fs.lstatSync(sourcePath).isDirectory();
91
- if (isDir) {
92
- if (destPath) {
93
- mkdirp.sync(destPath);
100
+ if (FILE_PATHS_TO_SKIP.some(filePath => file.includes(filePath))) {
101
+ // console.log(`Skipped: ${file} -> ${destPath}`);
102
+ continue;
94
103
  }
95
- fs.readdirSync(sourcePath).forEach(file => {
96
- copyFiles(vars, path.join(sourcePath, file), path.join(destPath, file));
97
- });
98
- } else {
99
- copyFile(vars, sourcePath, destPath);
100
- }
101
- };
102
-
103
- const generateFilesContent = (packageName, componentName, namespace, typescript, skipSubfolder) => {
104
- const tagName = argv.tag || hyphaneteComponentName(componentName);
105
-
106
- // All variables that will be replaced in the content of the resources/
107
- const vars = {
108
- INIT_PACKAGE_VAR_NAMESPACE: namespace, // namespace must be replaced before name
109
- INIT_PACKAGE_VAR_NAME: packageName,
110
- INIT_PACKAGE_VAR_TAG: tagName,
111
- INIT_PACKAGE_VAR_CLASS_NAME: componentName,
112
- INIT_PACKAGE_VAR_TYPESCRIPT: typescript,
113
- };
114
-
115
- const packageContent = {
116
- name: packageName,
117
- version: "0.0.1",
118
- ui5: {
119
- webComponentsPackage: true,
120
- },
121
- scripts: {
122
- "clean": "wc-dev clean",
123
- "lint": "wc-dev lint",
124
- "start": "wc-dev start",
125
- "watch": "wc-dev watch",
126
- "build": "wc-dev build",
127
- "test": "wc-dev test",
128
- "create-ui5-element": "wc-create-ui5-element",
129
- "prepublishOnly": "npm run build",
130
- },
131
- exports: {
132
- "./src/*": "./src/*",
133
- "./dist/*": "./dist/*",
134
- "./package.json": "./package.json",
135
- "./bundle.js": "./bundle.js",
136
- "./*": "./dist/*",
137
- },
138
- "dependencies": {
139
- "@ui5/webcomponents-base": version,
140
- "@ui5/webcomponents-theming": version,
141
- },
142
- "devDependencies": {
143
- "@ui5/webcomponents-tools": version,
144
- "chromedriver": "*",
145
- },
146
- };
147
-
148
- if (typescript) {
149
- packageContent.devDependencies.typescript = "^4.9.4";
150
- }
151
-
152
- // Update package.json
153
- let destDir = packageName.includes("@") ? packageName.slice(packageName.lastIndexOf("/") + 1) : packageName;
154
104
 
155
- destDir = skipSubfolder ? path.join("./") : path.join("./", destDir);
156
- mkdirp.sync(destDir);
157
- fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));
158
- // Copy files
159
- copyFiles(vars, TEMPLATE_DIR, destDir);
160
-
161
- console.log("\nPackage successfully created!\nNext steps:\n");
162
- console.log(`$ cd ${destDir}`);
105
+ // Files that need to be renamed
106
+ if (FILES_TO_RENAME[relativePath]) {
107
+ destPath = destPath.replace(
108
+ relativePath,
109
+ FILES_TO_RENAME[relativePath],
110
+ );
111
+ }
163
112
 
164
- let userAgentInfo;
165
- try {
166
- userAgentInfo = parser(process.env.npm_config_user_agent);
167
- } catch (e) {}
113
+ await fs.mkdir(path.dirname(destPath), { recursive: true });
114
+
115
+ if (FILES_TO_COPY.includes(relativePath)) {
116
+ // Image like files that doesn't need proccessing
117
+ await fs.copyFile(file, destPath);
118
+ } else {
119
+ const content = await fs.readFile(file, { encoding: "utf8" });
120
+ const replaced = replacePlaceholders(content, replacements);
121
+ let formatted;
122
+ try {
123
+ formatted = await prettier.format(replaced, {
124
+ useTabs: true,
125
+ tabWidth: 4,
126
+ quoteProps: "consistent",
127
+ arrowParens: "avoid",
128
+ filepath: file,
129
+ });
130
+ // console.log(`Formatted: ${file} -> ${destPath}`);
131
+ } catch {
132
+ // console.log(`Not formatted: ${file} -> ${destPath}`);
133
+ formatted = replaced;
134
+ }
135
+
136
+ await fs.writeFile(destPath, formatted);
137
+ }
168
138
 
169
- if (userAgentInfo && userAgentInfo.yarn) {
170
- console.log(`$ yarn`);
171
- console.log(`$ yarn start`);
172
- } else {
173
- console.log(`$ npm i`);
174
- console.log(`$ npm start`);
139
+ // console.log(`Processed: ${file} -> ${destPath}`);
175
140
  }
141
+ }
176
142
 
177
- console.log("\n");
178
- };
179
-
180
- // Main function
181
143
  const createWebcomponentsPackage = async () => {
182
144
  let response;
183
145
  if (argv.name && !isPackageNameValid(argv.name)) {
184
- throw new Error("The package name should be a string, starting with letter and containing the following symbols [a-z, A-Z, 0-9].");
185
- }
186
-
187
- if (argv.componentName && !isComponentNameValid(argv.componentName)) {
188
- throw new Error("The component name should be a string, starting with a capital letter [A-Z][a-z], for example: Button, MyButton, etc.");
146
+ throw new Error(
147
+ "The package name should be a string, starting with letter and containing the following symbols [a-z, A-Z, 0-9].",
148
+ );
189
149
  }
190
150
 
191
- if (argv.namespace && !isNamespaceValid(argv.namespace)) {
192
- throw new Error("The JSDoc namespace must start with a letter and can only contain small-case letters, numbers, dots and dashes.");
193
- }
194
-
195
- if (argv.tag && !isTagValid(argv.tag) ) {
196
- throw new Error("The tag should be in kebab-case (f.e my-component) and it can't be a single word.");
151
+ if (argv.testSetup && !isTestSetupValid(argv.testSetup)) {
152
+ throw new Error(
153
+ `The test setup should be a string and one of the following options: ${SUPPORTED_TEST_SETUPS.join(", ")}`,
154
+ );
197
155
  }
198
156
 
199
157
  let packageName = argv.name || "my-package";
200
- let componentName = argv.componentName || "MyComponent";
201
- let namespace = argv.namespace || "demo.components";
202
- let typescriptSupport = !!argv.enableTypescript;
158
+ let testSetup = argv.testSetup || "manual";
203
159
  const skipSubfolder = !!argv.skipSubfolder;
204
160
 
205
161
  if (argv.skip) {
206
- return generateFilesContent(packageName, componentName, namespace, typescriptSupport, skipSubfolder);
162
+ return generateFilesContent(
163
+ packageName,
164
+ skipSubfolder,
165
+ testSetup,
166
+ );
207
167
  }
208
168
 
209
169
  if (!argv.name) {
@@ -211,53 +171,34 @@ const createWebcomponentsPackage = async () => {
211
171
  type: "text",
212
172
  name: "name",
213
173
  message: "Package name:",
214
- validate: (value) => isPackageNameValid(value) ? true : "Package name should be a string, starting with a letter and containing the following symbols [a-z, A-Z ,0-9, _, -].",
174
+ validate: value =>
175
+ isPackageNameValid(value)
176
+ ? true
177
+ : "Package name should be a string, starting with a letter and containing the following symbols [a-z, A-Z ,0-9, _, -].",
215
178
  });
216
179
  packageName = response.name;
217
180
  }
218
181
 
219
- if (!typescriptSupport) {
182
+ if (!argv.testSetup) {
220
183
  response = await prompts({
221
184
  type: "select",
222
- name: "language",
223
- message: "Project type:",
185
+ name: "testSetup",
186
+ message: "How would you like to set up testing?",
224
187
  choices: [
225
- {
226
- title: "JavaScript",
227
- value: false,
228
- },
229
- {
230
- title: "TypeScript",
231
- value: true,
232
- },
188
+ { title: "Cypress", value: "cypress" },
189
+ { title: "I'll set it up manually", value: "manual" },
233
190
  ],
191
+ initial: 0,
234
192
  });
235
- typescriptSupport = response.language;
236
- }
237
193
 
238
- if (!argv.componentName) {
239
- response = await prompts({
240
- type: "text",
241
- name: "componentName",
242
- message: "Component name:",
243
- initial: "MyComponent",
244
- validate: (value) => isComponentNameValid(value) ? true : "Component name should follow PascalCase naming convention (f.e. Button, MyButton, etc.).",
245
- });
246
- componentName = response.componentName;
247
- }
248
-
249
- if (!argv.namespace) {
250
- response = await prompts({
251
- type: "text",
252
- name: "namespace",
253
- message: "JSDoc namespace:",
254
- initial: "demo.components",
255
- validate: (value) => isNamespaceValid(value) ? true : "The JSDoc namespace must start with a letter and can only contain small-case letters, numbers, dots and dashes.",
256
- });
257
- namespace = response.namespace;
194
+ testSetup = response.testSetup;
258
195
  }
259
196
 
260
- return generateFilesContent(packageName, componentName, namespace, typescriptSupport, skipSubfolder);
197
+ return generateFilesContent(
198
+ packageName,
199
+ skipSubfolder,
200
+ testSetup,
201
+ );
261
202
  };
262
203
 
263
204
  createWebcomponentsPackage();
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@ui5/create-webcomponents-package",
3
- "version": "0.0.0-6298a142d",
3
+ "version": "0.0.0-6827fdc09",
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",
@@ -19,8 +20,10 @@
19
20
  "directory": "packages/create-package"
20
21
  },
21
22
  "dependencies": {
23
+ "globby": "^13.1.1",
22
24
  "mkdirp": "^1.0.4",
23
25
  "npm-config-user-agent-parser": "^1.0.0",
26
+ "prettier": "^3.5.3",
24
27
  "prompts": "^2.4.1",
25
28
  "yargs": "^17.5.1"
26
29
  }
@@ -2,5 +2,6 @@
2
2
  dist
3
3
  test
4
4
  src/generated
5
- jsdoc-dist
6
- .eslintrc.js
5
+ .eslintrc.cjs
6
+
7
+ {{INIT_PACKAGE_CYPRESS_ESLINT_IGNORES}}
@@ -0,0 +1,3 @@
1
+ {
2
+ "config": "./package-scripts.cjs"
3
+ }
@@ -0,0 +1,13 @@
1
+ import DemoCounter from "../../src/DemoCounter.js";
2
+
3
+ describe('DemoCounter.cy.tsx', () => {
4
+ it('playground', () => {
5
+ cy.mount(<DemoCounter />)
6
+
7
+ cy.get("[hardcoded-button]")
8
+ .click();
9
+
10
+ cy.get("[hardcoded-button]")
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
+ });
@@ -1,4 +1,4 @@
1
1
  node_modules
2
2
  dist
3
- jsdoc-dist
4
- src/generated
3
+ src/generated
4
+ .dev-server-port