generator-easy-ui5 3.1.3 → 3.2.1
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 +245 -5
- package/README.md +5 -1
- package/generators/app/index.js +160 -62
- package/generators/app/postinstall.js +9 -9
- package/package.json +28 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,253 @@
|
|
|
1
|
-
|
|
1
|
+
# [3.2.0](https://github.com/SAP/generator-easy-ui5/compare/v3.1.5...v3.2.0) (2022-02-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* freeze version of colors.js in package.json ([#85](https://github.com/SAP/generator-easy-ui5/issues/85)) ([6b497b6](https://github.com/SAP/generator-easy-ui5/commit/6b497b6c05748b8f67617c6399a11f8e8d850d48))
|
|
7
|
+
* use homedir for plugin-generators avoid EACCESS ([e326676](https://github.com/SAP/generator-easy-ui5/commit/e326676458f439f9ac01498381059229a897fa61)), closes [#84](https://github.com/SAP/generator-easy-ui5/issues/84)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* Add support for user repositories ([6b7efa6](https://github.com/SAP/generator-easy-ui5/commit/6b7efa63414c31d76a53ee1b069557c527077f39))
|
|
13
|
+
* support additional GH org via NPM config ([0d33197](https://github.com/SAP/generator-easy-ui5/commit/0d33197098e010858d1ea7a0e4b172d5d6a5aa22))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [3.1.5](https://github.com/SAP/generator-easy-ui5/compare/v3.1.4...v3.1.5) (2022-01-10)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* re-enable sub-generator update check ([c464bd1](https://github.com/SAP/generator-easy-ui5/commit/c464bd11d2cf32006fd7f42ea8f15a736cb10271))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [3.1.4](https://github.com/SAP/generator-easy-ui5/compare/v3.1.3...v3.1.4) (2021-12-07)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* disable autoinstall of Yeoman 5.x ([de6fcaf](https://github.com/SAP/generator-easy-ui5/commit/de6fcafd164734a9e3fbbab599b7376a49fffe89))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [3.1.3](https://github.com/SAP/generator-easy-ui5/compare/v3.1.2...v3.1.3) (2021-11-25)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
## [3.1.2](https://github.com/SAP/generator-easy-ui5/compare/v3.1.1...v3.1.2) (2021-11-23)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
## [3.1.1](https://github.com/SAP/generator-easy-ui5/compare/v3.1.0...v3.1.1) (2021-11-23)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
# [3.1.0](https://github.com/SAP/generator-easy-ui5/compare/v3.0.3...v3.1.0) (2021-11-23)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [3.0.3](https://github.com/SAP/generator-easy-ui5/compare/v3.0.2...v3.0.3) (2021-11-15)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## [3.0.2](https://github.com/SAP/generator-easy-ui5/compare/v3.0.1...v3.0.2) (2021-11-15)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## [3.0.1](https://github.com/SAP/generator-easy-ui5/compare/v2.4.6...v3.0.1) (2021-05-10)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## [2.4.6](https://github.com/SAP/generator-easy-ui5/compare/2.4.6...v2.4.6) (2021-02-10)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Bug Fixes
|
|
67
|
+
|
|
68
|
+
* uiveri5 reporters ([f2e2d6d](https://github.com/SAP/generator-easy-ui5/commit/f2e2d6dae71dc580ee0d15c42baafe06ae983d4e))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## [2.4.5](https://github.com/SAP/generator-easy-ui5/compare/2.4.5...v2.4.5) (2021-01-29)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
* opa test namespace and folder ([fb166b7](https://github.com/SAP/generator-easy-ui5/commit/fb166b7df06b7cd465366726ed484890ad389d96))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
## [2.4.4](https://github.com/SAP/generator-easy-ui5/compare/2.4.4...v2.4.4) (2021-01-25)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## [2.4.3](https://github.com/SAP/generator-easy-ui5/compare/2.4.3...v2.4.3) (2021-01-08)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## [2.4.2](https://github.com/SAP/generator-easy-ui5/compare/2.4.2...v2.4.2) (2020-12-18)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
## [2.4.1](https://github.com/SAP/generator-easy-ui5/compare/v2.4.0...v2.4.1) (2020-12-18)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# [2.4.0](https://github.com/SAP/generator-easy-ui5/compare/v2.3.0...v2.4.0) (2020-12-10)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Features
|
|
101
|
+
|
|
102
|
+
* add wdi5 as test framework ([e63ce2e](https://github.com/SAP/generator-easy-ui5/commit/e63ce2eb2ed9cc23840cb303d01fc4e7d23f2c11))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
# [2.3.0](https://github.com/SAP/generator-easy-ui5/compare/v2.2.4...v2.3.0) (2020-11-25)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## [2.2.4](https://github.com/SAP/generator-easy-ui5/compare/v2.2.3...v2.2.4) (2020-11-10)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
## [2.2.3](https://github.com/SAP/generator-easy-ui5/compare/v2.2.2...v2.2.3) (2020-11-05)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## [2.2.2](https://github.com/SAP/generator-easy-ui5/compare/v2.2.1...v2.2.2) (2020-10-28)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
## [2.2.1](https://github.com/SAP/generator-easy-ui5/compare/v2.2.0...v2.2.1) (2020-10-23)
|
|
2
123
|
|
|
3
|
-
### New Features
|
|
4
124
|
|
|
5
|
-
Starting with easy-ui5 v3, all templates will be outsource to repositories in the [UI5 Community](https://github.com/ui5-community/). This project is from now on a shell that will offer all generators hosted on that GitHub org. Easy-ui5 will download and install these repositories when needed.
|
|
6
125
|
|
|
7
|
-
|
|
126
|
+
# [2.2.0](https://github.com/SAP/generator-easy-ui5/compare/v2.1.7...v2.2.0) (2020-10-16)
|
|
8
127
|
|
|
9
128
|
|
|
10
129
|
|
|
130
|
+
## [2.1.7](https://github.com/SAP/generator-easy-ui5/compare/v2.1.6...v2.1.7) (2020-09-10)
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## [2.1.6](https://github.com/SAP/generator-easy-ui5/compare/v2.1.5...v2.1.6) (2020-08-24)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## [2.1.5](https://github.com/SAP/generator-easy-ui5/compare/v2.1.4...v2.1.5) (2020-08-24)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
## [2.1.4](https://github.com/SAP/generator-easy-ui5/compare/v2.1.3...v2.1.4) (2020-08-06)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
## [2.1.3](https://github.com/SAP/generator-easy-ui5/compare/v2.1.2...v2.1.3) (2020-08-03)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## [2.1.2](https://github.com/SAP/generator-easy-ui5/compare/v2.1.1...v2.1.2) (2020-06-29)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## [2.1.1](https://github.com/SAP/generator-easy-ui5/compare/v2.1.0...v2.1.1) (2020-06-18)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
# [2.1.0](https://github.com/SAP/generator-easy-ui5/compare/v2.0.1...v2.1.0) (2020-06-15)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
## [2.0.1](https://github.com/SAP/generator-easy-ui5/compare/v2.0.0...v2.0.1) (2020-06-09)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# [2.0.0](https://github.com/SAP/generator-easy-ui5/compare/v1.3.7...v2.0.0) (2020-06-08)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
## [1.3.7](https://github.com/SAP/generator-easy-ui5/compare/v1.3.6...v1.3.7) (2020-05-06)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
## [1.3.6](https://github.com/SAP/generator-easy-ui5/compare/v1.3.5...v1.3.6) (2020-05-06)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
## [1.3.5](https://github.com/SAP/generator-easy-ui5/compare/v1.3.4...v1.3.5) (2020-04-30)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
## [1.3.4](https://github.com/SAP/generator-easy-ui5/compare/v1.3.3...v1.3.4) (2020-04-29)
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
## [1.3.3](https://github.com/SAP/generator-easy-ui5/compare/v1.3.2...v1.3.3) (2020-04-14)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
## [1.3.2](https://github.com/SAP/generator-easy-ui5/compare/v1.3.1...v1.3.2) (2020-04-02)
|
|
191
|
+
|
|
192
|
+
|
|
11
193
|
### Bug Fixes
|
|
12
194
|
|
|
13
|
-
|
|
195
|
+
* **app:** Fix lint errors ([c4df165](https://github.com/SAP/generator-easy-ui5/commit/c4df165e35b319aedfc932ac37d2593c0fa5e526))
|
|
196
|
+
* **formatter:** Fix formatter ([4f637c8](https://github.com/SAP/generator-easy-ui5/commit/4f637c81e2a916a0067d36f8d214a447a7a62212))
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
### Features
|
|
200
|
+
|
|
201
|
+
* **BaseController:** Adding the BaseController and formatter ([e51a66b](https://github.com/SAP/generator-easy-ui5/commit/e51a66bfcd8dea90fd27c7684264e1202bde3e47))
|
|
202
|
+
* **BaseController:** Fix lint and activate install again after creation ([8697b1b](https://github.com/SAP/generator-easy-ui5/commit/8697b1bdbcc3f82bb8eb5f0e9e750b37f0d44d8f))
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## [1.3.1](https://github.com/SAP/generator-easy-ui5/compare/v1.3.0...v1.3.1) (2020-03-20)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
# [1.3.0](https://github.com/SAP/generator-easy-ui5/compare/v1.2.0...v1.3.0) (2020-03-11)
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
# [1.2.0](https://github.com/SAP/generator-easy-ui5/compare/v1.1.1...v1.2.0) (2020-02-13)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
## [1.1.1](https://github.com/SAP/generator-easy-ui5/compare/v1.0.3...v1.1.1) (2019-12-13)
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## [1.0.3](https://github.com/SAP/generator-easy-ui5/compare/v1.0.2...v1.0.3) (2019-12-04)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
## [1.0.2](https://github.com/SAP/generator-easy-ui5/compare/v1.0.1...v1.0.2) (2019-11-08)
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## [1.0.1](https://github.com/SAP/generator-easy-ui5/compare/v1.0.0...v1.0.1) (2019-11-06)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
# [1.0.0](https://github.com/SAP/generator-easy-ui5/compare/v0.3.4...v1.0.0) (2019-10-30)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
## [0.3.4](https://github.com/SAP/generator-easy-ui5/compare/v0.3.3...v0.3.4) (2019-10-24)
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
## [0.3.3](https://github.com/SAP/generator-easy-ui5/compare/v0.3.2...v0.3.3) (2019-10-23)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
## [0.3.2](https://github.com/SAP/generator-easy-ui5/compare/v0.3.1...v0.3.2) (2019-10-23)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
## [0.3.1](https://github.com/SAP/generator-easy-ui5/compare/v2.0.2...v0.3.1) (2019-10-23)
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
package/README.md
CHANGED
|
@@ -8,12 +8,16 @@
|
|
|
8
8
|
|
|
9
9
|
## Description
|
|
10
10
|
|
|
11
|
-
Easy-ui5 is a [Yeoman](http://yeoman.io/) generator which enables you to create simple [SAPUI5](https://sapui5.hana.ondemand.com/)/[OpenUI5](https://openui5.hana.ondemand.com/)-based web-apps and other UI5-related projects within seconds.
|
|
11
|
+
Easy-ui5 💙 is a [Yeoman](http://yeoman.io/) generator which enables you to create simple [SAPUI5](https://sapui5.hana.ondemand.com/)/[OpenUI5](https://openui5.hana.ondemand.com/)-based web-apps and other UI5-related projects within seconds.
|
|
12
12
|
|
|
13
13
|
This generator has been created to simplify the creation of your UI5 prototypes. Now you can scaffold simple UI5 projects from the shell/terminal of your choice. The current best practices (such as [async](https://blogs.sap.com/2018/12/18/ui5ers-buzz-41-best-practices-for-async-loading-in-ui5/)) are already baked into our templates so you don't have to worry about the definition of the metadata files.
|
|
14
14
|
|
|
15
15
|
The purpose of this generator is to guide you on your first steps with [SAPUI5](https://sapui5.hana.ondemand.com/) and [SAP BTP](https://www.sap.com/products/business-technology-platform.html) deployments. Once you are familiar with those technologies, you might want to tweak the projects to adapt them for productive use-cases (such as continuous deployment pipelines and full i18n).
|
|
16
16
|
|
|
17
|
+
> Starting with easy-ui5 v3, all templates will be outsource to repositories in the [UI5 Community](https://github.com/ui5-community/). This project is from now on a shell that will offer all generators hosted on that GitHub org. Easy-ui5 will download and install these repositories when needed.
|
|
18
|
+
>
|
|
19
|
+
> By default, it will download the repository [generator-ui5-project](https://github.com/ui5-community/generator-ui5-project/) which contains the templates that were previously integrated in easy-ui5 < 3.
|
|
20
|
+
|
|
17
21
|
## Requirements
|
|
18
22
|
|
|
19
23
|
- Get [Node.js](https://nodejs.org/en/download/) (**version 12 or higher** ⚠️)
|
package/generators/app/index.js
CHANGED
|
@@ -14,34 +14,65 @@ const { throttling } = require("@octokit/plugin-throttling");
|
|
|
14
14
|
const MyOctokit = Octokit.plugin(throttling);
|
|
15
15
|
const AdmZip = require("adm-zip");
|
|
16
16
|
|
|
17
|
+
// helper to retrieve config entries from npm
|
|
18
|
+
// --> npm config set easy-ui5_addGhOrg XYZ
|
|
19
|
+
const NPM_CONFIG_PREFIX = "easy-ui5_";
|
|
20
|
+
let npmConfig;
|
|
21
|
+
const getNPMConfig = (configName) => {
|
|
22
|
+
if (!npmConfig) {
|
|
23
|
+
npmConfig = require("libnpmconfig").read();
|
|
24
|
+
}
|
|
25
|
+
return npmConfig && npmConfig[`${NPM_CONFIG_PREFIX}${configName}`]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// the command line options of the generator
|
|
17
29
|
const generatorOptions = {
|
|
18
30
|
ghAuthToken: {
|
|
19
31
|
type: String,
|
|
20
32
|
description:
|
|
21
|
-
|
|
33
|
+
"GitHub authToken to optionally access private generator repositories",
|
|
22
34
|
},
|
|
23
35
|
ghOrg: {
|
|
24
36
|
type: String,
|
|
25
|
-
description:
|
|
37
|
+
description: "GitHub organization to lookup for available generators",
|
|
26
38
|
default: "ui5-community",
|
|
27
|
-
|
|
39
|
+
hide: true // we don't want to recommend to use this option
|
|
40
|
+
},
|
|
41
|
+
subGeneratorPrefix: {
|
|
42
|
+
type: String,
|
|
43
|
+
description: "Prefix used for the lookup of the available generators",
|
|
44
|
+
default: "generator-ui5-",
|
|
45
|
+
hide: true // we don't want to recommend to use this option
|
|
46
|
+
},
|
|
47
|
+
addGhOrg: {
|
|
48
|
+
type: String,
|
|
49
|
+
description: `GitHub organization to lookup for additional available generators`,
|
|
50
|
+
hide: true, // we don't want to recommend to use this option
|
|
51
|
+
npmConfig: true
|
|
52
|
+
},
|
|
53
|
+
addSubGeneratorPrefix: {
|
|
54
|
+
type: String,
|
|
55
|
+
description: `Prefix used for the lookup of the additional available generators`,
|
|
56
|
+
default: "generator-",
|
|
57
|
+
hide: true, // we don't want to recommend to use this option
|
|
58
|
+
npmConfig: true
|
|
28
59
|
},
|
|
29
60
|
list: {
|
|
30
61
|
type: Boolean,
|
|
31
|
-
description:
|
|
62
|
+
description: "List the available subcommands of the generator",
|
|
32
63
|
},
|
|
33
64
|
verbose: {
|
|
34
65
|
type: Boolean,
|
|
35
|
-
description:
|
|
66
|
+
description: "Enable detailed logging",
|
|
36
67
|
},
|
|
37
68
|
skipUpdate: {
|
|
38
69
|
type: Boolean,
|
|
39
|
-
description:
|
|
70
|
+
description: "Skip the update of the plugin generators",
|
|
40
71
|
},
|
|
41
72
|
plugins: {
|
|
42
73
|
type: Boolean,
|
|
43
74
|
alias: "p",
|
|
44
|
-
description:
|
|
75
|
+
description: "Get detailed version information",
|
|
45
76
|
}
|
|
46
77
|
};
|
|
47
78
|
|
|
@@ -49,18 +80,21 @@ const generatorArgs = {
|
|
|
49
80
|
generator: {
|
|
50
81
|
type: String,
|
|
51
82
|
required: false,
|
|
52
|
-
description:
|
|
83
|
+
description: "Name of the generator to invoke (without the \"generator-ui5-\" prefix)",
|
|
53
84
|
},
|
|
54
85
|
subcommand: {
|
|
55
86
|
type: String,
|
|
56
87
|
required: false,
|
|
57
|
-
description:
|
|
88
|
+
description: "Name of the subcommand to invoke (without the \"generator:\" prefix)",
|
|
58
89
|
},
|
|
59
90
|
};
|
|
60
91
|
|
|
61
92
|
module.exports = class extends Generator {
|
|
62
93
|
constructor(args, opts) {
|
|
63
|
-
super(args, opts
|
|
94
|
+
super(args, opts, {
|
|
95
|
+
// disable the Yeoman 5 package-manager logic (auto install)!
|
|
96
|
+
customInstallTask: "disabled"
|
|
97
|
+
});
|
|
64
98
|
|
|
65
99
|
Object.keys(generatorArgs).forEach((argName) => {
|
|
66
100
|
// register the argument for being displayed in the help
|
|
@@ -68,19 +102,21 @@ module.exports = class extends Generator {
|
|
|
68
102
|
});
|
|
69
103
|
|
|
70
104
|
Object.keys(generatorOptions).forEach((optionName) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
105
|
+
const initialValue = this.options[optionName];
|
|
106
|
+
// register the option for being displayed in the help
|
|
107
|
+
this.option(optionName, generatorOptions[optionName]);
|
|
108
|
+
const defaultedValue = this.options[optionName];
|
|
109
|
+
if (generatorOptions[optionName].npmConfig) {
|
|
110
|
+
// if a value is set, use the set value (parameter has higher precedence than npm config)
|
|
111
|
+
// => this.option(...) applies the default value to this.options[...] used as last resort
|
|
112
|
+
this.options[optionName] = initialValue || getNPMConfig(optionName) || defaultedValue;
|
|
77
113
|
}
|
|
78
114
|
});
|
|
79
115
|
}
|
|
80
116
|
|
|
81
117
|
_showBusy(statusText) {
|
|
82
118
|
this._clearBusy();
|
|
83
|
-
const progressChars = [
|
|
119
|
+
const progressChars = ["\\", "|", "/", "-"];
|
|
84
120
|
let i = 0;
|
|
85
121
|
process.stdout.write(`\r${statusText} `);
|
|
86
122
|
this._busy = {
|
|
@@ -95,37 +131,58 @@ module.exports = class extends Generator {
|
|
|
95
131
|
_clearBusy(newLine) {
|
|
96
132
|
if (this._busy) {
|
|
97
133
|
clearInterval(this._busy.timer);
|
|
98
|
-
process.stdout.write(
|
|
134
|
+
process.stdout.write("\r".padEnd(this._busy.text.length + 3) + (newLine ? "\n" : ""));
|
|
99
135
|
delete this._busy;
|
|
100
136
|
}
|
|
101
137
|
}
|
|
102
138
|
|
|
103
139
|
async prompting() {
|
|
104
140
|
|
|
141
|
+
this.log(yosay(`Welcome to the ${chalk.red("easy-ui5")} generator!`));
|
|
142
|
+
|
|
143
|
+
const home = path.join(__dirname, "..", "..");
|
|
144
|
+
|
|
145
|
+
// check the permissions to Easy UI5s plugin directory which must
|
|
146
|
+
// allow read/write to install additional plugin generators
|
|
147
|
+
let pluginsHome = path.join(home, "plugin-generators");
|
|
148
|
+
try {
|
|
149
|
+
fs.accessSync(pluginsHome, fs.constants.R_OK | fs.constants.W_OK);
|
|
150
|
+
} catch (e) {
|
|
151
|
+
pluginsHome = path.join(require("os").homedir(), ".npm", "_generator-easy-ui5", "plugin-generators");
|
|
152
|
+
if (this.options.verbose) {
|
|
153
|
+
console.error(`Plugin directory: ${chalk.green(pluginsHome)}`);
|
|
154
|
+
console.error(chalk.red(e.message));
|
|
155
|
+
}
|
|
156
|
+
fs.mkdirSync(pluginsHome, { recursive: true });
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// log the plugins and configuration
|
|
105
160
|
if (this.options.plugins) {
|
|
106
161
|
const glob = require("glob");
|
|
107
162
|
const yeoman = require("yeoman-environment/package.json");
|
|
108
|
-
const home = __dirname.slice(0, -14)
|
|
109
163
|
|
|
110
164
|
const components = {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"
|
|
165
|
+
"Node.js": process.version,
|
|
166
|
+
"yeoman-environment": yeoman.version,
|
|
167
|
+
"generator-easy-ui5": require(path.join(home, "package.json")).version,
|
|
168
|
+
"home": home,
|
|
169
|
+
"pluginsHome": pluginsHome,
|
|
114
170
|
};
|
|
115
|
-
|
|
116
|
-
|
|
171
|
+
|
|
172
|
+
Object.keys(components).forEach((component) => {
|
|
173
|
+
this.log(`${chalk.green(component)}: ${components[component]}`);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
this.log(chalk.green("\nAvailable generators:"));
|
|
177
|
+
glob.sync(`${pluginsHome}/*/package.json`).forEach((plugin) => {
|
|
178
|
+
const name = plugin.match(/.*\/(.+)\/package\.json/)[1];
|
|
117
179
|
const lib = require(plugin);
|
|
118
|
-
|
|
180
|
+
this.log(` - ${chalk.green(name)}: ${lib.version}`);
|
|
119
181
|
});
|
|
120
182
|
|
|
121
|
-
|
|
122
|
-
return Object.keys(components).forEach(function (component) {
|
|
123
|
-
log(`${chalk.green(component)}: ${components[component]}`);
|
|
124
|
-
})
|
|
183
|
+
return;
|
|
125
184
|
}
|
|
126
185
|
|
|
127
|
-
this.log(yosay(`Welcome to the ${chalk.red("easy-ui5")} generator!`));
|
|
128
|
-
|
|
129
186
|
// create the octokit client to retrieve the generators from GH org
|
|
130
187
|
const octokit = new MyOctokit({
|
|
131
188
|
userAgent: `${this.rootGeneratorName()}:${this.rootGeneratorVersion()}`,
|
|
@@ -142,7 +199,7 @@ module.exports = class extends Generator {
|
|
|
142
199
|
return true;
|
|
143
200
|
}
|
|
144
201
|
},
|
|
145
|
-
onAbuseLimit: (
|
|
202
|
+
onAbuseLimit: () => {
|
|
146
203
|
// does not retry, only logs a warning
|
|
147
204
|
this.log(
|
|
148
205
|
`${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\` `
|
|
@@ -152,19 +209,68 @@ module.exports = class extends Generator {
|
|
|
152
209
|
}
|
|
153
210
|
});
|
|
154
211
|
|
|
212
|
+
// helper for filtering repos with corresponding subGenerator prefix
|
|
213
|
+
const filterReposWithSubGeneratorPrefix = (repos, subGeneratorPrefix) => {
|
|
214
|
+
if (!Array.isArray(repos)) {
|
|
215
|
+
return [];
|
|
216
|
+
}
|
|
217
|
+
return repos.filter((repo) =>
|
|
218
|
+
repo.name.startsWith(`${subGeneratorPrefix}`)
|
|
219
|
+
).map((repo) => {
|
|
220
|
+
return {
|
|
221
|
+
org: repo.owner?.login,
|
|
222
|
+
name: repo.name,
|
|
223
|
+
branch: repo.default_branch,
|
|
224
|
+
subGeneratorName: repo.name.substring(subGeneratorPrefix.length),
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// helper to retrieve the available repositories for a GH org
|
|
230
|
+
const listGeneratorsForOrg = async (ghOrg, subGeneratorPrefix) => {
|
|
231
|
+
const response = await octokit.repos.listForOrg({
|
|
232
|
+
org: ghOrg,
|
|
233
|
+
});
|
|
234
|
+
return filterReposWithSubGeneratorPrefix(response?.data, subGeneratorPrefix);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// helper to retrieve the available repositories for a GH user
|
|
238
|
+
const listGeneratorsForUser = async (ghUser, subGeneratorPrefix) => {
|
|
239
|
+
const response = await octokit.repos.listForUser({
|
|
240
|
+
username: ghUser,
|
|
241
|
+
});
|
|
242
|
+
return filterReposWithSubGeneratorPrefix(response?.data, subGeneratorPrefix);
|
|
243
|
+
}
|
|
244
|
+
|
|
155
245
|
// retrieve the available repositories
|
|
156
|
-
let
|
|
246
|
+
let availGenerators;
|
|
157
247
|
try {
|
|
158
|
-
|
|
159
|
-
org: this.options.ghOrg,
|
|
160
|
-
});
|
|
248
|
+
availGenerators = await listGeneratorsForOrg(this.options.ghOrg, this.options.subGeneratorPrefix);
|
|
161
249
|
} catch (e) {
|
|
162
|
-
console.error(`Failed to connect to GitHub to retrieve available
|
|
250
|
+
console.error(`Failed to connect to GitHub to retrieve available generators for "${this.options.ghOrg}" organization! Run with --verbose for details!`);
|
|
163
251
|
if (this.options.verbose) {
|
|
164
252
|
console.error(e);
|
|
165
253
|
}
|
|
166
254
|
return;
|
|
167
255
|
}
|
|
256
|
+
try {
|
|
257
|
+
if (this.options.addGhOrg && this.options.addSubGeneratorPrefix) {
|
|
258
|
+
availGenerators = availGenerators.concat(await listGeneratorsForOrg(this.options.addGhOrg, this.options.addSubGeneratorPrefix));
|
|
259
|
+
}
|
|
260
|
+
} catch (e) {
|
|
261
|
+
if (this.options.verbose) {
|
|
262
|
+
this.log(`Failed to connect to GitHub retrieve additional generators for "${this.options.addGhOrg}" organization! Try to retrieve for user...`);
|
|
263
|
+
}
|
|
264
|
+
try {
|
|
265
|
+
availGenerators = availGenerators.concat(await listGeneratorsForUser(this.options.addGhOrg, this.options.addSubGeneratorPrefix));
|
|
266
|
+
} catch (e) {
|
|
267
|
+
console.error(`Failed to connect to GitHub to retrieve additional generators for organization or user "${this.options.addGhOrg}"! Run with --verbose for details!`);
|
|
268
|
+
if (this.options.verbose) {
|
|
269
|
+
console.error(e);
|
|
270
|
+
}
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
168
274
|
|
|
169
275
|
// download the generator from GH (or the test generator)
|
|
170
276
|
let generatorPath;
|
|
@@ -176,11 +282,9 @@ module.exports = class extends Generator {
|
|
|
176
282
|
} else {
|
|
177
283
|
|
|
178
284
|
// check for provided generator being available on GH
|
|
179
|
-
let generator =
|
|
180
|
-
this.options.generator
|
|
181
|
-
|
|
182
|
-
(repo) => repo.name === `generator-ui5-${this.options.generator}`
|
|
183
|
-
);
|
|
285
|
+
let generator = this.options.generator && availGenerators.find((repo) =>
|
|
286
|
+
repo.subGeneratorName === this.options.generator
|
|
287
|
+
);
|
|
184
288
|
|
|
185
289
|
// if no generator is provided and doesn't exist, ask for generator name
|
|
186
290
|
if (!generator) {
|
|
@@ -191,37 +295,35 @@ module.exports = class extends Generator {
|
|
|
191
295
|
)} was not found. Please select an existing generator!`
|
|
192
296
|
);
|
|
193
297
|
}
|
|
194
|
-
|
|
195
|
-
/^generator-ui5-.+/.test(repo.name)
|
|
196
|
-
);
|
|
298
|
+
|
|
197
299
|
const generatorIdx = (
|
|
198
300
|
await this.prompt([
|
|
199
301
|
{
|
|
200
302
|
type: "list",
|
|
201
303
|
name: "generator",
|
|
202
304
|
message: "Select your generator?",
|
|
203
|
-
choices:
|
|
204
|
-
name:
|
|
305
|
+
choices: availGenerators.map((availGenerator, idx) => ({
|
|
306
|
+
name: `${availGenerator.subGeneratorName}${this.options.addGhOrg ? ` [${availGenerator.org}]` : ""}`,
|
|
205
307
|
value: idx,
|
|
206
308
|
})),
|
|
207
309
|
},
|
|
208
310
|
])
|
|
209
311
|
).generator;
|
|
210
|
-
generator =
|
|
312
|
+
generator = availGenerators[generatorIdx];
|
|
211
313
|
}
|
|
212
314
|
|
|
213
315
|
// fetch the available branches to retrieve the latest commit SHA
|
|
214
316
|
let reqBranch;
|
|
215
317
|
try {
|
|
216
318
|
reqBranch = await octokit.repos.getBranch({
|
|
217
|
-
owner:
|
|
319
|
+
owner: generator.org,
|
|
218
320
|
repo: generator.name,
|
|
219
|
-
branch: generator.
|
|
321
|
+
branch: generator.branch,
|
|
220
322
|
});
|
|
221
323
|
} catch (e) {
|
|
222
|
-
console.error(`Failed to retrieve the default branch for repository "${generator.name}" for "${this.options.ghOrg}" organization! Run with --verbose for details!`);
|
|
324
|
+
console.error(chalk.red(`Failed to retrieve the default branch for repository "${generator.name}" for "${this.options.ghOrg}" organization! Run with --verbose for details!`));
|
|
223
325
|
if (this.options.verbose) {
|
|
224
|
-
console.error(e);
|
|
326
|
+
console.error(chalk.red(e.message));
|
|
225
327
|
}
|
|
226
328
|
return;
|
|
227
329
|
}
|
|
@@ -233,14 +335,10 @@ module.exports = class extends Generator {
|
|
|
233
335
|
`Using commit ${commitSHA} from @${this.options.ghOrg}/${generator.name}#${generator.default_branch}...`
|
|
234
336
|
);
|
|
235
337
|
}
|
|
236
|
-
generatorPath = path.join(
|
|
237
|
-
__dirname,
|
|
238
|
-
"../../plugin-generators",
|
|
239
|
-
generator.name
|
|
240
|
-
);
|
|
338
|
+
generatorPath = path.join(pluginsHome, generator.name);
|
|
241
339
|
const shaMarker = path.join(generatorPath, `.${commitSHA}`);
|
|
242
340
|
|
|
243
|
-
if (fs.existsSync(generatorPath) && this.options.skipUpdate) {
|
|
341
|
+
if (fs.existsSync(generatorPath) && !this.options.skipUpdate) {
|
|
244
342
|
// check if the SHA marker exists to know whether the generator is up-to-date or not
|
|
245
343
|
if (!fs.existsSync(shaMarker)) {
|
|
246
344
|
if (this.options.verbose) {
|
|
@@ -259,7 +357,7 @@ module.exports = class extends Generator {
|
|
|
259
357
|
}
|
|
260
358
|
this._showBusy(` Downloading and extracting "${generator.name}" templates`);
|
|
261
359
|
const reqZIPArchive = await octokit.repos.downloadZipballArchive({
|
|
262
|
-
owner:
|
|
360
|
+
owner: generator.org,
|
|
263
361
|
repo: generator.name,
|
|
264
362
|
ref: commitSHA,
|
|
265
363
|
});
|
|
@@ -294,9 +392,9 @@ module.exports = class extends Generator {
|
|
|
294
392
|
...process.env,
|
|
295
393
|
"NO_UPDATE_NOTIFIER": true
|
|
296
394
|
}
|
|
297
|
-
}).on(
|
|
395
|
+
}).on("exit", function (code) {
|
|
298
396
|
resolve(code);
|
|
299
|
-
}).on(
|
|
397
|
+
}).on("error", function (err) {
|
|
300
398
|
reject(err);
|
|
301
399
|
});
|
|
302
400
|
}.bind(this));
|
|
@@ -371,7 +469,7 @@ module.exports = class extends Generator {
|
|
|
371
469
|
}
|
|
372
470
|
}
|
|
373
471
|
|
|
374
|
-
// transform the list of the subgenerators and identify the
|
|
472
|
+
// transform the list of the subgenerators and identify the
|
|
375
473
|
// default subgenerator for the default selection
|
|
376
474
|
let defaultSubGenerator;
|
|
377
475
|
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.2.1",
|
|
4
4
|
"description": "Generator for UI5-based project",
|
|
5
5
|
"main": "generators/app/index.js",
|
|
6
6
|
"files": [
|
|
@@ -9,12 +9,15 @@
|
|
|
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",
|
|
16
16
|
"startSubGen": "yo easy-ui5 project app",
|
|
17
|
-
"workaround": "find . -name '.DS_Store' -delete"
|
|
17
|
+
"workaround": "find . -name '.DS_Store' -delete",
|
|
18
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
19
|
+
"prepare": "husky install",
|
|
20
|
+
"hooks:commit-msg": "commitlint -e"
|
|
18
21
|
},
|
|
19
22
|
"repository": {
|
|
20
23
|
"type": "git",
|
|
@@ -40,18 +43,34 @@
|
|
|
40
43
|
"@octokit/rest": "^18.12.0",
|
|
41
44
|
"adm-zip": "^0.5.9",
|
|
42
45
|
"chalk": "^4.1.2",
|
|
43
|
-
"colors": "
|
|
46
|
+
"colors": "1.4.0",
|
|
44
47
|
"glob": "^7.2.0",
|
|
45
|
-
"
|
|
48
|
+
"libnpmconfig": "^1.2.1",
|
|
49
|
+
"mocha": "^9.2.0",
|
|
46
50
|
"rimraf": "^3.0.2",
|
|
47
51
|
"yarn-or-npm": "^3.0.1",
|
|
48
52
|
"yeoman-assert": "^3.1.1",
|
|
49
|
-
"yeoman-environment": "^3.
|
|
50
|
-
"yeoman-generator": "^5.
|
|
51
|
-
"yeoman-test": "^6.
|
|
53
|
+
"yeoman-environment": "^3.9.1",
|
|
54
|
+
"yeoman-generator": "^5.6.1",
|
|
55
|
+
"yeoman-test": "^6.3.0",
|
|
52
56
|
"yosay": "^2.0.2"
|
|
53
57
|
},
|
|
54
58
|
"devDependencies": {
|
|
55
|
-
"
|
|
59
|
+
"@commitlint/cli": "16.1.0",
|
|
60
|
+
"@commitlint/config-conventional": "16.0.0",
|
|
61
|
+
"conventional-changelog-cli": "^2.2.2",
|
|
62
|
+
"cz-conventional-changelog": "3.3.0",
|
|
63
|
+
"husky": "^7.0.4",
|
|
64
|
+
"prettier": "2.5.1"
|
|
65
|
+
},
|
|
66
|
+
"config": {
|
|
67
|
+
"commitizen": {
|
|
68
|
+
"path": "cz-conventional-changelog"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"commitlint": {
|
|
72
|
+
"extends": [
|
|
73
|
+
"@commitlint/config-conventional"
|
|
74
|
+
]
|
|
56
75
|
}
|
|
57
76
|
}
|