generator-easy-ui5 3.0.3 → 3.1.3
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/generators/app/index.js +51 -1
- package/package.json +3 -1
package/generators/app/index.js
CHANGED
|
@@ -10,6 +10,8 @@ const fs = require("fs");
|
|
|
10
10
|
const { rmdir } = require("fs").promises;
|
|
11
11
|
|
|
12
12
|
const { Octokit } = require("@octokit/rest");
|
|
13
|
+
const { throttling } = require("@octokit/plugin-throttling");
|
|
14
|
+
const MyOctokit = Octokit.plugin(throttling);
|
|
13
15
|
const AdmZip = require("adm-zip");
|
|
14
16
|
|
|
15
17
|
const generatorOptions = {
|
|
@@ -36,6 +38,11 @@ const generatorOptions = {
|
|
|
36
38
|
type: Boolean,
|
|
37
39
|
description: `Skip the update of the plugin generators`,
|
|
38
40
|
},
|
|
41
|
+
plugins: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
alias: "p",
|
|
44
|
+
description: `Get detailed version information`,
|
|
45
|
+
}
|
|
39
46
|
};
|
|
40
47
|
|
|
41
48
|
const generatorArgs = {
|
|
@@ -94,12 +101,55 @@ module.exports = class extends Generator {
|
|
|
94
101
|
}
|
|
95
102
|
|
|
96
103
|
async prompting() {
|
|
104
|
+
|
|
105
|
+
if (this.options.plugins) {
|
|
106
|
+
const glob = require("glob");
|
|
107
|
+
const yeoman = require("yeoman-environment/package.json");
|
|
108
|
+
const home = __dirname.slice(0, -14)
|
|
109
|
+
|
|
110
|
+
const components = {
|
|
111
|
+
'Node.js': process.version,
|
|
112
|
+
'home': home,
|
|
113
|
+
"yeoman-environment": yeoman.version
|
|
114
|
+
};
|
|
115
|
+
glob.sync(path.join(home, "plugin-generators/*/package.json")).forEach(function (plugin) {
|
|
116
|
+
const name = plugin.match(/plugin-generators\/(.+)\/package\.json/)[1];
|
|
117
|
+
const lib = require(plugin);
|
|
118
|
+
components[name] = lib.version;
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const log = this.log;
|
|
122
|
+
return Object.keys(components).forEach(function (component) {
|
|
123
|
+
log(`${chalk.green(component)}: ${components[component]}`);
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
|
|
97
127
|
this.log(yosay(`Welcome to the ${chalk.red("easy-ui5")} generator!`));
|
|
98
128
|
|
|
99
129
|
// create the octokit client to retrieve the generators from GH org
|
|
100
|
-
const octokit = new
|
|
130
|
+
const octokit = new MyOctokit({
|
|
101
131
|
userAgent: `${this.rootGeneratorName()}:${this.rootGeneratorVersion()}`,
|
|
102
132
|
auth: this.options.ghAuthToken,
|
|
133
|
+
throttle: {
|
|
134
|
+
onRateLimit: (retryAfter, options) => {
|
|
135
|
+
this.log(
|
|
136
|
+
`${chalk.yellow("Hit the GitHub API limit!")} Request quota exhausted for this request.`
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
if (options.request.retryCount === 0) {
|
|
140
|
+
// only retries once
|
|
141
|
+
this.log(`Retrying after ${retryAfter} seconds. Alternatively, you can cancel this operation and supply an auth token with the \`--ghAuthToken\` option. For more details, run \`yo easy-ui5 --help\`. `);
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
onAbuseLimit: (_, options) => {
|
|
146
|
+
// does not retry, only logs a warning
|
|
147
|
+
this.log(
|
|
148
|
+
`${chalk.red("Hit the GitHub API limit again!")} Please supply an auth token with the \`--ghAuthToken\` option. For more details, run \`yo easy-ui5 --help\` `
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
},
|
|
152
|
+
}
|
|
103
153
|
});
|
|
104
154
|
|
|
105
155
|
// retrieve the available repositories
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-easy-ui5",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"description": "Generator for UI5-based project",
|
|
5
5
|
"main": "generators/app/index.js",
|
|
6
6
|
"files": [
|
|
@@ -36,10 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/SAP/generator-easy-ui5#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@octokit/plugin-throttling": "^3.5.2",
|
|
39
40
|
"@octokit/rest": "^18.12.0",
|
|
40
41
|
"adm-zip": "^0.5.9",
|
|
41
42
|
"chalk": "^4.1.2",
|
|
42
43
|
"colors": "^1.4.0",
|
|
44
|
+
"glob": "^7.2.0",
|
|
43
45
|
"mocha": "^9.1.3",
|
|
44
46
|
"rimraf": "^3.0.2",
|
|
45
47
|
"yarn-or-npm": "^3.0.1",
|