New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ui5/create-webcomponents-package

Package Overview
Dependencies
Maintainers
0
Versions
344
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ui5/create-webcomponents-package - npm Package Compare versions

Comparing version 0.0.0-2f7664755 to 0.0.0-31ad69296

template/.eslintrc.js

690

CHANGELOG.md

@@ -6,2 +6,692 @@ # Change Log

## [1.24.7](https://github.com/SAP/ui5-webcomponents/compare/v1.24.6...v1.24.7) (2024-07-08)
**Note:** Version bump only for package @ui5/create-webcomponents-package
## [1.24.6](https://github.com/SAP/ui5-webcomponents/compare/v1.24.5...v1.24.6) (2024-07-01)
**Note:** Version bump only for package @ui5/create-webcomponents-package
## [1.24.3](https://github.com/SAP/ui5-webcomponents/compare/v1.24.2...v1.24.3) (2024-05-14)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.24.0](https://github.com/SAP/ui5-webcomponents/compare/v1.24.0-rc.4...v1.24.0) (2024-04-04)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.24.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.24.0-rc.3...v1.24.0-rc.4) (2024-04-04)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.24.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.24.0-rc.2...v1.24.0-rc.3) (2024-03-28)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.24.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.24.0-rc.1...v1.24.0-rc.2) (2024-03-21)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.24.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.24.0-rc.0...v1.24.0-rc.1) (2024-03-15)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.24.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.23.1...v1.24.0-rc.0) (2024-03-14)
**Note:** Version bump only for package @ui5/create-webcomponents-package
## [1.23.1](https://github.com/SAP/ui5-webcomponents/compare/v1.23.1-rc.0...v1.23.1) (2024-03-08)
**Note:** Version bump only for package @ui5/create-webcomponents-package
## [1.23.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0...v1.23.1-rc.0) (2024-03-07)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.23.0](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.5...v1.23.0) (2024-03-06)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.23.0-rc.5](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.4...v1.23.0-rc.5) (2024-02-29)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.23.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.3...v1.23.0-rc.4) (2024-02-26)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.23.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.2...v1.23.0-rc.3) (2024-02-22)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.23.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.1...v1.23.0-rc.2) (2024-02-20)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.23.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.0...v1.23.0-rc.1) (2024-02-19)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.23.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.22.1-rc.0...v1.23.0-rc.0) (2024-02-15)
**Note:** Version bump only for package @ui5/create-webcomponents-package
## [1.22.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.22.0...v1.22.1-rc.0) (2024-02-08)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.22.0](https://github.com/SAP/ui5-webcomponents/compare/v1.22.0-rc.3...v1.22.0) (2024-02-05)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.22.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.22.0-rc.2...v1.22.0-rc.3) (2024-02-01)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.22.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.22.0-rc.1...v1.22.0-rc.2) (2024-01-25)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.22.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.22.0-rc.0...v1.22.0-rc.1) (2024-01-18)
### Bug Fixes
* broken test page ([#8097](https://github.com/SAP/ui5-webcomponents/issues/8097)) ([6903367](https://github.com/SAP/ui5-webcomponents/commit/6903367c290b84490c74a6ef56b074aa0a2fc729))
# [1.22.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0...v1.22.0-rc.0) (2024-01-11)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.21.0](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0-rc.5...v1.21.0) (2024-01-05)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.21.0-rc.5](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0-rc.4...v1.21.0-rc.5) (2024-01-04)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.21.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0-rc.3...v1.21.0-rc.4) (2023-12-28)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.21.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0-rc.2...v1.21.0-rc.3) (2023-12-21)
### Features
* **tools:** Optimize build by switching css processing to esbuild ([#8008](https://github.com/SAP/ui5-webcomponents/issues/8008)) ([b4d411f](https://github.com/SAP/ui5-webcomponents/commit/b4d411f00f8d74ccecb2d02254126243faf53dfd))
# [1.21.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0-rc.1...v1.21.0-rc.2) (2023-12-14)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.21.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0-rc.0...v1.21.0-rc.1) (2023-12-08)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.21.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0...v1.21.0-rc.0) (2023-12-07)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.20.0](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.3...v1.20.0) (2023-12-04)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.20.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.2...v1.20.0-rc.3) (2023-11-30)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.20.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.1...v1.20.0-rc.2) (2023-11-23)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.20.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.0...v1.20.0-rc.1) (2023-11-16)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.20.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.19.0...v1.20.0-rc.0) (2023-11-09)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.19.0](https://github.com/SAP/ui5-webcomponents/compare/v1.19.0-rc.3...v1.19.0) (2023-11-02)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.19.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.19.0-rc.2...v1.19.0-rc.3) (2023-11-02)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.19.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.19.0-rc.1...v1.19.0-rc.2) (2023-10-26)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.19.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.19.0-rc.0...v1.19.0-rc.1) (2023-10-19)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.19.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.18.1-rc.0...v1.19.0-rc.0) (2023-10-12)
**Note:** Version bump only for package @ui5/create-webcomponents-package
## [1.18.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.18.0...v1.18.1-rc.0) (2023-10-05)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.18.0](https://github.com/SAP/ui5-webcomponents/compare/v1.18.0-rc.2...v1.18.0) (2023-10-02)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.18.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.18.0-rc.1...v1.18.0-rc.2) (2023-09-28)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.18.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.18.0-rc.0...v1.18.0-rc.1) (2023-09-21)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.18.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0...v1.18.0-rc.0) (2023-09-07)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.17.0](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.2...v1.17.0) (2023-09-01)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.17.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.1...v1.17.0-rc.2) (2023-08-24)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.17.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.0...v1.17.0-rc.1) (2023-08-17)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.17.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0...v1.17.0-rc.0) (2023-08-10)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.16.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.4...v1.16.0) (2023-08-03)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.16.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.3...v1.16.0-rc.4) (2023-08-03)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.16.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.2...v1.16.0-rc.3) (2023-07-27)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.16.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.1...v1.16.0-rc.2) (2023-07-20)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.16.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.0...v1.16.0-rc.1) (2023-07-13)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.16.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.15.1...v1.16.0-rc.0) (2023-07-06)
**Note:** Version bump only for package @ui5/create-webcomponents-package
## [1.15.1](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0...v1.15.1) (2023-06-30)
### Bug Fixes
* **framework:** fix links in starting page of new pkg [ci skip] ([475fed5](https://github.com/SAP/ui5-webcomponents/commit/475fed55504f4a15e8b26aaf3c9e4d73b55976ec))
# [1.15.0](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.2...v1.15.0) (2023-06-30)
### Bug Fixes
* fix image in `create-webcomponent-package` ([#7253](https://github.com/SAP/ui5-webcomponents/issues/7253)) ([3317e64](https://github.com/SAP/ui5-webcomponents/commit/3317e64b911f992abf34b88a48e6003a723f7b9e))
# [1.15.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.1...v1.15.0-rc.2) (2023-06-22)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.15.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.0...v1.15.0-rc.1) (2023-06-15)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.15.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0...v1.15.0-rc.0) (2023-06-08)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.14.0](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.2...v1.14.0) (2023-06-01)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.14.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.1...v1.14.0-rc.2) (2023-06-01)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.14.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.0...v1.14.0-rc.1) (2023-05-25)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.14.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.13.2...v1.14.0-rc.0) (2023-05-18)
### Features
* users can provide a JSDoc namespeace when creating a package ([#7034](https://github.com/SAP/ui5-webcomponents/issues/7034)) ([0af8d23](https://github.com/SAP/ui5-webcomponents/commit/0af8d2376e25e5abe6d940c72286ab7c682eea56))
## [1.13.1](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.5...v1.13.1) (2023-05-11)
### Bug Fixes
* **create-package:** revert `moduleResolution` setting to `node` ([#7020](https://github.com/SAP/ui5-webcomponents/issues/7020)) ([9fc84e2](https://github.com/SAP/ui5-webcomponents/commit/9fc84e288452616ee72f3a2b6fc31d9752f05f6f))
# [1.13.0-rc.5](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.4...v1.13.0-rc.5) (2023-05-11)
### Bug Fixes
* **create-webcomponents-package:** fix package creation issues with test and lint ([#6976](https://github.com/SAP/ui5-webcomponents/issues/6976)) ([dd70f3a](https://github.com/SAP/ui5-webcomponents/commit/dd70f3aa8ef70b592f1d4e0f3f9894c6280fb1bf))
# [1.13.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.3...v1.13.0-rc.4) (2023-05-04)
### Features
* generate TS from HBS templates ([#6558](https://github.com/SAP/ui5-webcomponents/issues/6558)) ([02611b2](https://github.com/SAP/ui5-webcomponents/commit/02611b2e24b2c2a06129b8e60a8bc680d9501e39))
# [1.13.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.2...v1.13.0-rc.3) (2023-04-27)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.13.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.1...v1.13.0-rc.2) (2023-04-20)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.13.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.0...v1.13.0-rc.1) (2023-04-13)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.13.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.12.0...v1.13.0-rc.0) (2023-04-06)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.12.0](https://github.com/SAP/ui5-webcomponents/compare/v1.12.0-rc.3...v1.12.0) (2023-04-04)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.12.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.12.0-rc.2...v1.12.0-rc.3) (2023-03-30)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.12.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.12.0-rc.1...v1.12.0-rc.2) (2023-03-23)
### Bug Fixes
* inline sources in the .map file so the src folder is not mandatory ([#6732](https://github.com/SAP/ui5-webcomponents/issues/6732)) ([16771a6](https://github.com/SAP/ui5-webcomponents/commit/16771a64d7b13f418af9afa1a03b224fe3762775))
# [1.12.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.12.0-rc.0...v1.12.0-rc.1) (2023-03-16)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.12.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.11.0...v1.12.0-rc.0) (2023-03-09)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.11.0](https://github.com/SAP/ui5-webcomponents/compare/v1.11.0-rc.4...v1.11.0) (2023-03-06)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.11.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.11.0-rc.3...v1.11.0-rc.4) (2023-03-02)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.11.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.11.0-rc.2...v1.11.0-rc.3) (2023-02-23)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.11.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.11.0-rc.1...v1.11.0-rc.2) (2023-02-16)
**Note:** Version bump only for package @ui5/create-webcomponents-package
# [1.11.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.11.0-rc.0...v1.11.0-rc.1) (2023-02-09)
### Features
* **framework:** add option to define package name, tag and typescript support from CLI ([#6379](https://github.com/SAP/ui5-webcomponents/issues/6379)) ([687c0f7](https://github.com/SAP/ui5-webcomponents/commit/687c0f7a420a72f77f294ace2898223c48708ae2)), closes [#6382](https://github.com/SAP/ui5-webcomponents/issues/6382)
# [1.11.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.10.4-rc.0...v1.11.0-rc.0) (2023-02-02)

@@ -8,0 +698,0 @@

149

create-package.js

@@ -8,4 +8,4 @@ #!/usr/bin/env node

const parser = require("npm-config-user-agent-parser");
const yargs = require('yargs/yargs');
const { hideBin } = require('yargs/helpers');
const yargs = require("yargs/yargs");
const { hideBin } = require("yargs/helpers");

@@ -20,17 +20,37 @@ const argv = yargs(hideBin(process.argv)).argv;

// String utils
const capitalizeFirst = str => str.substr(0,1).toUpperCase() + str.substr(1);
const kebabToCamelCase = string => toCamelCase(string.split("-"));
const toCamelCase = parts => {
return parts.map((string, index) => {
return index === 0 ? string.toLowerCase() : string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
}).join("");
const isTSRelatedFile = sourcePath => {
return ["Assets.ts", "MyFirstComponent.ts", "tsconfig.json", "global.d.ts"].some(fileName => sourcePath.includes(fileName));
};
const isTypescriptRelatedFile = sourcePath => {
return ["Аssets.ts", "MyFirstComponent.ts", "tsconfig.json", "global.d.ts"].some(fileName => sourcePath.includes(fileName));
}
const isJSRelatedFile = sourcePath => {
return ["Assets.js", "MyFirstComponent.js"].some(fileName => sourcePath.includes(fileName));
};
const isGitIgnore = sourcePath => {
return sourcePath.includes("gitignore");
};
const isLogo = sourcePath => {
return sourcePath.includes("logo");
};
const isNPMRC = sourcePath => {
return sourcePath.includes("npmrc");
};
// Validation of user input
const isNameValid = name => typeof name === "string" && name.match(/^[a-zA-Z0-9\-_]+$/);
const ComponentNamePattern = /^[A-Z][A-Za-z0-9]+$/;
const NamespacePattern = /^[a-z][a-z0-9\.\-]+$/;
const isPackageNameValid = name => typeof name === "string" && name.match(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/);
const isComponentNameValid = name => typeof name === "string" && ComponentNamePattern.test(name);
const isNamespaceValid = name => typeof name === "string" && NamespacePattern.test(name);
const isTagValid = tag => typeof tag === "string" && tag.match(/^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/);
/**
* Hyphanates the given PascalCase string, f.e.:
* Foo -> "my-foo" (adds preffix)
* FooBar -> "foo-bar"
*/
const hyphaneteComponentName = (componentName) => {
const result = componentName.replace(/([a-z])([A-Z])/g, '$1-$2' ).toLowerCase();
return result.includes("-") ? result : `my-${result}`;
};
// Utils for building the file structure

@@ -50,4 +70,4 @@ const replaceVarsInFileContent = (vars, content) => {

const copyFile = (vars, sourcePath, destPath) => {
const ignoreJsRelated = vars.INIT_PACKAGE_VAR_TYPESCRIPT && sourcePath.includes("MyFirstComponent.js")
const ignoreTsRelated = !vars.INIT_PACKAGE_VAR_TYPESCRIPT && isTypescriptRelatedFile(sourcePath)
const ignoreJsRelated = vars.INIT_PACKAGE_VAR_TYPESCRIPT && isJSRelatedFile(sourcePath);
const ignoreTsRelated = !vars.INIT_PACKAGE_VAR_TYPESCRIPT && isTSRelatedFile(sourcePath);

@@ -58,6 +78,22 @@ if (ignoreJsRelated || ignoreTsRelated) {

let content = fs.readFileSync(sourcePath, {encoding: "UTF-8"});
if (isLogo(sourcePath)) {
fs.copyFileSync(sourcePath, destPath);
return;
}
let content = fs.readFileSync(sourcePath, { encoding: "UTF-8" });
content = replaceVarsInFileContent(vars, content);
destPath = replaceVarsInFileName(vars, destPath);
fs.writeFileSync(destPath, content);
// Rename "gitignore" to ".gitignore" (npm init won't include ".gitignore", so we add it as "gitignore" and rename it later)
if (isGitIgnore(sourcePath)) {
fs.renameSync(destPath, destPath.replace("gitignore", ".gitignore"))
}
// Rename "npmrc" to ".npmrc" (npm init won't include ".npmrc", so we add it as "npmrc" and rename it later)
if (isNPMRC(sourcePath)) {
fs.renameSync(destPath, destPath.replace("npmrc", ".npmrc"));
}
};

@@ -79,16 +115,16 @@

const generateFilesContent = (packageName, componentName, namespace, typescript, skipSubfolder) => {
const tagName = argv.tag || hyphaneteComponentName(componentName);
const generateFilesContent = (name, tag, typescript) => {
const className = capitalizeFirst(kebabToCamelCase(tag));
// All variables that will be replaced in the content of the resources/
const vars = {
INIT_PACKAGE_VAR_NAME: name,
INIT_PACKAGE_VAR_TAG: tag,
INIT_PACKAGE_VAR_CLASS_NAME: className,
INIT_PACKAGE_VAR_TYPESCRIPT: typescript
INIT_PACKAGE_VAR_NAMESPACE: namespace, // namespace must be replaced before name
INIT_PACKAGE_VAR_NAME: packageName,
INIT_PACKAGE_VAR_TAG: tagName,
INIT_PACKAGE_VAR_CLASS_NAME: componentName,
INIT_PACKAGE_VAR_TYPESCRIPT: typescript,
};
const packageContent = {
name,
name: packageName,
version: "0.0.1",

@@ -125,4 +161,10 @@ ui5: {

if (typescript) {
packageContent.devDependencies.typescript = "5.2.2";
}
// Update package.json
const destDir = path.join(`./`, name);
let destDir = packageName.includes("@") ? packageName.slice(packageName.lastIndexOf("/") + 1) : packageName;
destDir = skipSubfolder ? path.join("./") : path.join("./", destDir);
mkdirp.sync(destDir);

@@ -134,3 +176,3 @@ fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));

console.log("\nPackage successfully created!\nNext steps:\n");
console.log(`$ cd ${name}`);
console.log(`$ cd ${destDir}`);

@@ -151,3 +193,3 @@ let userAgentInfo;

console.log("\n");
}
};

@@ -157,16 +199,26 @@ // Main function

let response;
if (argv.name && !isNameValid(argv.name)) {
throw new Error("The package name should be a string (a-z, A-Z, 0-9).");
if (argv.name && !isPackageNameValid(argv.name)) {
throw new Error("The package name should be a string, starting with letter and containing the following symbols [a-z, A-Z, 0-9].");
}
if (argv.componentName && !isComponentNameValid(argv.componentName)) {
throw new Error("The component name should be a string, starting with a capital letter [A-Z][a-z], for example: Button, MyButton, etc.");
}
if (argv.namespace && !isNamespaceValid(argv.namespace)) {
throw new Error("The JSDoc namespace must start with a letter and can only contain small-case letters, numbers, dots and dashes.");
}
if (argv.tag && !isTagValid(argv.tag) ) {
throw new Error("The tag should be in kebab-case (my-first-component f.e) and it can't be a single word.");
throw new Error("The tag should be in kebab-case (f.e my-component) and it can't be a single word.");
}
let name = argv.name || "my-package";
let tag = argv.tag || "my-first-component";
let packageName = argv.name || "my-package";
let componentName = argv.componentName || "MyComponent";
let namespace = argv.namespace || "demo.components";
let typescriptSupport = !!argv.enableTypescript;
const skipSubfolder = !!argv.skipSubfolder;
if (!!argv.skip) {
return generateFilesContent(name, tag, typescriptSupport);
if (argv.skip) {
return generateFilesContent(packageName, componentName, namespace, typescriptSupport, skipSubfolder);
}

@@ -179,5 +231,5 @@

message: "Package name:",
validate: isNameValid,
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, _, -].",
});
name = response.name;
packageName = response.name;
}

@@ -199,21 +251,32 @@

},
]
],
});
typescript = response.language;
typescriptSupport = response.language;
}
if (!argv.tag) {
if (!argv.componentName) {
response = await prompts({
type: "text",
name: "tag",
name: "componentName",
message: "Component name:",
initial: "my-first-component",
validate: isTagValid,
initial: "MyComponent",
validate: (value) => isComponentNameValid(value) ? true : "Component name should follow PascalCase naming convention (f.e. Button, MyButton, etc.).",
});
tag = response.tag;
componentName = response.componentName;
}
return generateFilesContent(name, tag, typescript);
if (!argv.namespace) {
response = await prompts({
type: "text",
name: "namespace",
message: "JSDoc namespace:",
initial: "demo.components",
validate: (value) => isNamespaceValid(value) ? true : "The JSDoc namespace must start with a letter and can only contain small-case letters, numbers, dots and dashes.",
});
namespace = response.namespace;
}
return generateFilesContent(packageName, componentName, namespace, typescriptSupport, skipSubfolder);
};
createWebcomponentsPackage();
{
"name": "@ui5/create-webcomponents-package",
"version": "0.0.0-2f7664755",
"version": "0.0.0-31ad69296",
"description": "UI5 Web Components: create package",

@@ -5,0 +5,0 @@ "author": "SAP SE (https://www.sap.com)",

![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
# UI5 Web Components - Create Package

@@ -16,9 +17,10 @@

npm init @ui5/webcomponents-package [OPTIONS]
# npm 7+, extra double-dash is needed:
# npm 7+, an extra double-dash is needed:
npm init @ui5/webcomponents-package -- [OPTIONS]
Options:
--name <string> - defines package name
--tag <string> - defines predefined custom element tag name
--enable-typescript - enables TypeScript support to the package
--name <string> - defines the package name
--component-name <string> - defines the component class name that will be created in your new package
--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.
--enable-typescript - enables TypeScript support for the package
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed

@@ -36,6 +38,7 @@ ```

Options:
--name <string> - defines package name
--tag <string> - defines predefined custom element tag name
--enable-typescript - enables TypeScript support to the package
--skip - skips all configurations and generates package with default configurations
--name <string> - defines the package name
--component-name <string> - defines the component class name that will be created in your new package
--tag <string> - defines the tag name of the sample web component that will be created in your new package
--enable-typescript - enables TypeScript support for the package
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
```

@@ -52,3 +55,3 @@

## Support
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/).
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/).

@@ -55,0 +58,0 @@ ## Contribute

@@ -9,3 +9,2 @@ // used in test pages

import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/config/NoConflict.js";
import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";

@@ -29,5 +28,4 @@

getCalendarType,
getRTL,
getFirstDayOfWeek,
},
};
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";

@@ -11,3 +12,3 @@ // Template

import { PLEASE_WAIT } from "./generated/i18n/i18n-defaults.js";
import { COUNT } from "./generated/i18n/i18n-defaults.js";

@@ -19,3 +20,13 @@ /**

tag: "INIT_PACKAGE_VAR_TAG",
properties: {
properties: /** @lends INIT_PACKAGE_VAR_NAMESPACE.INIT_PACKAGE_VAR_CLASS_NAME.prototype */ {
/**
* Defines the count of the component.
* @type { sap.ui.webc.base.types.Integer }
* @defaultvalue 0
* @public
*/
count: {
type: Integer,
defaultValue: 0,
},
},

@@ -36,3 +47,3 @@ slots: {

* @constructor
* @alias demo.components.INIT_PACKAGE_VAR_CLASS_NAME
* @alias INIT_PACKAGE_VAR_NAMESPACE.INIT_PACKAGE_VAR_CLASS_NAME
* @extends sap.ui.webc.base.UI5Element

@@ -63,5 +74,9 @@ * @tagname INIT_PACKAGE_VAR_TAG

get pleaseWaitText() {
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(PLEASE_WAIT);
onClick() {
this.count++;
}
get counterText() {
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(COUNT);
}
}

@@ -68,0 +83,0 @@

import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";

@@ -13,3 +15,3 @@ // Template

import { PLEASE_WAIT } from "./generated/i18n/i18n-defaults.js";
import { COUNT } from "./generated/i18n/i18n-defaults.js";

@@ -24,30 +26,33 @@ /**

* @constructor
* @alias demo.components.INIT_PACKAGE_VAR_CLASS_NAME
* @extends sap.ui.webc.base.UI5Element
* @tagname INIT_PACKAGE_VAR_TAG
* @extends UI5Element
* @public
*/
@customElement("INIT_PACKAGE_VAR_TAG")
@customElement({
tag: "INIT_PACKAGE_VAR_TAG",
renderer: litRender,
styles: INIT_PACKAGE_VAR_CLASS_NAMECss,
template: INIT_PACKAGE_VAR_CLASS_NAMETemplate,
})
class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
static i18nBundle: I18nBundle;
static get render() {
return litRender;
static async onDefine() {
INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle = await getI18nBundle("INIT_PACKAGE_VAR_NAME");
}
static get template() {
return INIT_PACKAGE_VAR_CLASS_NAMETemplate;
}
/**
* Defines the component count.
* @default 0
* @public
*/
@property({ validator: Integer, defaultValue: 0 })
count!: number;
static get styles() {
return INIT_PACKAGE_VAR_CLASS_NAMECss;
onClick() {
this.count++;
}
static async onDefine() {
INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle = await getI18nBundle("INIT_PACKAGE_VAR_NAME");
get counterText() {
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(COUNT);
}
get pleaseWaitText() {
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(PLEASE_WAIT);
}
}

@@ -54,0 +59,0 @@

const assert = require("assert");
describe("INIT_PACKAGE_VAR_TAG rendering", async () => {
await browser.url("test/pages/index.html");
before(async () => {
await browser.url("test/pages/index.html");
});
it("tests if web component is correctly rendered", async () => {
const innerContent = await browser.$("#myFirstComponent").shadow$("div");

@@ -9,0 +10,0 @@

@@ -5,2 +5,3 @@ {

"target": "ES2021",
"lib": ["DOM", "DOM.Iterable", "ES2023"],
// Generate d.ts files

@@ -11,2 +12,3 @@ "declaration": true,

"sourceMap": true,
"inlineSources": true,
"strict": true,

@@ -13,0 +15,0 @@ "moduleResolution": "node",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc