generator-easy-ui5 3.1.3 → 3.1.4
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 +23 -19
- package/generators/app/postinstall.js +9 -9
- package/package.json +2 -2
package/generators/app/index.js
CHANGED
|
@@ -18,30 +18,30 @@ const generatorOptions = {
|
|
|
18
18
|
ghAuthToken: {
|
|
19
19
|
type: String,
|
|
20
20
|
description:
|
|
21
|
-
|
|
21
|
+
"GitHub authToken to optionally access private generator repositories",
|
|
22
22
|
},
|
|
23
23
|
ghOrg: {
|
|
24
24
|
type: String,
|
|
25
|
-
description:
|
|
25
|
+
description: "GitHub organization to lookup for available generators",
|
|
26
26
|
default: "ui5-community",
|
|
27
27
|
hidden: true // we don't want to recommend to use this option
|
|
28
28
|
},
|
|
29
29
|
list: {
|
|
30
30
|
type: Boolean,
|
|
31
|
-
description:
|
|
31
|
+
description: "List the available subcommands of the generator",
|
|
32
32
|
},
|
|
33
33
|
verbose: {
|
|
34
34
|
type: Boolean,
|
|
35
|
-
description:
|
|
35
|
+
description: "Enable detailed logging",
|
|
36
36
|
},
|
|
37
37
|
skipUpdate: {
|
|
38
38
|
type: Boolean,
|
|
39
|
-
description:
|
|
39
|
+
description: "Skip the update of the plugin generators",
|
|
40
40
|
},
|
|
41
41
|
plugins: {
|
|
42
42
|
type: Boolean,
|
|
43
43
|
alias: "p",
|
|
44
|
-
description:
|
|
44
|
+
description: "Get detailed version information",
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -49,18 +49,21 @@ const generatorArgs = {
|
|
|
49
49
|
generator: {
|
|
50
50
|
type: String,
|
|
51
51
|
required: false,
|
|
52
|
-
description:
|
|
52
|
+
description: "Name of the generator to invoke (without the \"generator-ui5-\" prefix)",
|
|
53
53
|
},
|
|
54
54
|
subcommand: {
|
|
55
55
|
type: String,
|
|
56
56
|
required: false,
|
|
57
|
-
description:
|
|
57
|
+
description: "Name of the subcommand to invoke (without the \"generator:\" prefix)",
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
module.exports = class extends Generator {
|
|
62
62
|
constructor(args, opts) {
|
|
63
|
-
super(args, opts
|
|
63
|
+
super(args, opts, {
|
|
64
|
+
// disable the Yeoman 5 package-manager logic (auto install)!
|
|
65
|
+
customInstallTask: "disabled"
|
|
66
|
+
});
|
|
64
67
|
|
|
65
68
|
Object.keys(generatorArgs).forEach((argName) => {
|
|
66
69
|
// register the argument for being displayed in the help
|
|
@@ -80,7 +83,7 @@ module.exports = class extends Generator {
|
|
|
80
83
|
|
|
81
84
|
_showBusy(statusText) {
|
|
82
85
|
this._clearBusy();
|
|
83
|
-
const progressChars = [
|
|
86
|
+
const progressChars = ["\\", "|", "/", "-"];
|
|
84
87
|
let i = 0;
|
|
85
88
|
process.stdout.write(`\r${statusText} `);
|
|
86
89
|
this._busy = {
|
|
@@ -95,7 +98,7 @@ module.exports = class extends Generator {
|
|
|
95
98
|
_clearBusy(newLine) {
|
|
96
99
|
if (this._busy) {
|
|
97
100
|
clearInterval(this._busy.timer);
|
|
98
|
-
process.stdout.write(
|
|
101
|
+
process.stdout.write("\r".padEnd(this._busy.text.length + 3) + (newLine ? "\n" : ""));
|
|
99
102
|
delete this._busy;
|
|
100
103
|
}
|
|
101
104
|
}
|
|
@@ -105,11 +108,11 @@ module.exports = class extends Generator {
|
|
|
105
108
|
if (this.options.plugins) {
|
|
106
109
|
const glob = require("glob");
|
|
107
110
|
const yeoman = require("yeoman-environment/package.json");
|
|
108
|
-
const home = __dirname.slice(0, -14)
|
|
111
|
+
const home = __dirname.slice(0, -14);
|
|
109
112
|
|
|
110
113
|
const components = {
|
|
111
|
-
|
|
112
|
-
|
|
114
|
+
"Node.js": process.version,
|
|
115
|
+
"home": home,
|
|
113
116
|
"yeoman-environment": yeoman.version
|
|
114
117
|
};
|
|
115
118
|
glob.sync(path.join(home, "plugin-generators/*/package.json")).forEach(function (plugin) {
|
|
@@ -121,7 +124,8 @@ module.exports = class extends Generator {
|
|
|
121
124
|
const log = this.log;
|
|
122
125
|
return Object.keys(components).forEach(function (component) {
|
|
123
126
|
log(`${chalk.green(component)}: ${components[component]}`);
|
|
124
|
-
})
|
|
127
|
+
});
|
|
128
|
+
;
|
|
125
129
|
}
|
|
126
130
|
|
|
127
131
|
this.log(yosay(`Welcome to the ${chalk.red("easy-ui5")} generator!`));
|
|
@@ -142,7 +146,7 @@ module.exports = class extends Generator {
|
|
|
142
146
|
return true;
|
|
143
147
|
}
|
|
144
148
|
},
|
|
145
|
-
onAbuseLimit: (
|
|
149
|
+
onAbuseLimit: () => {
|
|
146
150
|
// does not retry, only logs a warning
|
|
147
151
|
this.log(
|
|
148
152
|
`${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\` `
|
|
@@ -294,9 +298,9 @@ module.exports = class extends Generator {
|
|
|
294
298
|
...process.env,
|
|
295
299
|
"NO_UPDATE_NOTIFIER": true
|
|
296
300
|
}
|
|
297
|
-
}).on(
|
|
301
|
+
}).on("exit", function (code) {
|
|
298
302
|
resolve(code);
|
|
299
|
-
}).on(
|
|
303
|
+
}).on("error", function (err) {
|
|
300
304
|
reject(err);
|
|
301
305
|
});
|
|
302
306
|
}.bind(this));
|
|
@@ -371,7 +375,7 @@ module.exports = class extends Generator {
|
|
|
371
375
|
}
|
|
372
376
|
}
|
|
373
377
|
|
|
374
|
-
// transform the list of the subgenerators and identify the
|
|
378
|
+
// transform the list of the subgenerators and identify the
|
|
375
379
|
// default subgenerator for the default selection
|
|
376
380
|
let defaultSubGenerator;
|
|
377
381
|
let maxLength = 0;
|
|
@@ -17,7 +17,7 @@ const ghOrg = "ui5-community",
|
|
|
17
17
|
|
|
18
18
|
function showBusy(statusText) {
|
|
19
19
|
clearBusy();
|
|
20
|
-
const progressChars = [
|
|
20
|
+
const progressChars = ["\\", "|", "/", "-"];
|
|
21
21
|
let i = 0;
|
|
22
22
|
process.stdout.write(`\r${statusText} `);
|
|
23
23
|
_busy = {
|
|
@@ -32,7 +32,7 @@ const ghOrg = "ui5-community",
|
|
|
32
32
|
function clearBusy(newLine) {
|
|
33
33
|
if (_busy) {
|
|
34
34
|
clearInterval(_busy.timer);
|
|
35
|
-
process.stdout.write(
|
|
35
|
+
process.stdout.write("\r".padEnd(_busy.text.length + 3) + (newLine ? "\n" : ""));
|
|
36
36
|
_busy = null;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -63,9 +63,9 @@ const ghOrg = "ui5-community",
|
|
|
63
63
|
if (fs.existsSync(generatorPath)) {
|
|
64
64
|
// check if the SHA marker exists to know whether the generator is up-to-date or not
|
|
65
65
|
if (!fs.existsSync(shaMarker)) {
|
|
66
|
-
console.log(
|
|
66
|
+
console.log("The default generator is outdated...");
|
|
67
67
|
// remove if the SHA marker doesn't exist => outdated!
|
|
68
|
-
showBusy(
|
|
68
|
+
showBusy(" Removing old default templates");
|
|
69
69
|
await rmdir(generatorPath, { recursive: true });
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -73,8 +73,8 @@ const ghOrg = "ui5-community",
|
|
|
73
73
|
|
|
74
74
|
// re-fetch the generator and extract into local plugin folder
|
|
75
75
|
if (!fs.existsSync(generatorPath)) {
|
|
76
|
-
console.log(
|
|
77
|
-
showBusy(
|
|
76
|
+
console.log("Extracting default templates...");
|
|
77
|
+
showBusy(" Downloading and extracting default templates");
|
|
78
78
|
const reqZIPArchive = await octokit.repos.downloadZipballArchive({
|
|
79
79
|
owner: ghOrg,
|
|
80
80
|
repo: repoName,
|
|
@@ -100,7 +100,7 @@ const ghOrg = "ui5-community",
|
|
|
100
100
|
|
|
101
101
|
// run yarn/npm install
|
|
102
102
|
console.log("Installing the plugin dependencies...");
|
|
103
|
-
showBusy(
|
|
103
|
+
showBusy(" Preparing the default templates");
|
|
104
104
|
await new Promise(function (resolve, reject) {
|
|
105
105
|
spawn((hasYarn() ? "yarn" : "npm"), ["install", "--no-progress"], {
|
|
106
106
|
stdio: "inherit",
|
|
@@ -109,9 +109,9 @@ const ghOrg = "ui5-community",
|
|
|
109
109
|
...process.env,
|
|
110
110
|
"NO_UPDATE_NOTIFIER": true
|
|
111
111
|
}
|
|
112
|
-
}).on(
|
|
112
|
+
}).on("exit", function (code) {
|
|
113
113
|
resolve(code);
|
|
114
|
-
}).on(
|
|
114
|
+
}).on("error", function (err) {
|
|
115
115
|
reject(err);
|
|
116
116
|
});
|
|
117
117
|
}.bind(this));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-easy-ui5",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
4
4
|
"description": "Generator for UI5-based project",
|
|
5
5
|
"main": "generators/app/index.js",
|
|
6
6
|
"files": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "mocha",
|
|
11
11
|
"postinstall": "node generators/app/postinstall",
|
|
12
|
-
"lint": "eslint .",
|
|
12
|
+
"lint": "eslint . --fix",
|
|
13
13
|
"prettier": "prettier --write .",
|
|
14
14
|
"start": "yo easy-ui5 project",
|
|
15
15
|
"listSubGen": "yo easy-ui5 project --list",
|