pob 8.8.2 → 9.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,85 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [9.0.0](https://github.com/christophehurpeau/pob/compare/pob@8.10.1...pob@9.0.0) (2021-12-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **pob:** add try/catch arround build and generate:docs commands ([561f87f](https://github.com/christophehurpeau/pob/commit/561f87f75f2ec90480403432ea4a70090d9962ce))
12
+ * **pob:** dont add postinstallDev scripts in monorepo packages ([f993c13](https://github.com/christophehurpeau/pob/commit/f993c13670b6c1a537b2e5731987b407a25c4eb6))
13
+ * **pob:** missing clean script when using monorepo ([4a4ac95](https://github.com/christophehurpeau/pob/commit/4a4ac9527af1681606d80e2bf963364ecccb4e81))
14
+ * **pob:** use fs.exists before fs.delete ([b2640d1](https://github.com/christophehurpeau/pob/commit/b2640d1545411ffecb90bacd2ad400e19ea815f0))
15
+
16
+
17
+ ### Features
18
+
19
+ * drop node 12 ([2f32308](https://github.com/christophehurpeau/pob/commit/2f32308b06ca74d0deb3355707e3082fa73e25dc))
20
+ * **pob:** configure jest to enable esm by default and remove direct dependency to babel-jest ([a789916](https://github.com/christophehurpeau/pob/commit/a78991696c6f7716cb1198ff8a6c36cc1acfa1a9))
21
+ * **pob-babel:** stop build dev specific and drop node 12 ([9cb8975](https://github.com/christophehurpeau/pob/commit/9cb897538df6b9c0e3ad3750abacb6ab96113862))
22
+
23
+
24
+ ### BREAKING CHANGES
25
+
26
+ * requires node 14
27
+ * **pob-babel:** requires to delete dev exports and requires node 14
28
+
29
+
30
+
31
+
32
+
33
+ ## [8.10.1](https://github.com/christophehurpeau/pob/compare/pob@8.10.0...pob@8.10.1) (2021-12-05)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * **pob:** only install release workflow if ci is enabled ([8e2fc45](https://github.com/christophehurpeau/pob/commit/8e2fc45ec5435a149b4580b09ae4636e3dbc0fdf))
39
+ * **pob:** start script for apps ([623cfb5](https://github.com/christophehurpeau/pob/commit/623cfb5e5a9af9978b5533962ec7fb3b85035a3b))
40
+ * init new monorepo ([7a212de](https://github.com/christophehurpeau/pob/commit/7a212deb2feb480c19b5243a201f31a7b2ce45c3))
41
+ * monorepo add ([3ae8bfb](https://github.com/christophehurpeau/pob/commit/3ae8bfb487b8a88b62ad8692789ecdddf01ec376))
42
+ * **deps:** update dependency prettier to v2.5.1 ([#1122](https://github.com/christophehurpeau/pob/issues/1122)) ([ba903e3](https://github.com/christophehurpeau/pob/commit/ba903e3c63ff90eab7938d5aecbd9d37fac68293))
43
+
44
+
45
+
46
+
47
+
48
+ # [8.10.0](https://github.com/christophehurpeau/pob/compare/pob@8.9.0...pob@8.10.0) (2021-11-28)
49
+
50
+
51
+ ### Bug Fixes
52
+
53
+ * **pob:** also remove react eslint plugins ([77dc9c5](https://github.com/christophehurpeau/pob/commit/77dc9c564bf8d2622956f23973b5258fa97aed2d))
54
+ * **pob:** monorepo typedoc enable tsc skipLibCheck ([87b8e88](https://github.com/christophehurpeau/pob/commit/87b8e88656308cea49994335f1aafcb3eb49121a))
55
+ * **pob:** node options when lots of packages ([4829f93](https://github.com/christophehurpeau/pob/commit/4829f9386504c5de4ccc488544c10cf194b0f0f0))
56
+ * **pob:** remove deprecated dependency xunit-file ([62d4602](https://github.com/christophehurpeau/pob/commit/62d460276709d6a5630ba3759984910d36a506cc))
57
+ * postinstall script for non lerna private packages ([8a3f3a4](https://github.com/christophehurpeau/pob/commit/8a3f3a4143f2595391503d51c31dd9b8157ccc97))
58
+
59
+
60
+ ### Features
61
+
62
+ * **deps:** update dependency prettier to v2.5.0 ([#1114](https://github.com/christophehurpeau/pob/issues/1114)) ([50d4b98](https://github.com/christophehurpeau/pob/commit/50d4b98f8ec76ee8a44e3f01eea882089b1a89e5))
63
+
64
+
65
+
66
+
67
+
68
+ # [8.9.0](https://github.com/christophehurpeau/pob/compare/pob@8.8.2...pob@8.9.0) (2021-11-16)
69
+
70
+
71
+ ### Bug Fixes
72
+
73
+ * **pob:** fixes for @pob/eslint-config ([e84152c](https://github.com/christophehurpeau/pob/commit/e84152c8e2b2c8421d51c9883426646afad49134))
74
+ * **pob:** startsWith of undefined ([b0ebc73](https://github.com/christophehurpeau/pob/commit/b0ebc73bb74f4a2c98221b917ec8e159fd5a7c22))
75
+
76
+
77
+ ### Features
78
+
79
+ * **deps:** update @pob/eslint-config to v47 (major) ([#1101](https://github.com/christophehurpeau/pob/issues/1101)) ([e726bf5](https://github.com/christophehurpeau/pob/commit/e726bf5a5baa8631933a5f69dbd3c48f9bf25ca5))
80
+
81
+
82
+
83
+
84
+
6
85
  ## [8.8.2](https://github.com/christophehurpeau/pob/compare/pob@8.8.1...pob@8.8.2) (2021-11-14)
7
86
 
8
87
  **Note:** Version bump only for package pob
@@ -87,6 +87,7 @@ export default class PobAppGenerator extends Generator {
87
87
  name: 'ci',
88
88
  message: 'Do you want ci ?',
89
89
  default: !config || config.ci === undefined ? true : config.ci,
90
+ when: () => !inLerna,
90
91
  },
91
92
  ]);
92
93
 
@@ -41,24 +41,25 @@ export default class CommonBabelGenerator extends Generator {
41
41
  let babelEnvs = pkg.pob.babelEnvs;
42
42
  if (
43
43
  !babelEnvs.some(
44
- (env) => env.target === 'node' && String(env.version) === '12',
44
+ (env) => env.target === 'node' && String(env.version) === '14',
45
45
  ) &&
46
46
  babelEnvs.some(
47
47
  (env) =>
48
48
  env.target === 'node' &&
49
49
  (String(env.version) === '8' ||
50
50
  String(env.version) === '6' ||
51
- String(env.version) === '10'),
51
+ String(env.version) === '10' ||
52
+ String(env.version) === '12'),
52
53
  )
53
54
  ) {
54
55
  babelEnvs.unshift({
55
56
  target: 'node',
56
- version: '12',
57
+ version: '14',
57
58
  formats: ['cjs', 'es'],
58
59
  });
59
60
  }
60
61
  babelEnvs = babelEnvs.filter(
61
- (env) => env.target !== 'node' || env.version >= 12,
62
+ (env) => env.target !== 'node' || env.version >= 14,
62
63
  );
63
64
 
64
65
  pkg.pob.babelEnvs = babelEnvs;
@@ -125,9 +126,13 @@ export default class CommonBabelGenerator extends Generator {
125
126
  default: nodeVersions,
126
127
  choices: [
127
128
  {
128
- name: '12 (Active LTS)',
129
+ name: '12 (Maintenance LTS)',
129
130
  value: '12',
130
131
  },
132
+ {
133
+ name: '14 (Maintenance LTS)',
134
+ value: '14',
135
+ },
131
136
  ],
132
137
  },
133
138
 
@@ -195,11 +200,11 @@ export default class CommonBabelGenerator extends Generator {
195
200
  ...(babelConfig.nodeVersions || []).map((version) => ({
196
201
  target: 'node',
197
202
  version,
198
- formats: babelConfig.formats.includes('es')
203
+ formats: babelConfig.formats.includes('cjs')
199
204
  ? // eslint-disable-next-line unicorn/no-nested-ternary
200
- version === '12'
205
+ version === '14'
201
206
  ? babelConfig.formats
202
- : ['cjs']
207
+ : ['es']
203
208
  : babelConfig.formats,
204
209
  })),
205
210
  ...(babelConfig.browserVersions || []).map((version) => ({
@@ -267,10 +272,19 @@ export default class CommonBabelGenerator extends Generator {
267
272
 
268
273
  /* scripts */
269
274
 
270
- packageUtils.addOrRemoveScripts(pkg, useBabel, {
271
- build: 'pob-build',
272
- watch: 'pob-watch',
273
- });
275
+ if (this.options.isApp) {
276
+ packageUtils.removeScripts(['watch']);
277
+ packageUtils.addOrRemoveScripts(pkg, useBabel, {
278
+ build: 'pob-build',
279
+ start: 'pob-watch',
280
+ });
281
+ } else {
282
+ packageUtils.removeScripts(['start']);
283
+ packageUtils.addOrRemoveScripts(pkg, useBabel, {
284
+ build: 'pob-build',
285
+ watch: 'pob-watch',
286
+ });
287
+ }
274
288
 
275
289
  const shouldBuildDefinitions = !this.options.isApp && useBabel;
276
290
  packageUtils.addOrRemoveScripts(pkg, shouldBuildDefinitions, {
@@ -340,12 +354,6 @@ export default class CommonBabelGenerator extends Generator {
340
354
  ['@babel/preset-env'],
341
355
  );
342
356
 
343
- packageUtils.addOrRemoveDevDependencies(
344
- pkg,
345
- this.babelEnvs.find((env) => env.target === 'node'),
346
- ['babel-preset-latest-node'],
347
- );
348
-
349
357
  packageUtils.addOrRemoveDevDependencies(
350
358
  pkg,
351
359
  this.babelEnvs.find(
@@ -366,8 +374,6 @@ export default class CommonBabelGenerator extends Generator {
366
374
  switch (String(minNodeVersion)) {
367
375
  case '10':
368
376
  case '12':
369
- pkg.engines.node = '^12.20.0 || ^14.13.1 || >=16.0.0';
370
- break;
371
377
  case '14':
372
378
  pkg.engines.node = '^14.13.1 || >=16.0.0';
373
379
  break;
@@ -399,7 +405,7 @@ export default class CommonBabelGenerator extends Generator {
399
405
  if (Object.keys(pkg.engines).length === 0) delete pkg.engines;
400
406
  } else {
401
407
  // Supported LTS versions of node, that supports ESM modules.
402
- pkg.engines.node = '^12.20.0 || ^14.13.1 || >=16.0.0';
408
+ pkg.engines.node = '^14.13.1 || >=16.0.0';
403
409
  }
404
410
  }
405
411
 
@@ -462,10 +468,11 @@ export default class CommonBabelGenerator extends Generator {
462
468
  !pkg.engines.node ||
463
469
  semver.lt(
464
470
  semver.minVersion(pkg.engines.node),
465
- pkg.type === 'commonjs' ? '12.10.0' : '12.20.0',
471
+ // pkg.type === 'commonjs' ? '12.10.0' : '12.20.0',
472
+ '14.13.1',
466
473
  )
467
474
  ) {
468
- pkg.engines.node = '^12.20.0 || ^14.13.1 || >=16.0.0';
475
+ pkg.engines.node = '^14.13.1 || >=16.0.0';
469
476
  }
470
477
  }
471
478
 
@@ -490,35 +497,32 @@ export default class CommonBabelGenerator extends Generator {
490
497
  (env) => env.target === 'node' && env.formats.includes('es'),
491
498
  );
492
499
 
500
+ // Legacy "dev" builds
501
+ delete pkg['module:browser'];
502
+ delete pkg['module:browser-dev'];
503
+ delete pkg['module:modern-browsers-dev'];
504
+ delete pkg['module:node-dev'];
505
+
493
506
  /* webpack 4 */
494
507
  if (esAllBrowserEnv) {
495
508
  pkg.module = './dist/index-browser.es.js';
496
509
  pkg.browser = './dist/index-browser.es.js';
497
- pkg['module:browser'] = './dist/index-browser.es.js';
498
- pkg['module:browser-dev'] = './dist/index-browser-dev.es.js';
499
510
  } else {
500
511
  delete pkg.module;
501
512
  delete pkg.browser;
502
- delete pkg['module:browser'];
503
- delete pkg['module:browser-dev'];
504
513
  }
505
514
 
506
515
  if (esModernBrowserEnv) {
507
516
  pkg['module:modern-browsers'] = './dist/index-browsermodern.es.js';
508
- pkg['module:modern-browsers-dev'] =
509
- './dist/index-browsermodern-dev.es.js';
510
517
  } else {
511
518
  delete pkg['module:modern-browsers'];
512
- delete pkg['module:modern-browsers-dev'];
513
519
  }
514
520
 
515
521
  if (esNodeEnv) {
522
+ // webpack 4 node
516
523
  pkg[
517
524
  'module:node'
518
525
  ] = `./dist/index-${esNodeEnv.target}${esNodeEnv.version}.mjs`;
519
- pkg[
520
- 'module:node-dev'
521
- ] = `./dist/index-${esNodeEnv.target}${esNodeEnv.version}-dev.mjs`;
522
526
  }
523
527
 
524
528
  const aliases = (this.entries || []).filter((entry) => entry !== 'index');
@@ -539,7 +543,6 @@ export default class CommonBabelGenerator extends Generator {
539
543
  : aliases;
540
544
  if (envAliases.length === 0) return;
541
545
  pkg[`module:aliases-${key}`] = {};
542
- pkg[`module:aliases-${key}-dev`] = {};
543
546
 
544
547
  envAliases.forEach((aliasName) => {
545
548
  const isBrowserOnly =
@@ -550,11 +553,6 @@ export default class CommonBabelGenerator extends Generator {
550
553
  ] = `./dist/${aliasDistName}-${env.target}${
551
554
  env.version || ''
552
555
  }.es.js`;
553
- pkg[`module:aliases-${key}-dev`][
554
- `./${aliasName}.js`
555
- ] = `./dist/${aliasDistName}-${env.target}${
556
- env.version || ''
557
- }-dev.es.js`;
558
556
  });
559
557
  });
560
558
  }
@@ -582,19 +580,16 @@ export default class CommonBabelGenerator extends Generator {
582
580
  this.babelEnvs.forEach(({ target, version, formats }) => {
583
581
  if (target === 'node' && entry === 'browser') return;
584
582
 
585
- const exportTarget = { development: {} };
583
+ const exportTarget = {};
586
584
 
587
585
  if (target === 'node') {
588
586
  if (formats.includes('es')) {
589
- exportTarget.development.import = `./dist/${entryDistName}-${target}${version}-dev.mjs`;
590
587
  exportTarget.import = `./dist/${entryDistName}-${target}${version}.mjs`;
591
588
 
592
589
  if (formats.includes('cjs')) {
593
- exportTarget.development.require = `./dist/${entryDistName}-${target}${version}-dev.cjs.js`;
594
590
  exportTarget.require = `./dist/${entryDistName}-${target}${version}.cjs.js`;
595
591
  }
596
592
  } else if (formats.includes('cjs')) {
597
- exportTarget.development = `./dist/${entryDistName}-${target}${version}-dev.cjs.js`;
598
593
  exportTarget.default = `./dist/${entryDistName}-${target}${version}.cjs.js`;
599
594
  }
600
595
  // eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
@@ -604,18 +599,12 @@ export default class CommonBabelGenerator extends Generator {
604
599
  }
605
600
  } else if (target === 'browser') {
606
601
  if (formats.includes('es')) {
607
- exportTarget.development.import = `./dist/${entryDistName}-${target}${
608
- version || ''
609
- }-dev.es.js`;
610
602
  exportTarget.import = `./dist/${entryDistName}-${target}${
611
603
  version || ''
612
604
  }.es.js`;
613
605
  }
614
606
 
615
607
  if (formats.includes('cjs')) {
616
- exportTarget.development.require = `./dist/index-${target}${
617
- version || ''
618
- }-dev.cjs.js`;
619
608
  exportTarget.require = `./dist/index-${target}${
620
609
  version || ''
621
610
  }.cjs.js`;
@@ -664,6 +653,13 @@ export default class CommonBabelGenerator extends Generator {
664
653
 
665
654
  Object.keys(pkg).forEach((key) => {
666
655
  if (!key.startsWith('module:') && !key.startsWith('webpack:')) return;
656
+
657
+ // legacy
658
+ if (key.endsWith('-dev')) {
659
+ delete pkg[key];
660
+ return;
661
+ }
662
+
667
663
  if (key.startsWith('module:node') && esNodeEnv) return;
668
664
  if (key.startsWith('module:browser') && esAllBrowserEnv) return;
669
665
  if (key.startsWith('module:modern-browsers') && esModernBrowserEnv) {
@@ -12,6 +12,13 @@ export default class CommonLintGenerator extends Generator {
12
12
  constructor(args, opts) {
13
13
  super(args, opts);
14
14
 
15
+ this.option('monorepo', {
16
+ type: Boolean,
17
+ required: false,
18
+ defaults: false,
19
+ description: 'Is root monorepo',
20
+ });
21
+
15
22
  this.option('babel', {
16
23
  type: String,
17
24
  required: false,
@@ -104,7 +111,7 @@ export default class CommonLintGenerator extends Generator {
104
111
  arrowParens: 'always',
105
112
  };
106
113
 
107
- if (!inLerna || inLerna.root) {
114
+ if (!inLerna || inLerna.root || this.options.monorepo) {
108
115
  const ignorePatterns = new Set(
109
116
  this.options.ignorePaths.split('\n').filter(Boolean),
110
117
  );
@@ -125,7 +132,7 @@ export default class CommonLintGenerator extends Generator {
125
132
  this.templatePath('prettierignore.ejs'),
126
133
  this.destinationPath('.prettierignore'),
127
134
  {
128
- inRoot: !inLerna || inLerna.root,
135
+ inRoot: !inLerna || inLerna.root || this.options.monorepo,
129
136
  documentation: this.options.documentation,
130
137
  packageManager: this.options.packageManager,
131
138
  yarnNodeLinker: this.options.yarnNodeLinker,
@@ -155,14 +162,16 @@ export default class CommonLintGenerator extends Generator {
155
162
  'eslint-plugin-babel',
156
163
  'eslint-plugin-flowtype',
157
164
  'eslint-plugin-prefer-class-properties',
158
- 'eslint-plugin-jsx-a11y',
159
165
  'eslint-plugin-prettier',
166
+ 'eslint-plugin-react',
167
+ 'eslint-plugin-react-hooks',
160
168
  'typescript-eslint-parser',
161
169
  'standard',
162
170
  ]);
163
171
 
164
172
  if (!pkg.name.startsWith('@pob/eslint-config')) {
165
173
  packageUtils.removeDevDependencies(pkg, [
174
+ 'eslint-plugin-jsx-a11y',
166
175
  'eslint-config-airbnb',
167
176
  'eslint-config-airbnb-base',
168
177
  ]);
@@ -179,7 +188,7 @@ export default class CommonLintGenerator extends Generator {
179
188
 
180
189
  if (
181
190
  globalEslint &&
182
- !(inLerna && inLerna.root) &&
191
+ !((inLerna && inLerna.root) || this.options.monorepo) &&
183
192
  (rootPackageManager !== 'yarn' || rootYarnNodeLinker === 'node-modules')
184
193
  ) {
185
194
  packageUtils.removeDevDependencies(
@@ -203,15 +212,18 @@ export default class CommonLintGenerator extends Generator {
203
212
  } else {
204
213
  packageUtils.addOrRemoveDevDependencies(
205
214
  pkg,
206
- (inLerna && inLerna.root) || !globalEslint,
215
+ (inLerna && inLerna.root) || this.options.monorepo || !globalEslint,
207
216
  ['prettier'],
208
217
  );
209
218
  packageUtils.addOrRemoveDevDependencies(
210
219
  pkg,
211
220
  !globalEslint ||
212
221
  (inLerna && inLerna.root) ||
222
+ this.options.monorepo ||
213
223
  lernaProjectType === 'app' ||
214
- rootPackageManager === 'yarn',
224
+ (rootPackageManager === 'yarn' &&
225
+ rootYarnNodeLinker !== 'node-modules') ||
226
+ !!(pkg.peerDependencies && pkg.peerDependencies.eslint),
215
227
  ['eslint'],
216
228
  );
217
229
  const shouldHavePluginsDependencies =
@@ -238,7 +250,7 @@ export default class CommonLintGenerator extends Generator {
238
250
  ['eslint-plugin-node', 'eslint-import-resolver-node'],
239
251
  );
240
252
 
241
- if (inLerna && inLerna.root) {
253
+ if ((inLerna && inLerna.root) || this.options.monorepo) {
242
254
  if (this.options.typescript) {
243
255
  packageUtils.updateDevDependenciesIfPresent(pkg, [
244
256
  '@pob/eslint-config-typescript',
@@ -407,7 +419,7 @@ export default class CommonLintGenerator extends Generator {
407
419
  console.warn(`Could not parse/edit ${rootEslintrcPath}: `, err);
408
420
  }
409
421
 
410
- if (inLerna && inLerna.root) {
422
+ if ((inLerna && inLerna.root) || this.options.monorepo) {
411
423
  if (this.fs.exists(srcEslintrcPath)) {
412
424
  this.fs.delete(srcEslintrcPath);
413
425
  }
@@ -445,7 +457,7 @@ export default class CommonLintGenerator extends Generator {
445
457
  }
446
458
 
447
459
  // see monorepo/lerna/index.js
448
- if (!(inLerna && inLerna.root)) {
460
+ if (!(inLerna && inLerna.root) && !this.options.monorepo) {
449
461
  const srcDirectory = useBabel ? 'src' : 'lib';
450
462
  const lintRootJsFiles = (useBabel && useNode) || !inLerna;
451
463
 
@@ -42,8 +42,12 @@ export default class CommonHuskyGenerator extends Generator {
42
42
  this.fs.delete('.git-hooks/pre-commit');
43
43
  if (this.fs.exists('.git-hooks')) this.fs.delete('.git-hooks');
44
44
 
45
- this.fs.delete(this.destinationPath('.huskyrc.js'));
46
- this.fs.delete(this.destinationPath('husky.config.js'));
45
+ if (this.fs.exists(this.destinationPath('.huskyrc.js'))) {
46
+ this.fs.delete(this.destinationPath('.huskyrc.js'));
47
+ }
48
+ if (this.fs.exists(this.destinationPath('husky.config.js'))) {
49
+ this.fs.delete(this.destinationPath('husky.config.js'));
50
+ }
47
51
 
48
52
  if (this.fs.exists(this.destinationPath('lint-staged.config.js'))) {
49
53
  this.fs.move(
@@ -19,6 +19,7 @@ export default class CommonRemoveOldDependenciesGenerator extends Generator {
19
19
  'babel-preset-es2015-node6',
20
20
  'babel-preset-pob',
21
21
  'babel-preset-latest',
22
+ 'babel-preset-latest-node',
22
23
  'babel-preset-stage-0',
23
24
  'babel-preset-stage-1',
24
25
  'babel-preset-modern-browsers-stage-1',
@@ -45,6 +46,7 @@ export default class CommonRemoveOldDependenciesGenerator extends Generator {
45
46
  '@pob/version',
46
47
  'pob-release',
47
48
  'eslint-plugin-typescript',
49
+ 'xunit-file',
48
50
  ]);
49
51
 
50
52
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
@@ -69,14 +69,11 @@ export default class CommonTestingGenerator extends Generator {
69
69
  'istanbul',
70
70
  'babel-core',
71
71
  'ts-jest',
72
+ 'babel-jest',
72
73
  ]);
73
74
 
74
75
  if (!this.options.enable) {
75
- packageUtils.removeDevDependencies(pkg, [
76
- 'jest',
77
- '@types/jest',
78
- 'babel-jest',
79
- ]);
76
+ packageUtils.removeDevDependencies(pkg, ['jest', '@types/jest']);
80
77
 
81
78
  delete pkg.jest;
82
79
  // if (inLerna) {
@@ -97,7 +94,7 @@ export default class CommonTestingGenerator extends Generator {
97
94
  const transpileWithBabel = packageUtils.transpileWithBabel(pkg);
98
95
 
99
96
  const shouldUseExperimentalVmModules =
100
- pkg.type === 'module' && !transpileWithBabel;
97
+ pkg.type === 'module' || transpileWithBabel;
101
98
 
102
99
  const jestCommand = `${
103
100
  shouldUseExperimentalVmModules
@@ -125,10 +122,6 @@ export default class CommonTestingGenerator extends Generator {
125
122
  const hasReact = transpileWithBabel && packageUtils.hasReact(pkg);
126
123
  const srcDirectory = transpileWithBabel ? 'src' : 'lib';
127
124
 
128
- packageUtils.addOrRemoveDevDependencies(pkg, transpileWithBabel, [
129
- 'babel-jest',
130
- ]);
131
-
132
125
  if (!pkg.jest) pkg.jest = {};
133
126
  Object.assign(pkg.jest, {
134
127
  cacheDirectory: './node_modules/.cache/jest',
@@ -152,12 +145,20 @@ export default class CommonTestingGenerator extends Generator {
152
145
  // 'jsx',
153
146
  'json',
154
147
  ].filter(Boolean),
155
- transform: {
156
- [`^.+\\.ts${hasReact ? 'x?' : ''}$`]: 'babel-jest',
157
- },
148
+ extensionsToTreatAsEsm: [
149
+ transpileWithBabel && '.ts',
150
+ transpileWithBabel && hasReact && '.tsx',
151
+ ].filter(Boolean),
152
+ // transform: {
153
+ // [`^.+\\.ts${hasReact ? 'x?' : ''}$`]: 'babel-jest',
154
+ // },
158
155
  });
156
+ delete pkg.jest.transform;
159
157
 
160
- if (babelEnvs.some((env) => env.target === 'node')) {
158
+ if (
159
+ babelEnvs.length === 0 ||
160
+ babelEnvs.some((env) => env.target === 'node')
161
+ ) {
161
162
  pkg.jest.testEnvironment = 'node';
162
163
  } else {
163
164
  delete pkg.jest.testEnvironment;
@@ -8,7 +8,7 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- node-version: [12.x, 14.x, 16.x]
11
+ node-version: [14.x, 16.x]
12
12
 
13
13
  steps:
14
14
  - uses: actions/checkout@v2
@@ -57,16 +57,16 @@ jobs:
57
57
  <% } -%>
58
58
  - name: Prettier
59
59
  run: <%= packageManager %> run lint:prettier
60
- if: startsWith(matrix.node-version, '14.')
60
+ if: startsWith(matrix.node-version, '16.')
61
61
 
62
62
  - name: Eslint
63
63
  run: <%= packageManager %> run lint:eslint
64
- if: startsWith(matrix.node-version, '14.')
64
+ if: startsWith(matrix.node-version, '16.')
65
65
  <% if (typescript) { -%>
66
66
 
67
67
  - name: Typescript
68
68
  run: yarn run tsc
69
- if: startsWith(matrix.node-version, '14.')
69
+ if: startsWith(matrix.node-version, '16.')
70
70
  <% } -%>
71
71
  <% if (testing) { -%>
72
72
 
@@ -79,14 +79,14 @@ jobs:
79
79
 
80
80
  - name: Documentation
81
81
  run: <%= packageManager %> run generate:docs
82
- if: startsWith(matrix.node-version, '14.')
82
+ if: startsWith(matrix.node-version, '16.')
83
83
  env:
84
84
  CI: true
85
85
  <% } else if (codecov) { -%>
86
86
 
87
87
  - name: Generate Coverage doc
88
88
  run: <%= packageManager %> run generate:test-coverage
89
- if: startsWith(matrix.node-version, '14.')
89
+ if: startsWith(matrix.node-version, '16.')
90
90
  env:
91
91
  CI: true
92
92
  <% } -%>
@@ -96,11 +96,11 @@ jobs:
96
96
  uses: codecov/codecov-action@v2
97
97
  with:
98
98
  token: ${{ secrets.CODECOV_TOKEN }}
99
- if: startsWith(matrix.node-version, '14.')
99
+ if: startsWith(matrix.node-version, '16.')
100
100
  <% } -%>
101
101
  <% if (true) { -%>
102
102
 
103
103
  - name: Check nothing was forgotten before commit
104
- if: startsWith(matrix.node-version, '14.')
104
+ if: startsWith(matrix.node-version, '16.')
105
105
  run: <%= packageManager === 'npm' ? 'npx' : 'yarn run' %> repository-check-dirty
106
106
  <% } -%>
@@ -22,12 +22,7 @@ const configureProtectionRule = async (owner, repo) => {
22
22
  json: {
23
23
  required_status_checks: {
24
24
  strict: false,
25
- contexts: [
26
- 'build (12.x)',
27
- 'build (14.x)',
28
- 'build (16.x)',
29
- 'reviewflow',
30
- ],
25
+ contexts: ['build (14.x)', 'build (16.x)', 'reviewflow'],
31
26
  },
32
27
  enforce_admins: false, // true,
33
28
  required_pull_request_reviews: null,
@@ -37,9 +32,14 @@ const configureProtectionRule = async (owner, repo) => {
37
32
  allow_deletions: false,
38
33
  },
39
34
  });
35
+ if (branch === 'master') {
36
+ console.warn('You should rename your "master" branch to "main"');
37
+ }
40
38
  } catch (err) {
41
- console.error(`Failed to configure ${branch} branch protection`);
42
- console.error(err.stack || err.message || err);
39
+ if (branch === 'main') {
40
+ console.error(`Failed to configure ${branch} branch protection`);
41
+ console.error(err.stack || err.message || err);
42
+ }
43
43
  }
44
44
  }
45
45
  };
@@ -79,14 +79,17 @@ export default class CoreGitGithubGenerator extends Generator {
79
79
  const repo = this.options.repoName;
80
80
 
81
81
  const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
82
+ const name = pkg.name.endsWith('-monorepo')
83
+ ? pkg.name.slice(0, -'-monorepo'.length)
84
+ : pkg.name;
82
85
 
83
86
  if (this.options.shouldCreate) {
84
87
  try {
85
88
  if (this.options.shouldCreate) {
86
89
  try {
87
- await gh('user/repos', {
90
+ await gh.post('user/repos', {
88
91
  json: {
89
- name: pkg.name,
92
+ name,
90
93
  description: pkg.description,
91
94
  homepage: null,
92
95
  private: false,
@@ -103,13 +106,33 @@ export default class CoreGitGithubGenerator extends Generator {
103
106
  }
104
107
 
105
108
  const cwd = this.destinationPath();
106
- this.spawnCommandSync('git', ['add', '--all', '.'], { cwd });
109
+ try {
110
+ this.spawnCommandSync('git', ['add', '--all', '.'], { cwd });
111
+ } catch (err) {
112
+ this.spawnCommandSync('git', ['init'], { cwd });
113
+ this.spawnCommandSync('git', ['add', '--all', '.'], { cwd });
114
+ this.spawnCommandSync(
115
+ 'git',
116
+ [
117
+ 'remote',
118
+ 'add',
119
+ 'origin',
120
+ `git@github.com:christophehurpeau/${name}.git`,
121
+ ],
122
+ { cwd },
123
+ );
124
+ console.error('Failed to create repository');
125
+ console.error(err.stack || err.message || err);
126
+ }
107
127
  this.spawnCommandSync(
108
128
  'git',
109
129
  ['commit', '-m', 'chore: initial commit [skip ci]'],
110
130
  { cwd },
111
131
  );
112
- this.spawnCommandSync('git', ['push', '-u', 'origin', 'master'], {
132
+ this.spawnCommandSync('git', ['branch', '-M', 'main'], {
133
+ cwd,
134
+ });
135
+ this.spawnCommandSync('git', ['push', '-u', 'origin', 'main'], {
113
136
  cwd,
114
137
  });
115
138
 
@@ -9,6 +9,20 @@ export default class CorePackageGenerator extends Generator {
9
9
  constructor(args, opts) {
10
10
  super(args, opts);
11
11
 
12
+ this.option('monorepo', {
13
+ type: Boolean,
14
+ required: true,
15
+ defaults: false,
16
+ desc: 'is monorepo',
17
+ });
18
+
19
+ this.option('isRoot', {
20
+ type: Boolean,
21
+ required: true,
22
+ defaults: false,
23
+ desc: 'is root',
24
+ });
25
+
12
26
  this.option('private', {
13
27
  type: Boolean,
14
28
  required: false,
@@ -23,13 +37,21 @@ export default class CorePackageGenerator extends Generator {
23
37
  if (!pkg.engines) pkg.engines = {};
24
38
 
25
39
  // dont override engines if set to latest
26
- if (!pkg.engines.node || !pkg.engines.node.startsWith('>=14.')) {
40
+ if (
41
+ !pkg.engines.node ||
42
+ !(
43
+ pkg.engines.node.startsWith('>=14.') ||
44
+ pkg.engines.node.startsWith('>=16.')
45
+ )
46
+ ) {
27
47
  // this might be overridden by babel generator
28
- pkg.engines.node = '>=12.10.0';
48
+ pkg.engines.node = '>=14.13.1';
29
49
  }
30
50
 
31
51
  if (!this.options.updateOnly) {
32
- if (this.options.private || (inLerna && inLerna.root)) {
52
+ if (this.options.monorepo && this.options.isRoot) {
53
+ pkg.private = true;
54
+ } else if (this.options.private) {
33
55
  pkg.private = true;
34
56
  } else {
35
57
  const { isPrivate } = await this.prompt({
@@ -46,7 +68,7 @@ export default class CorePackageGenerator extends Generator {
46
68
  }
47
69
  }
48
70
 
49
- if (inLerna && inLerna.root) {
71
+ if (this.options.monorepo && this.options.isRoot) {
50
72
  if (!pkg.name) {
51
73
  const { name } = await this.prompt({
52
74
  name: 'name',
@@ -77,7 +99,7 @@ export default class CorePackageGenerator extends Generator {
77
99
  const props = await this.prompt(
78
100
  [
79
101
  !this.options.updateOnly &&
80
- !(inLerna && inLerna.root) && {
102
+ !(this.options.monorepo && this.options.isRoot) && {
81
103
  name: 'description',
82
104
  message: 'Description',
83
105
  default: pkg.description,
@@ -115,7 +137,7 @@ export default class CorePackageGenerator extends Generator {
115
137
  ? pkg.description
116
138
  : props.description || pkg.description;
117
139
 
118
- if (inLerna && !inLerna.root) {
140
+ if (this.options.monorepo && !this.options.isRoot) {
119
141
  const rootMonorepoPkg = inLerna.rootMonorepoPkg;
120
142
  const rootRepositoryUrl =
121
143
  typeof rootMonorepoPkg.repository === 'string'
@@ -136,9 +158,9 @@ export default class CorePackageGenerator extends Generator {
136
158
  fs.unlinkSync(this.destinationPath('yarn-error.log'));
137
159
  }
138
160
 
139
- if (inLerna && !inLerna.root) {
161
+ if (this.options.monorepo && !this.options.isRoot) {
140
162
  packageUtils.removeScripts(pkg, ['checks']);
141
- } else if (inLerna && inLerna.root) {
163
+ } else if (this.options.monorepo && this.options.isRoot) {
142
164
  const doesMjsCheckPackagesExists = this.fs.exists(
143
165
  this.destinationPath('scripts/check-packages.mjs'),
144
166
  );
@@ -206,6 +228,7 @@ export default class CorePackageGenerator extends Generator {
206
228
 
207
229
  writing() {
208
230
  const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
231
+ if (!pkg.scripts) pkg.scripts = {};
209
232
 
210
233
  const installPostinstallScript = (scriptName) => {
211
234
  if (
@@ -217,12 +240,12 @@ export default class CorePackageGenerator extends Generator {
217
240
  };
218
241
 
219
242
  const uninstallPostinstallScript = (scriptName) => {
220
- if (pkg.scripts[scriptName]) {
243
+ if (pkg.scripts && pkg.scripts[scriptName]) {
221
244
  if (pkg.scripts[scriptName] === 'pob-root-postinstall') {
222
245
  delete pkg.scripts[scriptName];
223
- }
224
-
225
- if (pkg.scripts[scriptName].startsWith('pob-root-postinstall && ')) {
246
+ } else if (
247
+ pkg.scripts[scriptName].startsWith('pob-root-postinstall && ')
248
+ ) {
226
249
  pkg.scripts[scriptName] = pkg.scripts[scriptName].slice(
227
250
  'pob-root-postinstall && '.length - 1,
228
251
  );
@@ -231,10 +254,9 @@ export default class CorePackageGenerator extends Generator {
231
254
  }
232
255
  }
233
256
  };
234
-
235
- if (inLerna || pkg.private) {
257
+ if (this.options.monorepo || inLerna || pkg.private) {
236
258
  uninstallPostinstallScript('postinstallDev');
237
- if (inLerna && inLerna.root) {
259
+ if (this.options.isRoot) {
238
260
  installPostinstallScript('postinstall');
239
261
  } else {
240
262
  uninstallPostinstallScript('postinstall');
@@ -119,10 +119,14 @@ export default class CoreYarnGenerator extends Generator {
119
119
  } catch {}
120
120
  } else {
121
121
  if (pkg.scripts.build) {
122
- this.spawnCommandSync('yarn', ['run', 'build']);
122
+ try {
123
+ this.spawnCommandSync('yarn', ['run', 'build']);
124
+ } catch {}
123
125
  }
124
126
  if (pkg.scripts['generate:docs']) {
125
- this.spawnCommandSync('yarn', ['run', 'generate:docs']);
127
+ try {
128
+ this.spawnCommandSync('yarn', ['run', 'generate:docs']);
129
+ } catch {}
126
130
  }
127
131
  }
128
132
  }
@@ -80,7 +80,7 @@ export default class PobLibGenerator extends Generator {
80
80
  case 'node10':
81
81
  return {
82
82
  target: 'node',
83
- version: 12,
83
+ version: 14,
84
84
  formats: ['cjs'],
85
85
  };
86
86
 
@@ -89,7 +89,7 @@ export default class PobLibGenerator extends Generator {
89
89
  case 'module-node8':
90
90
  return {
91
91
  target: 'node',
92
- version: 12,
92
+ version: 14,
93
93
  formats: ['es'],
94
94
  };
95
95
 
@@ -273,7 +273,7 @@ export default class PobLibGenerator extends Generator {
273
273
  });
274
274
 
275
275
  this.composeWith('pob:lib:release', {
276
- enable: !inLerna,
276
+ enable: !inLerna && this.pobjson.testing && this.pobjson.testing.ci,
277
277
  withBabel: babelEnvs.length > 0,
278
278
  documentation: !!this.pobjson.documentation,
279
279
  });
@@ -316,7 +316,8 @@ export default class PobLibGenerator extends Generator {
316
316
  delete pkg.scripts.release;
317
317
  delete pkg.scripts.version;
318
318
  }
319
- } else if (withBabel) {
319
+ }
320
+ if (withBabel && (!inLerna || !inLerna.root)) {
320
321
  packageUtils.addScripts(pkg, {
321
322
  clean: 'rm -Rf dist',
322
323
  });
@@ -15,6 +15,7 @@
15
15
  "target": "esnext",
16
16
  "module": "esnext",
17
17
  "lib": ["dom", "esnext"],
18
+ "skipLibCheck": true,
18
19
  "moduleResolution": "node",
19
20
  "esModuleInterop": true
20
21
  },
@@ -61,9 +61,15 @@ export default class LibReleaseGenerator extends Generator {
61
61
  }
62
62
 
63
63
  if (!isReleasePleaseEnabled) {
64
- this.fs.delete(
65
- this.destinationPath('.github/workflows/release-please.yml'),
66
- );
64
+ if (
65
+ this.fs.exists(
66
+ this.destinationPath('.github/workflows/release-please.yml'),
67
+ )
68
+ ) {
69
+ this.fs.delete(
70
+ this.destinationPath('.github/workflows/release-please.yml'),
71
+ );
72
+ }
67
73
  } else {
68
74
  this.fs.copyTpl(
69
75
  this.templatePath('release-please.yml.ejs'),
@@ -207,6 +207,7 @@ export default class PobMonorepoGenerator extends Generator {
207
207
  this.composeWith('pob:common:husky', {});
208
208
 
209
209
  this.composeWith('pob:common:format-lint', {
210
+ monorepo: true,
210
211
  documentation: this.pobLernaConfig.documentation,
211
212
  typescript: this.pobLernaConfig.typescript,
212
213
  testing: this.pobLernaConfig.testing,
@@ -93,7 +93,7 @@ export default class MonorepoLernaGenerator extends Generator {
93
93
 
94
94
  const getPackagePobConfig = (config) => ({
95
95
  babelEnvs: [],
96
- ...((config && config.pob) || {}),
96
+ ...(config && config.pob),
97
97
  });
98
98
  const withBabel = this.packages.some(
99
99
  (config) => getPackagePobConfig(config).babelEnvs.length > 0,
@@ -153,10 +153,9 @@ export default class MonorepoLernaGenerator extends Generator {
153
153
  packageUtils.removeDevDependencies(pkg, ['standard-version']);
154
154
 
155
155
  const getPobConfig = (config) => ({
156
- ...((config &&
156
+ ...(config &&
157
157
  config.pob &&
158
- (config.pob['pob-config'] || config.pob.lib || config.pob.app)) ||
159
- {}),
158
+ (config.pob['pob-config'] || config.pob.lib || config.pob.app)),
160
159
  });
161
160
  // ynnub doesnt use babel but still have typescript
162
161
  // const withTypescript = this.packagePaths.some((packagePath) =>
@@ -177,12 +176,18 @@ export default class MonorepoLernaGenerator extends Generator {
177
176
  'lint:eslint':
178
177
  monorepoConfig &&
179
178
  monorepoConfig.eslint &&
180
- this.packagesConfig.length < 25
181
- ? 'eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet .'
179
+ this.packagesConfig.length < 50
180
+ ? `${
181
+ this.packagesConfig.length > 20
182
+ ? 'NODE_OPTIONS=--max_old_space_size=4096 '
183
+ : ''
184
+ }eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet .`
182
185
  : // eslint-disable-next-line unicorn/no-nested-ternary
183
186
  this.options.packageManager === 'yarn'
184
- ? 'yarn workspaces foreach --parallel -Av run lint'
185
- : 'lerna run --stream lint',
187
+ ? `NODE_OPTIONS=--max_old_space_size=4096 eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet . --ignore-pattern ${pkg.workspaces.join(
188
+ ',',
189
+ )} && yarn workspaces foreach --parallel -Av run lint:eslint`
190
+ : 'lerna run --stream lint:eslint',
186
191
  });
187
192
 
188
193
  this.fs.copyTpl(
@@ -7,12 +7,19 @@ export default class PobBaseGenerator extends Generator {
7
7
  constructor(args, opts) {
8
8
  super(args, opts, { customInstallTask: true });
9
9
 
10
+ /** @deprecated use monorepo option instead */
10
11
  this.option('lerna', {
11
12
  type: Boolean,
12
13
  required: false,
13
14
  desc: 'Lerna monorepo',
14
15
  });
15
16
 
17
+ this.option('monorepo', {
18
+ type: Boolean,
19
+ required: false,
20
+ desc: 'monorepo',
21
+ });
22
+
16
23
  this.option('type', {
17
24
  type: String,
18
25
  required: true,
@@ -53,7 +60,7 @@ export default class PobBaseGenerator extends Generator {
53
60
  // prettier package.json to ensure diff is correct
54
61
  ensureJsonFileFormatted(this.destinationPath('package.json'));
55
62
 
56
- if (this.options.lerna) {
63
+ if (this.options.monorepo || this.options.lerna) {
57
64
  this.useLerna = true;
58
65
  this.inLerna = false;
59
66
  this.isRoot = true;
@@ -123,6 +130,8 @@ export default class PobBaseGenerator extends Generator {
123
130
  this.composeWith('pob:core:package', {
124
131
  updateOnly: this.options.updateOnly,
125
132
  private: this.useLerna,
133
+ monorepo: this.useLerna,
134
+ isRoot: this.isRoot,
126
135
  });
127
136
 
128
137
  if (this.useLerna) {
@@ -207,6 +216,8 @@ export default class PobBaseGenerator extends Generator {
207
216
  switch (this.projectConfig.type) {
208
217
  case 'lib':
209
218
  this.composeWith('pob:lib', {
219
+ monorepo: this.useLerna,
220
+ isRoot: this.isRoot,
210
221
  updateOnly: this.options.updateOnly,
211
222
  fromPob: this.options.fromPob,
212
223
  packageManager: this.projectConfig.packageManager,
@@ -215,6 +226,8 @@ export default class PobBaseGenerator extends Generator {
215
226
  break;
216
227
  case 'app':
217
228
  this.composeWith('pob:app', {
229
+ monorepo: this.useLerna,
230
+ isRoot: this.isRoot,
218
231
  updateOnly: this.options.updateOnly,
219
232
  fromPob: this.options.fromPob,
220
233
  packageManager: this.projectConfig.packageManager,
package/lib/pob.js CHANGED
@@ -37,9 +37,9 @@ import PobBaseGenerator from './generators/pob/PobBaseGenerator.js';
37
37
  import { __dirname } from './pob-dirname.cjs';
38
38
 
39
39
  const printUsage = () => {
40
- console.error('Usage: pob [lerna] [lib|app]');
41
- console.error(' pob [lerna] update [--force]');
42
- console.error(' pob lerna convert-npm');
40
+ console.error('Usage: pob [monorepo] [lib|app|init]');
41
+ console.error(' pob [monorepo] update [--force]');
42
+ console.error(' pob monorepo convert-npm');
43
43
  console.error(' pob add <packageName>');
44
44
  };
45
45
 
@@ -209,32 +209,27 @@ env.registerStub(
209
209
  `${__dirname}/generators/monorepo/typescript/MonorepoTypescriptGenerator.js`,
210
210
  );
211
211
 
212
- let lerna = argv._[0] === 'lerna';
213
- const action = lerna ? argv._[1] : argv._[0];
212
+ let monorepo = argv._[0] === 'lerna' || argv._[0] === 'monorepo';
213
+ const action = monorepo ? argv._[1] : argv._[0];
214
214
  const projectPkg = readJson(path.resolve('./package.json'));
215
215
 
216
216
  if (action === 'add') {
217
- if (!existsSync('lerna.json')) {
218
- console.error('Not in lerna package');
219
- process.exit(1);
217
+ if (!projectPkg.workspaces) {
218
+ throw new Error(
219
+ 'Missing workspaces field in package.json: not a lerna repo',
220
+ );
220
221
  }
221
222
 
222
- const packageName = argv._[1];
223
+ const packageName = monorepo ? argv._[2] : argv._[1];
223
224
 
224
225
  if (!packageName) {
225
226
  console.error('Missing argument: packageName');
226
227
  printUsage();
227
228
  process.exit(1);
228
229
  }
229
-
230
- const pkg = JSON.parse(readFileSync('package.json'));
231
- if (!pkg.workspaces) {
232
- throw new Error(
233
- 'Missing workspaces field in package.json: not a lerna repo',
234
- );
235
- }
236
-
237
- const packagesPath = pkg.workspaces[0].replace(/\/\*$/, '');
230
+ const packagesPath = packageName.startsWith('@')
231
+ ? packageName
232
+ : projectPkg.workspaces[0].replace(/\/\*$/, '');
238
233
 
239
234
  fs.mkdirSync(`${packagesPath}/${packageName}`, { recursive: true });
240
235
  writeFileSync(`${packagesPath}/${packageName}/.yo-rc.json`, '{}');
@@ -242,14 +237,20 @@ if (action === 'add') {
242
237
  `${packagesPath}/${packageName}/package.json`,
243
238
  JSON.stringify({ name: packageName, version: '1.0.0-pre' }, null, 2),
244
239
  );
245
- spawnSync(process.argv[0], [process.argv[1], 'lib'], {
240
+ console.log('> Creating new Package');
241
+ spawnSync(process.argv[0], [process.argv[1]], {
246
242
  cwd: `${packagesPath}/${packageName}`,
247
243
  stdio: 'inherit',
248
244
  });
245
+
246
+ console.log('> Updating monorepo');
247
+ spawnSync(process.argv[0], [process.argv[1], 'update'], {
248
+ stdio: 'inherit',
249
+ });
249
250
  process.exit(0);
250
251
  }
251
252
 
252
- if (lerna && action === 'convert-npm') {
253
+ if (monorepo && action === 'convert-npm') {
253
254
  execSync('sed -i \'/"npmClient": "yarn",/d\' ./lerna.json', {
254
255
  stdio: 'inherit',
255
256
  });
@@ -260,7 +261,8 @@ if (lerna && action === 'convert-npm') {
260
261
  }
261
262
 
262
263
  const updateOnly = action === 'update';
263
- const type = updateOnly ? null : action;
264
+ const init = action === 'init';
265
+ const type = updateOnly || init ? null : action;
264
266
  const fromPob = updateOnly && argv._[1] === 'from-pob';
265
267
 
266
268
  if (!existsSync('.yo-rc.json')) {
@@ -272,13 +274,14 @@ if (!existsSync('.yo-rc.json')) {
272
274
  }
273
275
 
274
276
  if (existsSync('lerna.json') || (projectPkg && projectPkg.lerna)) {
275
- lerna = true;
277
+ monorepo = true;
276
278
  }
277
279
 
278
280
  const options = {
279
281
  type,
282
+ init,
280
283
  updateOnly,
281
- lerna,
284
+ monorepo,
282
285
  fromPob,
283
286
  force: argv.force,
284
287
  };
@@ -4,7 +4,7 @@ import parseAuthor from 'parse-author';
4
4
  import pobDependencies from 'pob-dependencies';
5
5
  import semver from 'semver';
6
6
 
7
- export { parseAuthor };
7
+ export { default as parseAuthor } from 'parse-author';
8
8
 
9
9
  export const parsePkgAuthor = (pkg) =>
10
10
  typeof pkg.author === 'string' ? parseAuthor(pkg.author) : pkg.author;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "8.8.2",
3
+ "version": "9.0.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "type": "module",
20
20
  "engines": {
21
- "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
21
+ "node": "^14.13.1 || >=16.0.0"
22
22
  },
23
23
  "main": "./lib/index.js",
24
24
  "exports": {
@@ -47,9 +47,9 @@
47
47
  "dependencies": {
48
48
  "@lerna/package-graph": "^4.0.0",
49
49
  "@lerna/project": "^4.0.0",
50
- "@pob/sort-eslint-config": "^2.2.0",
51
- "@pob/sort-object": "^3.2.0",
52
- "@pob/sort-pkg": "^3.3.0",
50
+ "@pob/sort-eslint-config": "^3.0.0",
51
+ "@pob/sort-object": "^4.0.0",
52
+ "@pob/sort-pkg": "^4.0.0",
53
53
  "@yarnpkg/parsers": "^2.2.0",
54
54
  "findup-sync": "^5.0.0",
55
55
  "generator-license": "^5.4.0",
@@ -63,12 +63,12 @@
63
63
  "mem-fs-editor": "8.1.2",
64
64
  "minimist-argv": "^1.1.0",
65
65
  "parse-author": "^2.0.0",
66
- "pob-dependencies": "^5.9.2",
67
- "prettier": "2.4.1",
66
+ "pob-dependencies": "^6.0.0",
67
+ "prettier": "2.5.1",
68
68
  "semver": "^7.3.4",
69
69
  "update-notifier": "^5.0.1",
70
70
  "yeoman-environment": "^3.5.1",
71
71
  "yeoman-generator": "^5.4.0"
72
72
  },
73
- "gitHead": "fb02f559e09921ba0fb110a26cae9dca8053ac80"
73
+ "gitHead": "eec3c30b83fbb8d9dd9caa947c6c64977dd14403"
74
74
  }