pob 19.2.0 → 21.0.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/lib/generators/app/PobAppGenerator.js +124 -122
  3. package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +11 -11
  4. package/lib/generators/app/ignorePaths.js +25 -24
  5. package/lib/generators/app/nextjs/AppNextjsGenerator.js +9 -9
  6. package/lib/generators/app/remix/AppRemixGenerator.js +7 -7
  7. package/lib/generators/common/babel/CommonBabelGenerator.js +167 -151
  8. package/lib/generators/common/format-lint/CommonLintGenerator.js +185 -180
  9. package/lib/generators/common/format-lint/updateEslintConfig.js +9 -9
  10. package/lib/generators/common/husky/CommonHuskyGenerator.js +44 -44
  11. package/lib/generators/common/husky/templates/lint-staged.config.js.txt +1 -1
  12. package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +44 -44
  13. package/lib/generators/common/release/CommonReleaseGenerator.js +40 -39
  14. package/lib/generators/common/release/templates/workflow-release.yml.ejs +2 -2
  15. package/lib/generators/common/testing/CommonTestingGenerator.js +193 -191
  16. package/lib/generators/common/testing/templates/index.js +3 -3
  17. package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +160 -167
  18. package/lib/generators/common/typescript/CommonTypescriptGenerator.js +79 -75
  19. package/lib/generators/core/ci/CoreCIGenerator.js +70 -75
  20. package/lib/generators/core/clean/CoreCleanGenerator.js +4 -4
  21. package/lib/generators/core/editorconfig/CoreEditorConfigGenerator.js +3 -3
  22. package/lib/generators/core/git/CoreGitGenerator.js +42 -42
  23. package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +41 -41
  24. package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +19 -23
  25. package/lib/generators/core/npm/CoreNpmGenerator.js +19 -19
  26. package/lib/generators/core/package/CorePackageGenerator.js +94 -94
  27. package/lib/generators/core/package/askName.js +4 -4
  28. package/lib/generators/core/renovate/CoreRenovateGenerator.js +26 -26
  29. package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +5 -5
  30. package/lib/generators/core/vscode/CoreVSCodeGenerator.js +39 -38
  31. package/lib/generators/core/yarn/CoreYarnGenerator.js +82 -77
  32. package/lib/generators/lib/PobLibGenerator.js +127 -125
  33. package/lib/generators/lib/doc/LibDocGenerator.js +40 -40
  34. package/lib/generators/lib/readme/LibReadmeGenerator.js +19 -19
  35. package/lib/generators/monorepo/PobMonorepoGenerator.js +87 -86
  36. package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +44 -40
  37. package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +35 -35
  38. package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +60 -56
  39. package/lib/generators/pob/PobBaseGenerator.js +83 -83
  40. package/lib/pob-dirname.cjs +1 -1
  41. package/lib/pob.js +112 -112
  42. package/lib/utils/dependenciesPackages.cjs +4 -4
  43. package/lib/utils/ensureJsonFileFormatted.js +5 -5
  44. package/lib/utils/inMonorepo.js +8 -8
  45. package/lib/utils/json5.js +1 -1
  46. package/lib/utils/package.js +37 -37
  47. package/lib/utils/packagejson.js +5 -0
  48. package/lib/utils/writeAndFormat.js +8 -9
  49. package/package.json +23 -19
  50. package/lib/utils/packagejson.cjs +0 -3
@@ -1,51 +1,51 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import Generator from 'yeoman-generator';
4
- import inMonorepo from '../../../utils/inMonorepo.js';
5
- import * as packageUtils from '../../../utils/package.js';
6
- import { askName } from './askName.js';
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import Generator from "yeoman-generator";
4
+ import inMonorepo from "../../../utils/inMonorepo.js";
5
+ import * as packageUtils from "../../../utils/package.js";
6
+ import { askName } from "./askName.js";
7
7
 
8
8
  export default class CorePackageGenerator extends Generator {
9
9
  constructor(args, opts) {
10
10
  super(args, opts);
11
11
 
12
- this.option('isMonorepo', {
12
+ this.option("isMonorepo", {
13
13
  type: Boolean,
14
14
  required: true,
15
15
  default: false,
16
- desc: 'is monorepo',
16
+ description: "is monorepo",
17
17
  });
18
18
 
19
- this.option('inMonorepo', {
19
+ this.option("inMonorepo", {
20
20
  type: Boolean,
21
21
  required: true,
22
22
  default: false,
23
- desc: 'in monorepo',
23
+ description: "in monorepo",
24
24
  });
25
25
 
26
- this.option('isRoot', {
26
+ this.option("isRoot", {
27
27
  type: Boolean,
28
28
  required: true,
29
29
  default: false,
30
- desc: 'is root',
30
+ description: "is root",
31
31
  });
32
32
 
33
- this.option('private', {
33
+ this.option("private", {
34
34
  type: Boolean,
35
35
  required: false,
36
36
  default: false,
37
- desc: 'private package',
37
+ description: "private package",
38
38
  });
39
39
 
40
- this.option('packageType', {
40
+ this.option("packageType", {
41
41
  type: String,
42
42
  required: false,
43
- desc: 'package type',
43
+ description: "package type",
44
44
  });
45
45
  }
46
46
 
47
47
  async initializing() {
48
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
48
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
49
49
 
50
50
  if (!pkg.engines) pkg.engines = {};
51
51
 
@@ -53,13 +53,13 @@ export default class CorePackageGenerator extends Generator {
53
53
  if (
54
54
  !pkg.engines.node ||
55
55
  !(
56
- pkg.engines.node.startsWith('>=20.') &&
57
- pkg.engines.node.startsWith('>=18.') &&
58
- pkg.engines.node !== '>=18.0.0'
56
+ pkg.engines.node.startsWith(">=20.") &&
57
+ pkg.engines.node.startsWith(">=18.") &&
58
+ pkg.engines.node !== ">=18.0.0"
59
59
  )
60
60
  ) {
61
61
  // this might be overridden by babel generator
62
- pkg.engines.node = '>=18.12.0'; // .12.0 is the first lts node 18 version
62
+ pkg.engines.node = ">=18.12.0"; // .12.0 is the first lts node 18 version
63
63
  }
64
64
 
65
65
  if (!this.options.isRoot) {
@@ -73,9 +73,9 @@ export default class CorePackageGenerator extends Generator {
73
73
  pkg.private = true;
74
74
  } else {
75
75
  const { isPrivate } = await this.prompt({
76
- type: 'confirm',
77
- name: 'isPrivate',
78
- message: 'Private package ?',
76
+ type: "confirm",
77
+ name: "isPrivate",
78
+ message: "Private package ?",
79
79
  default: pkg.private === true,
80
80
  });
81
81
  if (isPrivate) {
@@ -89,19 +89,19 @@ export default class CorePackageGenerator extends Generator {
89
89
  if (this.options.isMonorepo && this.options.isRoot) {
90
90
  if (!pkg.name) {
91
91
  const { name } = await this.prompt({
92
- name: 'name',
93
- message: 'Monorepo Name',
92
+ name: "name",
93
+ message: "Monorepo Name",
94
94
  default: path.basename(process.cwd()),
95
95
  validate: (str) => str.length > 0,
96
96
  });
97
97
  pkg.name = name;
98
- } else if (pkg.name.endsWith('-lerna')) {
99
- pkg.name = pkg.name.replace('-lerna', '-monorepo');
98
+ } else if (pkg.name.endsWith("-lerna")) {
99
+ pkg.name = pkg.name.replace("-lerna", "-monorepo");
100
100
  }
101
101
  } else if (!pkg.name) {
102
102
  const prompt = {
103
- name: 'name',
104
- message: 'Module Name',
103
+ name: "name",
104
+ message: "Module Name",
105
105
  default: path.basename(process.cwd()),
106
106
  validate: (str) => str.length > 0,
107
107
  };
@@ -122,39 +122,39 @@ export default class CorePackageGenerator extends Generator {
122
122
  [
123
123
  !this.options.updateOnly &&
124
124
  !(this.options.isMonorepo && this.options.isRoot) && {
125
- name: 'description',
126
- message: 'Description',
125
+ name: "description",
126
+ message: "Description",
127
127
  default: pkg.description,
128
128
  },
129
129
  {
130
- name: 'authorName',
130
+ name: "authorName",
131
131
  message: "Author's Name",
132
132
  when: !pkg.authors && (!author || !author.name),
133
- default: this.git.name(),
133
+ default: await this.git.name(),
134
134
  },
135
135
  {
136
- name: 'authorEmail',
136
+ name: "authorEmail",
137
137
  message: "Author's Email",
138
138
  when: !pkg.authors && (!author || !author.email),
139
- default: this.git.email(),
139
+ default: await this.git.email(),
140
140
  },
141
141
  {
142
- name: 'authorUrl',
142
+ name: "authorUrl",
143
143
  message: "Author's Homepage",
144
144
  when: !pkg.authors && (!author || !author.url),
145
145
  },
146
146
  {
147
- name: 'type',
148
- message: 'Package Type',
149
- type: 'list',
150
- choices: ['commonjs', 'module'],
147
+ name: "type",
148
+ message: "Package Type",
149
+ type: "list",
150
+ choices: ["commonjs", "module"],
151
151
  when: !pkg.type,
152
152
  },
153
153
  {
154
- name: 'license',
155
- message: 'License Type',
156
- type: 'list',
157
- choices: ['MIT', 'ISC', 'UNLICENSED'],
154
+ name: "license",
155
+ message: "License Type",
156
+ type: "list",
157
+ choices: ["MIT", "ISC", "UNLICENSED"],
158
158
  when: !pkg.license,
159
159
  },
160
160
  ].filter(Boolean),
@@ -164,9 +164,9 @@ export default class CorePackageGenerator extends Generator {
164
164
  if (
165
165
  inMonorepo &&
166
166
  !inMonorepo.root &&
167
- inMonorepo.rootMonorepoPkg.type === 'module'
167
+ inMonorepo.rootMonorepoPkg.type === "module"
168
168
  ) {
169
- pkg.type = 'module';
169
+ pkg.type = "module";
170
170
  }
171
171
 
172
172
  pkg.description = this.options.updateOnly
@@ -176,46 +176,46 @@ export default class CorePackageGenerator extends Generator {
176
176
  if (this.options.inMonorepo && !this.options.isRoot) {
177
177
  const rootMonorepoPkg = inMonorepo.rootMonorepoPkg;
178
178
  const rootRepositoryUrl =
179
- typeof rootMonorepoPkg.repository === 'string'
179
+ typeof rootMonorepoPkg.repository === "string"
180
180
  ? rootMonorepoPkg.repository
181
181
  : rootMonorepoPkg.repository.url;
182
182
  pkg.repository = {
183
- type: 'git',
183
+ type: "git",
184
184
  url: rootRepositoryUrl,
185
185
  directory: process.cwd().slice(inMonorepo.rootPath.length + 1),
186
186
  };
187
187
  pkg.homepage = rootMonorepoPkg.homepage;
188
188
 
189
- if (this.fs.exists(this.destinationPath('yarn.lock'))) {
190
- fs.unlinkSync(this.destinationPath('yarn.lock'));
189
+ if (this.fs.exists(this.destinationPath("yarn.lock"))) {
190
+ fs.unlinkSync(this.destinationPath("yarn.lock"));
191
191
  }
192
192
  }
193
- if (this.fs.exists(this.destinationPath('yarn-error.log'))) {
194
- fs.unlinkSync(this.destinationPath('yarn-error.log'));
193
+ if (this.fs.exists(this.destinationPath("yarn-error.log"))) {
194
+ fs.unlinkSync(this.destinationPath("yarn-error.log"));
195
195
  }
196
196
 
197
197
  if (this.options.inMonorepo && !this.options.isRoot) {
198
- packageUtils.removeScripts(pkg, ['checks']);
199
- packageUtils.removeDevDependencies(pkg, ['check-package-dependencies']);
198
+ packageUtils.removeScripts(pkg, ["checks"]);
199
+ packageUtils.removeDevDependencies(pkg, ["check-package-dependencies"]);
200
200
  } else if (this.options.isMonorepo && this.options.isRoot) {
201
201
  const doesMjsCheckPackagesExists = this.fs.exists(
202
- this.destinationPath('scripts/check-packages.mjs'),
202
+ this.destinationPath("scripts/check-packages.mjs"),
203
203
  );
204
204
  let doesJsCheckPackagesExists = this.fs.exists(
205
- this.destinationPath('scripts/check-packages.js'),
205
+ this.destinationPath("scripts/check-packages.js"),
206
206
  );
207
207
 
208
- if (pkg.type === 'module' && !doesJsCheckPackagesExists) {
208
+ if (pkg.type === "module" && !doesJsCheckPackagesExists) {
209
209
  doesJsCheckPackagesExists = true;
210
210
  this.fs.copyTpl(
211
- this.templatePath('check-packages.js.ejs'),
212
- this.destinationPath('scripts/check-packages.js'),
211
+ this.templatePath("check-packages.js.ejs"),
212
+ this.destinationPath("scripts/check-packages.js"),
213
213
  {},
214
214
  );
215
215
  }
216
216
 
217
217
  if (doesJsCheckPackagesExists || doesMjsCheckPackagesExists) {
218
- packageUtils.addDevDependencies(pkg, ['check-package-dependencies']);
218
+ packageUtils.addDevDependencies(pkg, ["check-package-dependencies"]);
219
219
  }
220
220
 
221
221
  packageUtils.addOrRemoveScripts(
@@ -223,32 +223,32 @@ export default class CorePackageGenerator extends Generator {
223
223
  doesMjsCheckPackagesExists || doesJsCheckPackagesExists,
224
224
  {
225
225
  checks: `node scripts/check-packages.${
226
- doesMjsCheckPackagesExists ? 'mjs' : 'js'
226
+ doesMjsCheckPackagesExists ? "mjs" : "js"
227
227
  }`,
228
228
  },
229
229
  );
230
230
  } else if (inMonorepo && !inMonorepo.root) {
231
- if (this.fs.exists('scripts/check-package.js')) {
232
- this.fs.delete('scripts/check-package.js');
231
+ if (this.fs.exists("scripts/check-package.js")) {
232
+ this.fs.delete("scripts/check-package.js");
233
233
  }
234
- if (this.fs.exists('scripts/check-package.mjs')) {
235
- this.fs.delete('scripts/check-package.mjs');
234
+ if (this.fs.exists("scripts/check-package.mjs")) {
235
+ this.fs.delete("scripts/check-package.mjs");
236
236
  }
237
- packageUtils.removeScripts(pkg, ['checks']);
237
+ packageUtils.removeScripts(pkg, ["checks"]);
238
238
  } else {
239
239
  const doesMjsCheckPackageExists = this.fs.exists(
240
- this.destinationPath('scripts/check-package.mjs'),
240
+ this.destinationPath("scripts/check-package.mjs"),
241
241
  );
242
242
  let doesJsCheckPackageExists = this.fs.exists(
243
- this.destinationPath('scripts/check-package.js'),
243
+ this.destinationPath("scripts/check-package.js"),
244
244
  );
245
245
 
246
- if (pkg.type === 'module') {
246
+ if (pkg.type === "module") {
247
247
  if (!doesJsCheckPackageExists) {
248
248
  doesJsCheckPackageExists = true;
249
249
  this.fs.copyTpl(
250
- this.templatePath('check-package.js.ejs'),
251
- this.destinationPath('scripts/check-package.js'),
250
+ this.templatePath("check-package.js.ejs"),
251
+ this.destinationPath("scripts/check-package.js"),
252
252
  {
253
253
  isLibrary: pkg.private !== true,
254
254
  },
@@ -256,7 +256,7 @@ export default class CorePackageGenerator extends Generator {
256
256
  }
257
257
  }
258
258
  if (doesJsCheckPackageExists || doesMjsCheckPackageExists) {
259
- packageUtils.addDevDependencies(pkg, ['check-package-dependencies']);
259
+ packageUtils.addDevDependencies(pkg, ["check-package-dependencies"]);
260
260
  }
261
261
 
262
262
  packageUtils.addOrRemoveScripts(
@@ -264,7 +264,7 @@ export default class CorePackageGenerator extends Generator {
264
264
  doesMjsCheckPackageExists || doesJsCheckPackageExists,
265
265
  {
266
266
  checks: `node scripts/check-package.${
267
- doesMjsCheckPackageExists ? 'mjs' : 'js'
267
+ doesMjsCheckPackageExists ? "mjs" : "js"
268
268
  }`,
269
269
  },
270
270
  );
@@ -278,7 +278,7 @@ export default class CorePackageGenerator extends Generator {
278
278
  };
279
279
 
280
280
  pkg.author = `${author.name} <${author.email}>${
281
- author.url ? ` (${author.url})` : ''
281
+ author.url ? ` (${author.url})` : ""
282
282
  }`;
283
283
  }
284
284
 
@@ -286,7 +286,7 @@ export default class CorePackageGenerator extends Generator {
286
286
  pkg.license = props.license;
287
287
  this.fs.copyTpl(
288
288
  this.templatePath(`licenses/${props.license}.ejs`),
289
- this.destinationPath('LICENSE'),
289
+ this.destinationPath("LICENSE"),
290
290
  {
291
291
  year: new Date().getFullYear(),
292
292
  author: pkg.author,
@@ -303,58 +303,58 @@ export default class CorePackageGenerator extends Generator {
303
303
 
304
304
  if (!pkg.private && !pkg.version) {
305
305
  // lerna root pkg should not have version
306
- pkg.version = '0.0.0';
306
+ pkg.version = "0.0.0";
307
307
  }
308
308
 
309
- if (!pkg.private && !pkg.publishConfig && pkg.name[0] === '@') {
309
+ if (!pkg.private && !pkg.publishConfig && pkg.name[0] === "@") {
310
310
  pkg.publishConfig = {
311
- access: 'public',
311
+ access: "public",
312
312
  };
313
313
  }
314
314
 
315
- this.fs.writeJSON(this.destinationPath('package.json'), pkg);
315
+ this.fs.writeJSON(this.destinationPath("package.json"), pkg);
316
316
  }
317
317
 
318
318
  writing() {
319
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
319
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
320
320
  if (!pkg.scripts) pkg.scripts = {};
321
321
 
322
322
  const installPostinstallScript = (scriptName) => {
323
323
  if (
324
324
  !pkg.scripts[scriptName] ||
325
- !pkg.scripts[scriptName].includes('pob-root-postinstall')
325
+ !pkg.scripts[scriptName].includes("pob-root-postinstall")
326
326
  ) {
327
- pkg.scripts[scriptName] = 'pob-root-postinstall';
327
+ pkg.scripts[scriptName] = "pob-root-postinstall";
328
328
  }
329
329
  };
330
330
 
331
331
  const uninstallPostinstallScript = (scriptName) => {
332
332
  if (pkg.scripts && pkg.scripts[scriptName]) {
333
- if (pkg.scripts[scriptName] === 'pob-root-postinstall') {
333
+ if (pkg.scripts[scriptName] === "pob-root-postinstall") {
334
334
  delete pkg.scripts[scriptName];
335
335
  } else if (
336
- pkg.scripts[scriptName].startsWith('pob-root-postinstall && ')
336
+ pkg.scripts[scriptName].startsWith("pob-root-postinstall && ")
337
337
  ) {
338
338
  pkg.scripts[scriptName] = pkg.scripts[scriptName].slice(
339
- 'pob-root-postinstall && '.length - 1,
339
+ "pob-root-postinstall && ".length - 1,
340
340
  );
341
- } else if (pkg.scripts[scriptName].includes('pob-root-postinstall')) {
342
- throw new Error('Could not remove pob-root-postinstall');
341
+ } else if (pkg.scripts[scriptName].includes("pob-root-postinstall")) {
342
+ throw new Error("Could not remove pob-root-postinstall");
343
343
  }
344
344
  }
345
345
  };
346
346
  if (this.options.inMonorepo || inMonorepo || pkg.private) {
347
- uninstallPostinstallScript('postinstallDev');
347
+ uninstallPostinstallScript("postinstallDev");
348
348
  if (this.options.isRoot) {
349
- installPostinstallScript('postinstall');
349
+ installPostinstallScript("postinstall");
350
350
  } else {
351
- uninstallPostinstallScript('postinstall');
351
+ uninstallPostinstallScript("postinstall");
352
352
  }
353
353
  } else {
354
- uninstallPostinstallScript('postinstall');
355
- installPostinstallScript('postinstallDev');
354
+ uninstallPostinstallScript("postinstall");
355
+ installPostinstallScript("postinstallDev");
356
356
  }
357
357
 
358
- this.fs.writeJSON(this.destinationPath('package.json'), pkg);
358
+ this.fs.writeJSON(this.destinationPath("package.json"), pkg);
359
359
  }
360
360
  }
@@ -1,7 +1,7 @@
1
- import validatePackageName from 'validate-npm-package-name';
1
+ import validatePackageName from "validate-npm-package-name";
2
2
 
3
3
  const defaults = {
4
- message: 'Module Name',
4
+ message: "Module Name",
5
5
  validate() {
6
6
  return true;
7
7
  },
@@ -10,7 +10,7 @@ const defaults = {
10
10
  const ucFirst = (str) => str.charAt(0).toUpperCase() + str.slice(1);
11
11
 
12
12
  export const askName = (prompt, inquirer) => {
13
- if (typeof prompt === 'string') {
13
+ if (typeof prompt === "string") {
14
14
  prompt = {
15
15
  name: prompt,
16
16
  };
@@ -32,7 +32,7 @@ export const askName = (prompt, inquirer) => {
32
32
 
33
33
  return (
34
34
  ucFirst(packageNameValidity.errors[0]) ||
35
- 'The provided value is not a valid npm package name'
35
+ "The provided value is not a valid npm package name"
36
36
  );
37
37
  },
38
38
  },
@@ -1,41 +1,41 @@
1
- import Generator from 'yeoman-generator';
2
- import inMonorepo from '../../../utils/inMonorepo.js';
3
- import { writeAndFormatJson } from '../../../utils/writeAndFormat.js';
1
+ import Generator from "yeoman-generator";
2
+ import inMonorepo from "../../../utils/inMonorepo.js";
3
+ import { writeAndFormatJson } from "../../../utils/writeAndFormat.js";
4
4
 
5
5
  export default class CoreRenovateGenerator extends Generator {
6
6
  constructor(args, opts) {
7
7
  super(args, opts);
8
8
 
9
- this.option('disable', {
9
+ this.option("disable", {
10
10
  type: Boolean,
11
11
  required: false,
12
12
  default: false,
13
- desc: 'disable',
13
+ description: "disable",
14
14
  });
15
15
 
16
- this.option('app', {
16
+ this.option("app", {
17
17
  type: Boolean,
18
18
  required: false,
19
19
  default: false,
20
- desc: 'is app (instead of lib)',
20
+ description: "is app (instead of lib)",
21
21
  });
22
22
 
23
- this.option('updateOnly', {
23
+ this.option("updateOnly", {
24
24
  type: Boolean,
25
25
  required: false,
26
26
  default: false,
27
- desc: 'Avoid asking questions',
27
+ description: "Avoid asking questions",
28
28
  });
29
29
  }
30
30
 
31
31
  initializing() {
32
32
  if (inMonorepo && !inMonorepo.root) {
33
33
  this.enableRenovate = false;
34
- this.config.delete('renovate');
34
+ this.config.delete("renovate");
35
35
  return;
36
36
  }
37
37
 
38
- this.enableRenovateConfig = this.config.get('renovate');
38
+ this.enableRenovateConfig = this.config.get("renovate");
39
39
  }
40
40
 
41
41
  async prompting() {
@@ -49,45 +49,45 @@ export default class CoreRenovateGenerator extends Generator {
49
49
  }
50
50
 
51
51
  this.enableRenovateConfig = await this.prompt({
52
- type: 'confirm',
53
- name: 'enable',
54
- message: 'Enable renovate ?',
52
+ type: "confirm",
53
+ name: "enable",
54
+ message: "Enable renovate ?",
55
55
  });
56
- this.config.set('renovate', this.enableRenovateConfig);
56
+ this.config.set("renovate", this.enableRenovateConfig);
57
57
  this.enableRenovate = this.enableRenovateConfig.enable;
58
58
  }
59
59
 
60
60
  writing() {
61
61
  if (this.enableRenovate) {
62
- const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
62
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
63
63
  const renovateConfig = this.fs.readJSON(
64
- this.destinationPath('renovate.json'),
64
+ this.destinationPath("renovate.json"),
65
65
  {},
66
66
  );
67
67
 
68
68
  if (this.options.app) {
69
69
  renovateConfig.$schema =
70
- 'https://docs.renovatebot.com/renovate-schema.json';
70
+ "https://docs.renovatebot.com/renovate-schema.json";
71
71
  renovateConfig.extends = [
72
- 'config:js-app',
73
- 'github>christophehurpeau/renovate-presets',
72
+ "config:js-app",
73
+ "github>christophehurpeau/renovate-presets",
74
74
  ];
75
75
  } else {
76
76
  renovateConfig.extends = [
77
- 'config:js-lib',
78
- pkg.name === 'pob-monorepo'
77
+ "config:js-lib",
78
+ pkg.name === "pob-monorepo"
79
79
  ? undefined
80
- : 'github>christophehurpeau/renovate-presets',
80
+ : "github>christophehurpeau/renovate-presets",
81
81
  ].filter(Boolean);
82
82
  }
83
83
 
84
84
  writeAndFormatJson(
85
85
  this.fs,
86
- this.destinationPath('renovate.json'),
86
+ this.destinationPath("renovate.json"),
87
87
  renovateConfig,
88
88
  );
89
- } else if (this.fs.exists(this.destinationPath('renovate.json'))) {
90
- this.fs.delete(this.destinationPath('renovate.json'));
89
+ } else if (this.fs.exists(this.destinationPath("renovate.json"))) {
90
+ this.fs.delete(this.destinationPath("renovate.json"));
91
91
  }
92
92
  }
93
93
  }
@@ -1,13 +1,13 @@
1
- import Generator from 'yeoman-generator';
2
- import * as packageUtils from '../../../utils/package.js';
3
- import { writeAndFormatJson } from '../../../utils/writeAndFormat.js';
1
+ import Generator from "yeoman-generator";
2
+ import * as packageUtils from "../../../utils/package.js";
3
+ import { writeAndFormatJson } from "../../../utils/writeAndFormat.js";
4
4
 
5
5
  export default class CoreSortPackageGenerator extends Generator {
6
6
  writing() {
7
- const pkg = this.fs.readJSON(this.destinationPath('package.json'));
7
+ const pkg = this.fs.readJSON(this.destinationPath("package.json"));
8
8
  writeAndFormatJson(
9
9
  this.fs,
10
- this.destinationPath('package.json'),
10
+ this.destinationPath("package.json"),
11
11
  packageUtils.sort(pkg),
12
12
  );
13
13
  }