@ui5/create-webcomponents-package 0.0.4 → 0.0.8
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 +16 -1
- package/{lib/init-package/index.js → index.js} +36 -21
- package/package.json +4 -6
- package/{lib/init-package/resources → template}/.eslintignore +0 -0
- package/{lib/init-package/resources → template}/bundle.esm.js +0 -0
- package/{lib/init-package/resources → template}/config/.eslintrc.js +0 -0
- package/{lib/init-package/resources → template}/config/postcss.components/postcss.config.js +0 -0
- package/{lib/init-package/resources → template}/config/postcss.themes/postcss.config.js +0 -0
- package/{lib/init-package/resources → template}/config/rollup.config.js +0 -0
- package/{lib/init-package/resources → template}/config/wdio.conf.js +0 -0
- package/{lib/init-package/resources → template}/package-scripts.js +0 -0
- package/{lib/init-package/resources → template}/src/Assets.js +0 -0
- package/{lib/init-package/resources → template}/src/MyFirstComponent.hbs +0 -0
- package/{lib/init-package/resources → template}/src/MyFirstComponent.js +0 -0
- package/{lib/init-package/resources → template}/src/i18n/messagebundle.properties +0 -0
- package/{lib/init-package/resources → template}/src/i18n/messagebundle_de.properties +0 -0
- package/{lib/init-package/resources → template}/src/i18n/messagebundle_en.properties +0 -0
- package/{lib/init-package/resources → template}/src/i18n/messagebundle_es.properties +0 -0
- package/{lib/init-package/resources → template}/src/i18n/messagebundle_fr.properties +0 -0
- package/{lib/init-package/resources → template}/src/themes/MyFirstComponent.css +0 -0
- package/{lib/init-package/resources → template}/src/themes/sap_belize/parameters-bundle.css +0 -0
- package/{lib/init-package/resources → template}/src/themes/sap_belize_hcb/parameters-bundle.css +0 -0
- package/{lib/init-package/resources → template}/src/themes/sap_belize_hcw/parameters-bundle.css +0 -0
- package/{lib/init-package/resources → template}/src/themes/sap_fiori_3/parameters-bundle.css +0 -0
- package/{lib/init-package/resources → template}/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -0
- package/{lib/init-package/resources → template}/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -0
- package/{lib/init-package/resources → template}/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -0
- package/{lib/init-package/resources → template}/test/pages/index.html +0 -0
- package/{lib/init-package/resources → template}/test/specs/Demo.spec.js +0 -0
- package/yarn-error.log +10165 -0
- package/bin/init-ui5-package.js +0 -3
package/README.md
CHANGED
@@ -5,7 +5,22 @@
|
|
5
5
|
[](https://travis-ci.org/SAP/ui5-webcomponents)
|
6
6
|
[](https://www.npmjs.com/package/@ui5/webcomponents)
|
7
7
|
|
8
|
-
Provides
|
8
|
+
Provides an `npm init` script for creating new UI5 Webcomponents Packages
|
9
|
+
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
with `npm`
|
13
|
+
|
14
|
+
- `npm init @ui5/webcomponents-package` (the user will be asked for **name**, **port**, **tag**)
|
15
|
+
- `npm init @ui5/webcomponents-package <NEW-PACKAGE-NAME>` (the user will be asked for **port** and **tag** only)
|
16
|
+
|
17
|
+
and with `yarn`
|
18
|
+
|
19
|
+
- `yarn create @ui5/webcomponents-package`
|
20
|
+
- `yarn create @ui5/webcomponents-package <NEW-PACKAGE-NAME>`
|
21
|
+
|
22
|
+
The script creates a new directory, and fills it with a `package.json` file and all necessary source files and resources for a new
|
23
|
+
components package.
|
9
24
|
|
10
25
|
## Resources
|
11
26
|
- [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/master/README.md)
|
@@ -1,8 +1,13 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
1
3
|
const fs = require("fs");
|
2
4
|
const path = require("path");
|
3
5
|
const mkdirp = require("mkdirp");
|
4
6
|
const prompts = require("prompts");
|
5
|
-
const
|
7
|
+
const parser = require("npm-config-user-agent-parser");
|
8
|
+
|
9
|
+
// from where all the files will be copied
|
10
|
+
const TEMPLATE_DIR = path.join(`${__dirname}`, `template/`);
|
6
11
|
|
7
12
|
// String utils
|
8
13
|
const capitalizeFirst = str => str.substr(0,1).toUpperCase() + str.substr(1);
|
@@ -36,27 +41,24 @@ const copyFile = (vars, sourcePath, destPath) => {
|
|
36
41
|
content = replaceVarsInFileContent(vars, content);
|
37
42
|
destPath = replaceVarsInFileName(vars, destPath);
|
38
43
|
fs.writeFileSync(destPath, content);
|
39
|
-
console.log(destPath);
|
40
44
|
};
|
41
45
|
|
42
|
-
const
|
46
|
+
const copyFiles = (vars, sourcePath, destPath) => {
|
43
47
|
const isDir = fs.lstatSync(sourcePath).isDirectory();
|
44
48
|
if (isDir) {
|
45
49
|
if (destPath) {
|
46
50
|
mkdirp.sync(destPath);
|
47
51
|
}
|
48
52
|
fs.readdirSync(sourcePath).forEach(file => {
|
49
|
-
|
53
|
+
copyFiles(vars, path.join(sourcePath, file), path.join(destPath, file));
|
50
54
|
});
|
51
55
|
} else {
|
52
56
|
copyFile(vars, sourcePath, destPath);
|
53
57
|
}
|
54
58
|
};
|
55
59
|
|
56
|
-
//
|
57
|
-
const
|
58
|
-
|
59
|
-
const initPackage = async () => {
|
60
|
+
// Main function
|
61
|
+
const createWebcomponentsPackage = async () => {
|
60
62
|
let response;
|
61
63
|
|
62
64
|
// Get the name
|
@@ -66,7 +68,7 @@ const initPackage = async () => {
|
|
66
68
|
response = await prompts({
|
67
69
|
type: "text",
|
68
70
|
name: "name",
|
69
|
-
message:
|
71
|
+
message: "Package name:",
|
70
72
|
validate: isNameValid,
|
71
73
|
});
|
72
74
|
name = response.name;
|
@@ -76,7 +78,7 @@ const initPackage = async () => {
|
|
76
78
|
response = await prompts({
|
77
79
|
type: "text",
|
78
80
|
name: "port",
|
79
|
-
message: "
|
81
|
+
message: "Dev server port:",
|
80
82
|
validate: isPortValid,
|
81
83
|
initial: "8080",
|
82
84
|
});
|
@@ -86,7 +88,7 @@ const initPackage = async () => {
|
|
86
88
|
response = await prompts({
|
87
89
|
type: "text",
|
88
90
|
name: "tag",
|
89
|
-
message: "
|
91
|
+
message: "Demo component name:",
|
90
92
|
initial: "my-first-component",
|
91
93
|
validate: isTagValid,
|
92
94
|
});
|
@@ -128,11 +130,11 @@ const initPackage = async () => {
|
|
128
130
|
"./*": "./dist/*",
|
129
131
|
},
|
130
132
|
"dependencies": {
|
131
|
-
"@ui5/webcomponents-base": "
|
132
|
-
"@ui5/webcomponents-theme-base": "
|
133
|
+
"@ui5/webcomponents-base": "1.0.0-rc.15",
|
134
|
+
"@ui5/webcomponents-theme-base": "1.0.0-rc.15",
|
133
135
|
},
|
134
136
|
"devDependencies": {
|
135
|
-
"@ui5/webcomponents-tools": "
|
137
|
+
"@ui5/webcomponents-tools": "1.0.0-rc.15",
|
136
138
|
"chromedriver": "*",
|
137
139
|
},
|
138
140
|
};
|
@@ -140,14 +142,27 @@ const initPackage = async () => {
|
|
140
142
|
// Update package.json
|
141
143
|
const destDir = path.join(`./`, name);
|
142
144
|
mkdirp.sync(destDir);
|
143
|
-
fs.writeFileSync(path.join(destDir, "package.json"),
|
145
|
+
fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));
|
144
146
|
// Copy files
|
145
|
-
|
147
|
+
copyFiles(vars, TEMPLATE_DIR, destDir);
|
148
|
+
|
149
|
+
console.log("\nPackage successfully created!\nNext steps:\n");
|
150
|
+
console.log(`$ cd ${name}`);
|
151
|
+
|
152
|
+
let userAgentInfo;
|
153
|
+
try {
|
154
|
+
userAgentInfo = parser(process.env.npm_config_user_agent);
|
155
|
+
} catch (e) {}
|
156
|
+
|
157
|
+
if (userAgentInfo && userAgentInfo.yarn) {
|
158
|
+
console.log(`$ yarn`);
|
159
|
+
console.log(`$ yarn start`);
|
160
|
+
} else {
|
161
|
+
console.log(`$ npm i`);
|
162
|
+
console.log(`$ npm start`);
|
163
|
+
}
|
146
164
|
|
147
|
-
console.log("
|
148
|
-
console.log(`cd ${name}`);
|
149
|
-
console.log(`npm i`);
|
150
|
-
console.log(`npm start\n\n`);
|
165
|
+
console.log("\n");
|
151
166
|
};
|
152
167
|
|
153
|
-
|
168
|
+
createWebcomponentsPackage();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/create-webcomponents-package",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.8",
|
4
4
|
"description": "UI5 Web Components: create package",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -10,9 +10,8 @@
|
|
10
10
|
"sapui5",
|
11
11
|
"ui5"
|
12
12
|
],
|
13
|
-
"scripts": {},
|
14
13
|
"bin": {
|
15
|
-
"create-webcomponents-package": "
|
14
|
+
"create-webcomponents-package": "index.js"
|
16
15
|
},
|
17
16
|
"repository": {
|
18
17
|
"type": "git",
|
@@ -20,9 +19,8 @@
|
|
20
19
|
"directory": "packages/create-package"
|
21
20
|
},
|
22
21
|
"dependencies": {
|
23
|
-
"json-beautify": "^1.1.1",
|
24
22
|
"mkdirp": "^1.0.4",
|
23
|
+
"npm-config-user-agent-parser": "^1.0.0",
|
25
24
|
"prompts": "^2.4.1"
|
26
|
-
}
|
27
|
-
"peerDependencies": {}
|
25
|
+
}
|
28
26
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
package/{lib/init-package/resources → template}/src/themes/sap_belize_hcb/parameters-bundle.css
RENAMED
File without changes
|
package/{lib/init-package/resources → template}/src/themes/sap_belize_hcw/parameters-bundle.css
RENAMED
File without changes
|
package/{lib/init-package/resources → template}/src/themes/sap_fiori_3/parameters-bundle.css
RENAMED
File without changes
|
package/{lib/init-package/resources → template}/src/themes/sap_fiori_3_dark/parameters-bundle.css
RENAMED
File without changes
|
package/{lib/init-package/resources → template}/src/themes/sap_fiori_3_hcb/parameters-bundle.css
RENAMED
File without changes
|
package/{lib/init-package/resources → template}/src/themes/sap_fiori_3_hcw/parameters-bundle.css
RENAMED
File without changes
|
File without changes
|
File without changes
|