generator-easy-ui5 3.3.0 → 3.4.0
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/CHANGELOG.md +7 -1
- package/generators/app/index.js +1 -0
- package/generators/app/postinstall.js +39 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
# [3.3.0](https://github.com/SAP/generator-easy-ui5/compare/v3.2.0...v3.3.0) (2022-02-21)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Bug Fixes
|
|
5
5
|
|
|
6
|
+
* **postinstall:** avoid non-existing node_modules ([#98](https://github.com/SAP/generator-easy-ui5/issues/98)) ([f93c7c9](https://github.com/SAP/generator-easy-ui5/commit/f93c7c99b9e5df7af801a085afe72be85e462007))
|
|
6
7
|
* usage of proper gh org for logging and download ([#94](https://github.com/SAP/generator-easy-ui5/issues/94)) ([a88d4db](https://github.com/SAP/generator-easy-ui5/commit/a88d4dbb0a1f5ed3cf60f7ed0297c651222a83fb))
|
|
7
8
|
* use the org name of the selected generator for downloading the corresponding repo ([d9ca4dc](https://github.com/SAP/generator-easy-ui5/commit/d9ca4dc3170e0507199799d2e14db327cba4d871))
|
|
8
9
|
|
|
9
10
|
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* allow to run easy-ui5 embedded ([#99](https://github.com/SAP/generator-easy-ui5/issues/99)) ([f4952c4](https://github.com/SAP/generator-easy-ui5/commit/f4952c442c9563a51c48b8edc25843f097fce4c4))
|
|
14
|
+
|
|
15
|
+
|
|
10
16
|
|
|
11
17
|
# [3.2.0](https://github.com/SAP/generator-easy-ui5/compare/v3.1.5...v3.2.0) (2022-02-03)
|
|
12
18
|
|
package/generators/app/index.js
CHANGED
|
@@ -5,11 +5,25 @@ const { rm } = require("fs").promises;
|
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const { hasYarn } = require("yarn-or-npm");
|
|
7
7
|
const { Octokit } = require("@octokit/rest");
|
|
8
|
+
const { throttling } = require("@octokit/plugin-throttling");
|
|
9
|
+
const MyOctokit = Octokit.plugin(throttling);
|
|
8
10
|
const AdmZip = require("adm-zip");
|
|
9
11
|
|
|
12
|
+
// helper to retrieve config entries from npm
|
|
13
|
+
// --> npm config set easy-ui5_addGhOrg XYZ
|
|
14
|
+
const NPM_CONFIG_PREFIX = "easy-ui5_";
|
|
15
|
+
let npmConfig;
|
|
16
|
+
const getNPMConfig = (configName) => {
|
|
17
|
+
if (!npmConfig) {
|
|
18
|
+
npmConfig = require("libnpmconfig").read();
|
|
19
|
+
}
|
|
20
|
+
return npmConfig && npmConfig[`${NPM_CONFIG_PREFIX}${configName}`]
|
|
21
|
+
}
|
|
22
|
+
|
|
10
23
|
const ghOrg = "ui5-community",
|
|
11
24
|
repoName = "generator-ui5-project",
|
|
12
|
-
branch = "main"
|
|
25
|
+
branch = "main",
|
|
26
|
+
ghAuthToken = getNPMConfig("ghAuthToken");
|
|
13
27
|
|
|
14
28
|
(async () => {
|
|
15
29
|
|
|
@@ -37,8 +51,25 @@ const ghOrg = "ui5-community",
|
|
|
37
51
|
}
|
|
38
52
|
}
|
|
39
53
|
|
|
40
|
-
const
|
|
41
|
-
|
|
54
|
+
const pkg = require(path.join(__dirname, "../../package.json"));
|
|
55
|
+
console.log(`${pkg.name}:${pkg.version} - ${ghAuthToken}`);
|
|
56
|
+
const octokit = new MyOctokit({
|
|
57
|
+
userAgent: `${pkg.name}:${pkg.version}`,
|
|
58
|
+
auth: ghAuthToken,
|
|
59
|
+
throttle: {
|
|
60
|
+
onRateLimit: (retryAfter, options) => {
|
|
61
|
+
console.log(`Hit the GitHub API limit! Request quota exhausted for this request.`);
|
|
62
|
+
if (options.request.retryCount === 0) {
|
|
63
|
+
// only retries once
|
|
64
|
+
this.log(`Retrying after ${retryAfter} seconds. Alternatively, you can cancel this operation and supply an auth token with "npm config set easy-ui5_ghAuthToken ghp_xxxx".`);
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
onAbuseLimit: () => {
|
|
69
|
+
// does not retry, only logs a warning
|
|
70
|
+
console.error(`Hit the GitHub API limit again! Please supply an auth token with with "npm config set easy-ui5_ghAuthToken ghp_xxxx".`);
|
|
71
|
+
},
|
|
72
|
+
}
|
|
42
73
|
});
|
|
43
74
|
|
|
44
75
|
const reqBranch = await octokit.repos.getBranch({
|
|
@@ -51,7 +82,7 @@ const ghOrg = "ui5-community",
|
|
|
51
82
|
|
|
52
83
|
// eslint-disable-next-line
|
|
53
84
|
console.log(
|
|
54
|
-
`
|
|
85
|
+
`Using commit ${commitSHA} from @${ghOrg}/${repoName}#${branch}...`
|
|
55
86
|
);
|
|
56
87
|
const generatorPath = path.join(
|
|
57
88
|
__dirname,
|
|
@@ -63,7 +94,10 @@ const ghOrg = "ui5-community",
|
|
|
63
94
|
if (fs.existsSync(generatorPath)) {
|
|
64
95
|
// check if the SHA marker exists to know whether the generator is up-to-date or not
|
|
65
96
|
if (!fs.existsSync(shaMarker)) {
|
|
66
|
-
|
|
97
|
+
// eslint-disable-next-line
|
|
98
|
+
console.log(
|
|
99
|
+
`Fetching new ZIP as the default generator is outdated...`
|
|
100
|
+
);
|
|
67
101
|
// remove if the SHA marker doesn't exist => outdated!
|
|
68
102
|
showBusy(" Removing old default templates");
|
|
69
103
|
await rm(generatorPath, { recursive: true });
|