generator-easy-ui5 3.1.4 → 3.2.2

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 CHANGED
@@ -1,13 +1,253 @@
1
- ## 3.0.0 (2021-04-08)
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
- 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.
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
- NA
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** ⚠️)
@@ -14,6 +14,18 @@ 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,
@@ -24,7 +36,26 @@ const generatorOptions = {
24
36
  type: String,
25
37
  description: "GitHub organization to lookup for available generators",
26
38
  default: "ui5-community",
27
- hidden: true // we don't want to recommend to use this option
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,
@@ -71,12 +102,14 @@ module.exports = class extends Generator {
71
102
  });
72
103
 
73
104
  Object.keys(generatorOptions).forEach((optionName) => {
74
- if (!generatorOptions[optionName].hidden) {
75
- // register the option for being displayed in the help
76
- this.option(optionName, generatorOptions[optionName]);
77
- } else {
78
- // apply the default value for hidden options if needed
79
- this.options[optionName] = this.options[optionName] || generatorOptions[optionName].default;
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;
80
113
  }
81
114
  });
82
115
  }
@@ -105,30 +138,50 @@ module.exports = class extends Generator {
105
138
 
106
139
  async prompting() {
107
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
108
160
  if (this.options.plugins) {
109
161
  const glob = require("glob");
110
162
  const yeoman = require("yeoman-environment/package.json");
111
- const home = __dirname.slice(0, -14);
112
163
 
113
164
  const components = {
114
165
  "Node.js": process.version,
166
+ "yeoman-environment": yeoman.version,
167
+ "generator-easy-ui5": require(path.join(home, "package.json")).version,
115
168
  "home": home,
116
- "yeoman-environment": yeoman.version
169
+ "pluginsHome": pluginsHome,
117
170
  };
118
- glob.sync(path.join(home, "plugin-generators/*/package.json")).forEach(function (plugin) {
119
- const name = plugin.match(/plugin-generators\/(.+)\/package\.json/)[1];
120
- const lib = require(plugin);
121
- components[name] = lib.version;
171
+
172
+ Object.keys(components).forEach((component) => {
173
+ this.log(`${chalk.green(component)}: ${components[component]}`);
122
174
  });
123
175
 
124
- const log = this.log;
125
- return Object.keys(components).forEach(function (component) {
126
- log(`${chalk.green(component)}: ${components[component]}`);
176
+ this.log(chalk.green("\nAvailable generators:"));
177
+ glob.sync(`${pluginsHome}/*/package.json`).forEach((plugin) => {
178
+ const name = plugin.match(/.*\/(.+)\/package\.json/)[1];
179
+ const lib = require(plugin);
180
+ this.log(` - ${chalk.green(name)}: ${lib.version}`);
127
181
  });
128
- ;
129
- }
130
182
 
131
- this.log(yosay(`Welcome to the ${chalk.red("easy-ui5")} generator!`));
183
+ return;
184
+ }
132
185
 
133
186
  // create the octokit client to retrieve the generators from GH org
134
187
  const octokit = new MyOctokit({
@@ -156,19 +209,68 @@ module.exports = class extends Generator {
156
209
  }
157
210
  });
158
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
+
159
245
  // retrieve the available repositories
160
- let reqRepos;
246
+ let availGenerators;
161
247
  try {
162
- reqRepos = await octokit.repos.listForOrg({
163
- org: this.options.ghOrg,
164
- });
248
+ availGenerators = await listGeneratorsForOrg(this.options.ghOrg, this.options.subGeneratorPrefix);
165
249
  } catch (e) {
166
- console.error(`Failed to connect to GitHub to retrieve available repository for "${this.options.ghOrg}" organization! Run with --verbose for details!`);
250
+ console.error(`Failed to connect to GitHub to retrieve available generators for "${this.options.ghOrg}" organization! Run with --verbose for details!`);
167
251
  if (this.options.verbose) {
168
252
  console.error(e);
169
253
  }
170
254
  return;
171
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
+ }
172
274
 
173
275
  // download the generator from GH (or the test generator)
174
276
  let generatorPath;
@@ -180,11 +282,9 @@ module.exports = class extends Generator {
180
282
  } else {
181
283
 
182
284
  // check for provided generator being available on GH
183
- let generator =
184
- this.options.generator &&
185
- reqRepos.data.find(
186
- (repo) => repo.name === `generator-ui5-${this.options.generator}`
187
- );
285
+ let generator = this.options.generator && availGenerators.find((repo) =>
286
+ repo.subGeneratorName === this.options.generator
287
+ );
188
288
 
189
289
  // if no generator is provided and doesn't exist, ask for generator name
190
290
  if (!generator) {
@@ -195,37 +295,35 @@ module.exports = class extends Generator {
195
295
  )} was not found. Please select an existing generator!`
196
296
  );
197
297
  }
198
- const generatorRepos = reqRepos.data.filter((repo) =>
199
- /^generator-ui5-.+/.test(repo.name)
200
- );
298
+
201
299
  const generatorIdx = (
202
300
  await this.prompt([
203
301
  {
204
302
  type: "list",
205
303
  name: "generator",
206
304
  message: "Select your generator?",
207
- choices: generatorRepos.map((repo, idx) => ({
208
- name: repo.name,
305
+ choices: availGenerators.map((availGenerator, idx) => ({
306
+ name: `${availGenerator.subGeneratorName}${this.options.addGhOrg ? ` [${availGenerator.org}]` : ""}`,
209
307
  value: idx,
210
308
  })),
211
309
  },
212
310
  ])
213
311
  ).generator;
214
- generator = generatorRepos[generatorIdx];
312
+ generator = availGenerators[generatorIdx];
215
313
  }
216
314
 
217
315
  // fetch the available branches to retrieve the latest commit SHA
218
316
  let reqBranch;
219
317
  try {
220
318
  reqBranch = await octokit.repos.getBranch({
221
- owner: this.options.ghOrg,
319
+ owner: generator.org,
222
320
  repo: generator.name,
223
- branch: generator.default_branch,
321
+ branch: generator.branch,
224
322
  });
225
323
  } catch (e) {
226
- 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 "${generator.org}" organization! Run with --verbose for details!`));
227
325
  if (this.options.verbose) {
228
- console.error(e);
326
+ console.error(chalk.red(e.message));
229
327
  }
230
328
  return;
231
329
  }
@@ -234,17 +332,13 @@ module.exports = class extends Generator {
234
332
 
235
333
  if (this.options.verbose) {
236
334
  this.log(
237
- `Using commit ${commitSHA} from @${this.options.ghOrg}/${generator.name}#${generator.default_branch}...`
335
+ `Using commit ${commitSHA} from @${generator.org}/${generator.name}#${generator.default_branch}...`
238
336
  );
239
337
  }
240
- generatorPath = path.join(
241
- __dirname,
242
- "../../plugin-generators",
243
- generator.name
244
- );
338
+ generatorPath = path.join(pluginsHome, generator.name);
245
339
  const shaMarker = path.join(generatorPath, `.${commitSHA}`);
246
340
 
247
- if (fs.existsSync(generatorPath) && this.options.skipUpdate) {
341
+ if (fs.existsSync(generatorPath) && !this.options.skipUpdate) {
248
342
  // check if the SHA marker exists to know whether the generator is up-to-date or not
249
343
  if (!fs.existsSync(shaMarker)) {
250
344
  if (this.options.verbose) {
@@ -263,7 +357,7 @@ module.exports = class extends Generator {
263
357
  }
264
358
  this._showBusy(` Downloading and extracting "${generator.name}" templates`);
265
359
  const reqZIPArchive = await octokit.repos.downloadZipballArchive({
266
- owner: this.options.ghOrg,
360
+ owner: generator.org,
267
361
  repo: generator.name,
268
362
  ref: commitSHA,
269
363
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-easy-ui5",
3
- "version": "3.1.4",
3
+ "version": "3.2.2",
4
4
  "description": "Generator for UI5-based project",
5
5
  "main": "generators/app/index.js",
6
6
  "files": [
@@ -14,7 +14,10 @@
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": "^1.4.0",
46
+ "colors": "1.4.0",
44
47
  "glob": "^7.2.0",
45
- "mocha": "^9.1.3",
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.8.0",
50
- "yeoman-generator": "^5.4.2",
51
- "yeoman-test": "^6.2.0",
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
- "prettier": "2.4.1"
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
  }