@ui5/create-webcomponents-package 0.0.0-820a5a869 → 0.0.0-896d5863e

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/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,9 @@ Usage:
17
15
  npm init @ui5/webcomponents-package -- [OPTIONS]
18
16
 
19
17
  Options:
20
- --name <string> - defines the package name
21
- --component-name <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
+ --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
25
21
  ```
26
22
 
27
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
@@ -33,11 +29,9 @@ components package.
33
29
  Usage:
34
30
  yarn create @ui5/webcomponents-package [OPTIONS]
35
31
  Options:
36
- --name <string> - defines the package name
37
- --component-name <string> - defines the component class name that will be created in your new package
38
- --tag <string> - defines the tag name of the sample web component that will be created in your new package
39
- --enable-typescript - enables TypeScript support for the package
40
- --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
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
41
35
  ```
42
36
 
43
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
@@ -46,10 +40,10 @@ components package.
46
40
  ## Resources
47
41
  - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
48
42
  - [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
49
- - [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/)
50
44
 
51
45
  ## Support
52
- 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/).
53
47
 
54
48
  ## Contribute
55
49
  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,219 +1,216 @@
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 { 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);
11
13
  const argv = yargs(hideBin(process.argv)).argv;
12
-
13
- const version = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"))).version; // f.e. 1.15.3
14
- const versionParts = version.split(".") // f.e. 1, 15, 3
15
- const effVersion = `^${versionParts[0]}.${versionParts[1]}.0` // f.e. ^1.15.0
16
-
17
- // from where all the files will be copied
18
- const TEMPLATE_DIR = path.join(`${__dirname}`, `template/`);
19
-
20
- // String utils
21
- const isTSRelatedFile = sourcePath => {
22
- return ["Assets.ts", "MyFirstComponent.ts", "tsconfig.json", "global.d.ts"].some(fileName => sourcePath.includes(fileName));
23
- };
24
- const isJSRelatedFile = sourcePath => {
25
- return ["Assets.js", "MyFirstComponent.js"].some(fileName => sourcePath.includes(fileName));
26
- };
27
- const isGitIgnore = sourcePath => {
28
- return sourcePath.includes("gitignore");
29
- };
30
- const isLogo = sourcePath => {
31
- return sourcePath.includes("logo");
32
- };
33
- const isNPMRC = sourcePath => {
34
- return sourcePath.includes("npmrc");
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
+ [path.normalize("eslintignore")]: path.normalize(".eslintignore"),
25
+ [path.normalize("eslintrc.cjs")]: path.normalize(".eslintrc.cjs"),
26
+ [path.normalize("npsrc.json")]: path.normalize(".npsrc.json"),
27
+ [path.normalize("npmrc")]: path.normalize(".npmrc"),
28
+ [path.normalize("env")]: path.normalize(".env"),
29
+ [path.normalize("gitignore")]: path.normalize(".gitignore"),
30
+ [path.normalize("tsconfig.template.json")]: path.normalize("tsconfig.json"),
31
+ [path.normalize("cypress/tsconfig.template.json")]: path.normalize("cypress/tsconfig.json")
35
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
+ }
36
58
 
37
- // Validation of user input
38
- const ComponentNamePattern = /^[A-Z][A-Za-z0-9]+$/;
39
- const NamespacePattern = /^[a-z][a-z0-9\.\-]+$/;
40
- const isPackageNameValid = name => typeof name === "string" && name.match(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/);
41
- const isComponentNameValid = name => typeof name === "string" && ComponentNamePattern.test(name);
42
- const isNamespaceValid = name => typeof name === "string" && NamespacePattern.test(name);
43
- const isTagValid = tag => typeof tag === "string" && tag.match(/^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/);
59
+ return fileList;
60
+ }
44
61
 
45
62
  /**
46
63
  * Hyphanates the given PascalCase string, f.e.:
47
64
  * Foo -> "my-foo" (adds preffix)
48
65
  * FooBar -> "foo-bar"
49
66
  */
50
- const hyphaneteComponentName = (componentName) => {
51
- const result = componentName.replace(/([a-z])([A-Z])/g, '$1-$2' ).toLowerCase();
52
-
67
+ const hyphenateComponentName = componentName => {
68
+ const result = componentName
69
+ .replace(/([a-z])([A-Z])/g, "$1-$2")
70
+ .toLowerCase();
53
71
  return result.includes("-") ? result : `my-${result}`;
54
72
  };
55
73
 
56
- // Utils for building the file structure
57
- const replaceVarsInFileContent = (vars, content) => {
58
- for (let key in vars) {
59
- const re = new RegExp(key, "g");
60
- content = content.replace(re, vars[key]);
61
- }
62
- return content;
63
- };
64
-
65
- const replaceVarsInFileName = (vars, fileName) => {
66
- return fileName.replace(/MyFirstComponent/, vars.INIT_PACKAGE_VAR_CLASS_NAME);
67
- };
74
+ const replacePlaceholders = (content, replacements) =>
75
+ content.replace(/{{(.*?)}}/g, (_, key) => replacements[key.trim()] || "");
68
76
 
69
- const copyFile = (vars, sourcePath, destPath) => {
70
- const ignoreJsRelated = vars.INIT_PACKAGE_VAR_TYPESCRIPT && isJSRelatedFile(sourcePath);
71
- const ignoreTsRelated = !vars.INIT_PACKAGE_VAR_TYPESCRIPT && isTSRelatedFile(sourcePath);
72
-
73
- if (ignoreJsRelated || ignoreTsRelated) {
74
- return;
75
- }
76
-
77
- if (isLogo(sourcePath)) {
78
- fs.copyFileSync(sourcePath, destPath);
79
- return;
80
- }
81
-
82
- let content = fs.readFileSync(sourcePath, { encoding: "UTF-8" });
83
- content = replaceVarsInFileContent(vars, content);
84
- destPath = replaceVarsInFileName(vars, destPath);
85
-
86
- fs.writeFileSync(destPath, content);
87
-
88
- // Rename "gitignore" to ".gitignore" (npm init won't include ".gitignore", so we add it as "gitignore" and rename it later)
89
- if (isGitIgnore(sourcePath)) {
90
- fs.renameSync(destPath, destPath.replace("gitignore", ".gitignore"))
91
- }
92
-
93
- // Rename "npmrc" to ".npmrc" (npm init won't include ".npmrc", so we add it as "npmrc" and rename it later)
94
- if (isNPMRC(sourcePath)) {
95
- fs.renameSync(destPath, destPath.replace("npmrc", ".npmrc"));
96
- }
97
- };
98
-
99
- const copyFiles = (vars, sourcePath, destPath) => {
100
- const isDir = fs.lstatSync(sourcePath).isDirectory();
101
- if (isDir) {
102
- if (destPath) {
103
- mkdirp.sync(destPath);
104
- }
105
- fs.readdirSync(sourcePath).forEach(file => {
106
- copyFiles(vars, path.join(sourcePath, file), path.join(destPath, file));
107
- });
108
- } else {
109
- copyFile(vars, sourcePath, destPath);
110
- }
111
- };
112
-
113
- const generateFilesContent = (packageName, componentName, namespace, typescript, skipSubfolder) => {
114
- const tagName = argv.tag || hyphaneteComponentName(componentName);
115
-
116
- // All variables that will be replaced in the content of the resources/
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/
117
84
  const vars = {
118
- INIT_PACKAGE_VAR_NAMESPACE: namespace, // namespace must be replaced before name
119
85
  INIT_PACKAGE_VAR_NAME: packageName,
120
- INIT_PACKAGE_VAR_TAG: tagName,
86
+ INIT_PACKAGE_VERSION: VERSION,
87
+ INIT_PACKAGE_VAR_TAG: argv.tag || hyphenateComponentName(componentName),
121
88
  INIT_PACKAGE_VAR_CLASS_NAME: componentName,
122
- INIT_PACKAGE_VAR_TYPESCRIPT: typescript,
123
- };
124
-
125
- const packageContent = {
126
- name: packageName,
127
- version: "0.0.1",
128
- ui5: {
129
- webComponentsPackage: true,
130
- },
131
- scripts: {
132
- "clean": "wc-dev clean",
133
- "lint": "wc-dev lint",
134
- "start": "wc-dev start",
135
- "watch": "wc-dev watch",
136
- "build": "wc-dev build",
137
- "test": "wc-dev test",
138
- "create-ui5-element": "wc-create-ui5-element",
139
- "prepublishOnly": "npm run build",
140
- },
141
- exports: {
142
- "./src/*": "./src/*",
143
- "./dist/*": "./dist/*",
144
- "./package.json": "./package.json",
145
- "./bundle.js": "./bundle.js",
146
- "./*": "./dist/*",
147
- },
148
- "dependencies": {
149
- "@ui5/webcomponents-base": effVersion,
150
- "@ui5/webcomponents-theming": effVersion,
151
- },
152
- "devDependencies": {
153
- "@ui5/webcomponents-tools": effVersion,
154
- "chromedriver": "*",
155
- },
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.*` : "",
156
103
  };
157
104
 
158
- if (typescript) {
159
- packageContent.devDependencies.typescript = "^4.9.4";
160
- }
161
-
162
- // Update package.json
163
- let destDir = packageName.includes("@") ? packageName.slice(packageName.lastIndexOf("/") + 1) : packageName;
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);
164
111
 
165
- destDir = skipSubfolder ? path.join("./") : path.join("./", destDir);
166
- mkdirp.sync(destDir);
167
- fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));
168
- // Copy files
169
- copyFiles(vars, TEMPLATE_DIR, destDir);
112
+ await processFiles(destDir, vars, testSetup);
170
113
 
171
114
  console.log("\nPackage successfully created!\nNext steps:\n");
172
- console.log(`$ cd ${destDir}`);
115
+ console.log(`$ cd ${packageBaseName}`);
173
116
 
174
- let userAgentInfo;
175
117
  try {
176
- userAgentInfo = parser(process.env.npm_config_user_agent);
177
- } catch (e) {}
178
-
179
- if (userAgentInfo && userAgentInfo.yarn) {
180
- console.log(`$ yarn`);
181
- console.log(`$ yarn start`);
182
- } else {
183
- console.log(`$ npm i`);
184
- console.log(`$ npm start`);
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`);
185
124
  }
186
125
 
187
126
  console.log("\n");
188
127
  };
189
128
 
190
- // Main function
191
- const createWebcomponentsPackage = async () => {
192
- let response;
193
- if (argv.name && !isPackageNameValid(argv.name)) {
194
- throw new Error("The package name should be a string, starting with letter and containing the following symbols [a-z, A-Z, 0-9].");
195
- }
129
+ async function processFiles(destDir, replacements, testSetup) {
130
+ const files = await collectFiles(SRC_DIR);
131
+ const FILE_PATHS_TO_SKIP = [
132
+ testSetup !== "cypress" ? path.normalize("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
+ }
196
183
 
197
- if (argv.componentName && !isComponentNameValid(argv.componentName)) {
198
- throw new Error("The component name should be a string, starting with a capital letter [A-Z][a-z], for example: Button, MyButton, etc.");
184
+ // console.log(`Processed: ${file} -> ${destPath}`);
199
185
  }
186
+ }
200
187
 
201
- if (argv.namespace && !isNamespaceValid(argv.namespace)) {
202
- throw new Error("The JSDoc namespace must start with a letter and can only contain small-case letters, numbers, dots and dashes.");
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
+ );
203
194
  }
204
195
 
205
- if (argv.tag && !isTagValid(argv.tag) ) {
206
- throw new Error("The tag should be in kebab-case (f.e my-component) and it can't be a single word.");
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
+ );
207
200
  }
208
201
 
209
202
  let packageName = argv.name || "my-package";
210
- let componentName = argv.componentName || "MyComponent";
211
- let namespace = argv.namespace || "demo.components";
212
- let typescriptSupport = !!argv.enableTypescript;
203
+ let componentName = "MyFirstComponent";
204
+ let testSetup = argv.testSetup || "manual";
213
205
  const skipSubfolder = !!argv.skipSubfolder;
214
206
 
215
207
  if (argv.skip) {
216
- return generateFilesContent(packageName, componentName, namespace, typescriptSupport, skipSubfolder);
208
+ return generateFilesContent(
209
+ packageName,
210
+ componentName,
211
+ skipSubfolder,
212
+ testSetup,
213
+ );
217
214
  }
218
215
 
219
216
  if (!argv.name) {
@@ -221,53 +218,35 @@ const createWebcomponentsPackage = async () => {
221
218
  type: "text",
222
219
  name: "name",
223
220
  message: "Package name:",
224
- 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, _, -].",
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
225
  });
226
226
  packageName = response.name;
227
227
  }
228
228
 
229
- if (!typescriptSupport) {
229
+ if (!argv.testSetup) {
230
230
  response = await prompts({
231
231
  type: "select",
232
- name: "language",
233
- message: "Project type:",
232
+ name: "testSetup",
233
+ message: "How would you like to set up testing?",
234
234
  choices: [
235
- {
236
- title: "JavaScript",
237
- value: false,
238
- },
239
- {
240
- title: "TypeScript",
241
- value: true,
242
- },
235
+ { title: "Cypress", value: "cypress" },
236
+ { title: "I'll set it up manually", value: "manual" },
243
237
  ],
238
+ initial: 0,
244
239
  });
245
- typescriptSupport = response.language;
246
- }
247
240
 
248
- if (!argv.componentName) {
249
- response = await prompts({
250
- type: "text",
251
- name: "componentName",
252
- message: "Component name:",
253
- initial: "MyComponent",
254
- validate: (value) => isComponentNameValid(value) ? true : "Component name should follow PascalCase naming convention (f.e. Button, MyButton, etc.).",
255
- });
256
- componentName = response.componentName;
257
- }
258
-
259
- if (!argv.namespace) {
260
- response = await prompts({
261
- type: "text",
262
- name: "namespace",
263
- message: "JSDoc namespace:",
264
- initial: "demo.components",
265
- validate: (value) => isNamespaceValid(value) ? true : "The JSDoc namespace must start with a letter and can only contain small-case letters, numbers, dots and dashes.",
266
- });
267
- namespace = response.namespace;
241
+ testSetup = response.testSetup;
268
242
  }
269
243
 
270
- return generateFilesContent(packageName, componentName, namespace, typescriptSupport, skipSubfolder);
244
+ return generateFilesContent(
245
+ packageName,
246
+ componentName,
247
+ skipSubfolder,
248
+ testSetup,
249
+ );
271
250
  };
272
251
 
273
252
  createWebcomponentsPackage();
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@ui5/create-webcomponents-package",
3
- "version": "0.0.0-820a5a869",
3
+ "version": "0.0.0-896d5863e",
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",
@@ -21,6 +22,7 @@
21
22
  "dependencies": {
22
23
  "mkdirp": "^1.0.4",
23
24
  "npm-config-user-agent-parser": "^1.0.0",
25
+ "prettier": "^3.5.3",
24
26
  "prompts": "^2.4.1",
25
27
  "yargs": "^17.5.1"
26
28
  }
@@ -0,0 +1,3 @@
1
+ {
2
+ "config": "./package-scripts.cjs"
3
+ }
@@ -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"
@@ -1,4 +1,4 @@
1
1
  node_modules
2
2
  dist
3
- jsdoc-dist
4
- src/generated
3
+ src/generated
4
+ .dev-server-port
@@ -2,7 +2,6 @@ const getScripts = require("@ui5/webcomponents-tools/components-package/nps.js")
2
2
 
3
3
  const options = {
4
4
  port: 8080,
5
- typescript: INIT_PACKAGE_VAR_TYPESCRIPT,
6
5
  };
7
6
 
8
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";