pob 14.2.0 → 14.4.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 +35 -0
- package/lib/generators/app/PobAppGenerator.js +7 -7
- package/lib/generators/common/format-lint/CommonLintGenerator.js +27 -20
- package/lib/generators/common/husky/CommonHuskyGenerator.js +3 -3
- package/lib/generators/common/testing/CommonTestingGenerator.js +5 -5
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +5 -5
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +4 -2
- package/lib/generators/core/ci/CoreCIGenerator.js +4 -4
- package/lib/generators/core/npm/CoreNpmGenerator.js +41 -24
- package/lib/generators/core/npm/templates/npmignore.ejs +1 -55
- package/lib/generators/core/package/CorePackageGenerator.js +24 -13
- package/lib/generators/core/renovate/CoreRenovateGenerator.js +3 -3
- package/lib/generators/core/yarn/CoreYarnGenerator.js +2 -2
- package/lib/generators/lib/PobLibGenerator.js +12 -12
- package/lib/generators/lib/doc/LibDocGenerator.js +4 -4
- package/lib/generators/lib/readme/LibReadmeGenerator.js +2 -2
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +1 -1
- package/lib/generators/monorepo/workspaces/templates/workflow-publish.yml.ejs +3 -3
- package/lib/generators/pob/PobBaseGenerator.js +20 -26
- package/lib/pob.js +2 -1
- package/lib/utils/{inLerna.js → inMonorepo.js} +3 -5
- package/package.json +21 -17
- package/.editorconfig +0 -13
- package/.eslintrc.json +0 -4
- package/AUTHORS +0 -1
- package/lib/utils/inNpmLerna.js +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
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
|
+
## [14.4.0](https://github.com/christophehurpeau/pob/compare/pob@14.3.0...pob@14.4.0) (2023-10-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **deps:** update @pob/eslint-config to v51.1.0 ([#1796](https://github.com/christophehurpeau/pob/issues/1796)) ([076afb2](https://github.com/christophehurpeau/pob/commit/076afb27c2225caa416d2160739dc408b6e0ca3a))
|
|
12
|
+
* **deps:** update dependency @yeoman/types to v1.1.1 ([#1811](https://github.com/christophehurpeau/pob/issues/1811)) ([e258f5e](https://github.com/christophehurpeau/pob/commit/e258f5e718d7a5b4723b90d2aa1c1017609489e0))
|
|
13
|
+
* **deps:** update dependency eslint to v8.51.0 ([#1802](https://github.com/christophehurpeau/pob/issues/1802)) ([a116098](https://github.com/christophehurpeau/pob/commit/a1160986eba0dd3be8f0b3ba2f08da2389156ba3))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* change tsBuildInfoFile ([3807a34](https://github.com/christophehurpeau/pob/commit/3807a34652fa4f3b6aa6f1e88d0ce323af5d8265))
|
|
19
|
+
* **deps:** update dependency @types/inquirer to v9.0.4 ([#1806](https://github.com/christophehurpeau/pob/issues/1806)) ([c4df08f](https://github.com/christophehurpeau/pob/commit/c4df08fb1ba7d9ec35f19e01405d2535d4410454))
|
|
20
|
+
* **deps:** update dependency @types/inquirer to v9.0.5 ([#1821](https://github.com/christophehurpeau/pob/issues/1821)) ([6e6d1c0](https://github.com/christophehurpeau/pob/commit/6e6d1c0fea5e2e9fc059146ad5fb207dbfa5fe11))
|
|
21
|
+
* **deps:** update dependency @types/inquirer to v9.0.6 ([#1823](https://github.com/christophehurpeau/pob/issues/1823)) ([d7414f2](https://github.com/christophehurpeau/pob/commit/d7414f2407a5feb6e4727d228a414906b12902b2))
|
|
22
|
+
* **deps:** update dependency mem-fs-editor to v10.0.3 ([#1819](https://github.com/christophehurpeau/pob/issues/1819)) ([a7dfdfc](https://github.com/christophehurpeau/pob/commit/a7dfdfc962c73c7303f4fe89fe0fbc8c2f2a9639))
|
|
23
|
+
* **deps:** update dependency yeoman-generator to v6.0.0-rc.6 ([#1808](https://github.com/christophehurpeau/pob/issues/1808)) ([a044760](https://github.com/christophehurpeau/pob/commit/a044760f7ab299c009fdd41451620f0b8d79be08))
|
|
24
|
+
* **deps:** update yarn monorepo ([#1795](https://github.com/christophehurpeau/pob/issues/1795)) ([c893a31](https://github.com/christophehurpeau/pob/commit/c893a315a1e382e14c5270c4fdc3b3488ddefa30))
|
|
25
|
+
* **pob:** bring back npmignore ([3ac3841](https://github.com/christophehurpeau/pob/commit/3ac38415362e8a6ba3c23db41f404287a82356eb))
|
|
26
|
+
* **pob:** fix monorepo workspaces generator not called ([0baab7c](https://github.com/christophehurpeau/pob/commit/0baab7ccb430cc7f052b343b7d6989cb733a252c))
|
|
27
|
+
* **pob:** fix package generator not working in monorepo ([1c63705](https://github.com/christophehurpeau/pob/commit/1c63705cd809fde7813ef7ac5d2a85c92a53693f))
|
|
28
|
+
* run npm publish in parallel ([7f22704](https://github.com/christophehurpeau/pob/commit/7f22704e7f37c7f6d2907f620e21dcbf8b184fb4))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## [14.3.0](https://github.com/christophehurpeau/pob/compare/pob@14.2.0...pob@14.3.0) (2023-10-02)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* rename publish job to Release ([cc6b66b](https://github.com/christophehurpeau/pob/commit/cc6b66b05469720faa6cb0a05d0a29843dd676cb))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## [14.2.0](https://github.com/christophehurpeau/pob/compare/pob@14.1.0...pob@14.2.0) (2023-09-30)
|
|
7
42
|
|
|
8
43
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { execSync } from 'node:child_process';
|
|
2
2
|
import { platform } from 'node:process';
|
|
3
3
|
import Generator from 'yeoman-generator';
|
|
4
|
-
import
|
|
4
|
+
import inMonorepo from '../../utils/inMonorepo.js';
|
|
5
5
|
import * as packageUtils from '../../utils/package.js';
|
|
6
6
|
import { appIgnorePaths } from './ignorePaths.js';
|
|
7
7
|
|
|
@@ -119,7 +119,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
119
119
|
name: 'ci',
|
|
120
120
|
message: 'Do you want ci ?',
|
|
121
121
|
default: !config || config.ci === undefined ? true : config.ci,
|
|
122
|
-
when: () => !
|
|
122
|
+
when: () => !inMonorepo,
|
|
123
123
|
},
|
|
124
124
|
]);
|
|
125
125
|
|
|
@@ -150,7 +150,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
150
150
|
|
|
151
151
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
152
152
|
|
|
153
|
-
if (!
|
|
153
|
+
if (!inMonorepo || inMonorepo.root) {
|
|
154
154
|
this.composeWith('pob:common:husky', {});
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -207,7 +207,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
207
207
|
this.composeWith('pob:common:remove-old-dependencies');
|
|
208
208
|
|
|
209
209
|
const enableReleasePlease =
|
|
210
|
-
!
|
|
210
|
+
!inMonorepo && this.appConfig.testing && this.appConfig.ci;
|
|
211
211
|
|
|
212
212
|
if (this.appConfig.type !== 'remix') {
|
|
213
213
|
this.composeWith('pob:common:testing', {
|
|
@@ -243,7 +243,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
243
243
|
});
|
|
244
244
|
|
|
245
245
|
this.composeWith('pob:common:release', {
|
|
246
|
-
enable: !
|
|
246
|
+
enable: !inMonorepo && this.appConfig.testing && this.appConfig.ci,
|
|
247
247
|
withBabel: babel,
|
|
248
248
|
documentation: false,
|
|
249
249
|
updateOnly: this.options.updateOnly,
|
|
@@ -251,7 +251,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
this.composeWith('pob:core:vscode', {
|
|
254
|
-
root: !
|
|
254
|
+
root: !inMonorepo,
|
|
255
255
|
monorepo: false,
|
|
256
256
|
packageManager: this.options.packageManager,
|
|
257
257
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
@@ -265,7 +265,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
this.composeWith('pob:core:gitignore', {
|
|
268
|
-
root: !
|
|
268
|
+
root: !inMonorepo || inMonorepo.root,
|
|
269
269
|
documentation: false,
|
|
270
270
|
testing: this.appConfig.testing,
|
|
271
271
|
withBabel: babel,
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import Generator from 'yeoman-generator';
|
|
4
4
|
import ensureJsonFileFormatted from '../../../utils/ensureJsonFileFormatted.js';
|
|
5
|
-
import
|
|
5
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
6
6
|
import * as packageUtils from '../../../utils/package.js';
|
|
7
7
|
import { writeAndFormatJson } from '../../../utils/writeAndFormat.js';
|
|
8
8
|
import { appIgnorePaths } from '../../app/ignorePaths.js';
|
|
@@ -140,7 +140,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
140
140
|
|
|
141
141
|
pkg.prettier = '@pob/root/prettier-config';
|
|
142
142
|
|
|
143
|
-
if (!
|
|
143
|
+
if (!inMonorepo || inMonorepo.root || this.options.monorepo) {
|
|
144
144
|
const rootIgnorePatterns = new Set(
|
|
145
145
|
this.options.rootIgnorePaths.split('\n').filter(Boolean),
|
|
146
146
|
);
|
|
@@ -164,7 +164,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
164
164
|
this.templatePath('prettierignore.ejs'),
|
|
165
165
|
this.destinationPath('.prettierignore'),
|
|
166
166
|
{
|
|
167
|
-
inRoot: !
|
|
167
|
+
inRoot: !inMonorepo || inMonorepo.root || this.options.monorepo,
|
|
168
168
|
documentation: this.options.documentation,
|
|
169
169
|
packageManager: this.options.packageManager,
|
|
170
170
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
@@ -211,23 +211,26 @@ export default class CommonLintGenerator extends Generator {
|
|
|
211
211
|
]);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
const yoConfigPobMonorepo =
|
|
214
|
+
const yoConfigPobMonorepo = inMonorepo && inMonorepo.pobMonorepoConfig;
|
|
215
215
|
const globalEslint =
|
|
216
216
|
this.options.monorepo ||
|
|
217
217
|
(yoConfigPobMonorepo && yoConfigPobMonorepo.eslint !== false);
|
|
218
218
|
const globalTesting = yoConfigPobMonorepo && yoConfigPobMonorepo.testing;
|
|
219
219
|
const composite = yoConfigPobMonorepo && yoConfigPobMonorepo.typescript;
|
|
220
|
-
const { rootPackageManager, rootYarnNodeLinker } =
|
|
220
|
+
const { rootPackageManager, rootYarnNodeLinker } = inMonorepo || {};
|
|
221
221
|
const lernaProjectType =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
inMonorepo.pobConfig &&
|
|
223
|
+
inMonorepo.pobConfig.project &&
|
|
224
|
+
inMonorepo.pobConfig.project.type;
|
|
225
225
|
|
|
226
226
|
if (this.options.monorepo && !globalEslint) {
|
|
227
227
|
throw new Error('Please enable global eslint');
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
if (
|
|
230
|
+
if (
|
|
231
|
+
globalEslint &&
|
|
232
|
+
!((inMonorepo && inMonorepo.root) || this.options.monorepo)
|
|
233
|
+
) {
|
|
231
234
|
if (!pkg.name.startsWith('@pob/eslint-config')) {
|
|
232
235
|
packageUtils.removeDevDependencies(
|
|
233
236
|
pkg,
|
|
@@ -254,7 +257,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
254
257
|
packageUtils.addOrRemoveDevDependencies(
|
|
255
258
|
pkg,
|
|
256
259
|
!globalEslint ||
|
|
257
|
-
(
|
|
260
|
+
(inMonorepo && inMonorepo.root) ||
|
|
258
261
|
this.options.monorepo ||
|
|
259
262
|
lernaProjectType === 'app' ||
|
|
260
263
|
(rootPackageManager === 'yarn' &&
|
|
@@ -283,7 +286,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
283
286
|
['eslint-plugin-node'],
|
|
284
287
|
);
|
|
285
288
|
|
|
286
|
-
if ((
|
|
289
|
+
if ((inMonorepo && inMonorepo.root) || this.options.monorepo) {
|
|
287
290
|
if (this.options.typescript) {
|
|
288
291
|
packageUtils.updateDevDependenciesIfPresent(pkg, [
|
|
289
292
|
'@pob/eslint-config-typescript',
|
|
@@ -418,15 +421,19 @@ export default class CommonLintGenerator extends Generator {
|
|
|
418
421
|
const getRootIgnorePatterns = () => {
|
|
419
422
|
const ignorePatterns = new Set();
|
|
420
423
|
|
|
421
|
-
if (
|
|
424
|
+
if (
|
|
425
|
+
inMonorepo &&
|
|
426
|
+
!inMonorepo.root &&
|
|
427
|
+
(this.options.typescript || pkg.types)
|
|
428
|
+
) {
|
|
422
429
|
ignorePatterns.add('*.d.ts');
|
|
423
430
|
}
|
|
424
431
|
|
|
425
|
-
if (
|
|
432
|
+
if (inMonorepo && inMonorepo.root && this.options.documentation) {
|
|
426
433
|
ignorePatterns.add('/docs');
|
|
427
434
|
}
|
|
428
435
|
|
|
429
|
-
if ((!
|
|
436
|
+
if ((!inMonorepo || !inMonorepo.root) && useBabel) {
|
|
430
437
|
const buildPath = `/${this.options.buildDirectory}`;
|
|
431
438
|
if (
|
|
432
439
|
!this.options.rootIgnorePaths ||
|
|
@@ -435,7 +442,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
435
442
|
ignorePatterns.add(buildPath);
|
|
436
443
|
}
|
|
437
444
|
}
|
|
438
|
-
if (
|
|
445
|
+
if (inMonorepo && inMonorepo.root && this.options.typescript) {
|
|
439
446
|
ignorePatterns.add('/rollup.config.mjs');
|
|
440
447
|
}
|
|
441
448
|
|
|
@@ -478,7 +485,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
478
485
|
}
|
|
479
486
|
// no else: dont delete root eslintrc, src is root
|
|
480
487
|
|
|
481
|
-
if ((
|
|
488
|
+
if ((inMonorepo && inMonorepo.root) || this.options.monorepo) {
|
|
482
489
|
if (this.fs.exists(srcEslintrcPath)) {
|
|
483
490
|
this.fs.delete(srcEslintrcPath);
|
|
484
491
|
}
|
|
@@ -513,7 +520,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
513
520
|
}
|
|
514
521
|
: false,
|
|
515
522
|
},
|
|
516
|
-
relativePath:
|
|
523
|
+
relativePath: inMonorepo ? inMonorepo.relative : undefined,
|
|
517
524
|
},
|
|
518
525
|
);
|
|
519
526
|
|
|
@@ -524,9 +531,9 @@ export default class CommonLintGenerator extends Generator {
|
|
|
524
531
|
}
|
|
525
532
|
|
|
526
533
|
// see monorepo/lerna/index.js
|
|
527
|
-
if (!(
|
|
534
|
+
if (!(inMonorepo && inMonorepo.root) && !this.options.monorepo) {
|
|
528
535
|
const srcDirectory = useBabel ? 'src' : 'lib';
|
|
529
|
-
const lintRootJsFiles = (useBabel && useNode) || !
|
|
536
|
+
const lintRootJsFiles = (useBabel && useNode) || !inMonorepo;
|
|
530
537
|
|
|
531
538
|
const lintPaths = [srcDirectory, 'bin', 'scripts', 'migrations'].filter(
|
|
532
539
|
(dir) => fs.existsSync(this.destinationPath(dir)),
|
|
@@ -548,7 +555,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
548
555
|
lint: `${useBabel && !composite ? 'tsc && ' : ''}yarn run lint:eslint`,
|
|
549
556
|
});
|
|
550
557
|
|
|
551
|
-
if (!
|
|
558
|
+
if (!inMonorepo) {
|
|
552
559
|
pkg.scripts.lint = `yarn run lint:prettier && ${pkg.scripts.lint}`;
|
|
553
560
|
packageUtils.addScripts(pkg, {
|
|
554
561
|
'lint:prettier': 'pob-root-prettier --check .',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readlinkSync, rmSync } from 'node:fs';
|
|
2
2
|
import Generator from 'yeoman-generator';
|
|
3
|
-
import
|
|
3
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
4
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
5
5
|
|
|
6
6
|
export default class CommonHuskyGenerator extends Generator {
|
|
@@ -58,14 +58,14 @@ export default class CommonHuskyGenerator extends Generator {
|
|
|
58
58
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
59
59
|
packageUtils.removeDevDependencies(pkg, ['husky']);
|
|
60
60
|
|
|
61
|
-
if (!
|
|
61
|
+
if (!inMonorepo || inMonorepo.root) {
|
|
62
62
|
if (pkg.name !== 'pob-monorepo') {
|
|
63
63
|
packageUtils.removeDevDependencies(pkg, [
|
|
64
64
|
'@pob/repo-config',
|
|
65
65
|
'repository-check-dirty',
|
|
66
66
|
]);
|
|
67
67
|
packageUtils.addDevDependencies(pkg, ['@pob/root']);
|
|
68
|
-
// packageUtils.addOrRemoveDevDependencies(pkg,
|
|
68
|
+
// packageUtils.addOrRemoveDevDependencies(pkg, inMonorepo, {
|
|
69
69
|
// '@commitlint/config-lerna-scopes': '6.1.3',
|
|
70
70
|
// });
|
|
71
71
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import Generator from 'yeoman-generator';
|
|
3
|
-
import
|
|
3
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
4
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
5
5
|
import {
|
|
6
6
|
copyAndFormatTpl,
|
|
@@ -110,7 +110,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
default() {
|
|
113
|
-
if (!
|
|
113
|
+
if (!inMonorepo || inMonorepo.root) {
|
|
114
114
|
this.composeWith('pob:core:ci', {
|
|
115
115
|
enable: this.options.ci,
|
|
116
116
|
enableReleasePlease: this.options.enableReleasePlease,
|
|
@@ -146,7 +146,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
146
146
|
'pob-lcov-reporter',
|
|
147
147
|
]);
|
|
148
148
|
|
|
149
|
-
const yoConfigPobMonorepo =
|
|
149
|
+
const yoConfigPobMonorepo = inMonorepo && inMonorepo.pobMonorepoConfig;
|
|
150
150
|
const globalTesting = yoConfigPobMonorepo && yoConfigPobMonorepo.testing;
|
|
151
151
|
const enableForMonorepo = this.options.monorepo && globalTesting;
|
|
152
152
|
const transpileWithEsbuild = packageUtils.transpileWithEsbuild(pkg);
|
|
@@ -179,7 +179,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
if (!this.options.enable) {
|
|
182
|
-
// if (
|
|
182
|
+
// if (inMonorepo) {
|
|
183
183
|
// if (pkg.scripts.test === 'echo "No tests"') {
|
|
184
184
|
// delete pkg.scripts.test;
|
|
185
185
|
// }
|
|
@@ -287,7 +287,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
287
287
|
const transpileWithBabel = packageUtils.transpileWithBabel(pkg);
|
|
288
288
|
|
|
289
289
|
const shouldUseExperimentalVmModules =
|
|
290
|
-
pkg.type === 'module' && !
|
|
290
|
+
pkg.type === 'module' && !inMonorepo;
|
|
291
291
|
|
|
292
292
|
const testCommand =
|
|
293
293
|
this.options.runner === 'jest'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import Generator from 'yeoman-generator';
|
|
3
|
-
import
|
|
3
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
4
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
5
5
|
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
6
6
|
|
|
@@ -120,8 +120,8 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
120
120
|
// let monorepoPackageBuildReferences;
|
|
121
121
|
let monorepoPackageSrcPaths;
|
|
122
122
|
|
|
123
|
-
if (
|
|
124
|
-
const yoConfig =
|
|
123
|
+
if (inMonorepo && !inMonorepo.root) {
|
|
124
|
+
const yoConfig = inMonorepo.rootYoConfig;
|
|
125
125
|
|
|
126
126
|
composite =
|
|
127
127
|
yoConfig.pob &&
|
|
@@ -131,7 +131,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
131
131
|
if (composite) {
|
|
132
132
|
packageUtils.addOrRemoveDevDependencies(
|
|
133
133
|
pkg,
|
|
134
|
-
|
|
134
|
+
inMonorepo.rootPackageManager === 'yarn',
|
|
135
135
|
['typescript'],
|
|
136
136
|
);
|
|
137
137
|
|
|
@@ -226,7 +226,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
226
226
|
// this.templatePath('tsconfig.build.json.ejs'),
|
|
227
227
|
// tsconfigBuildPath,
|
|
228
228
|
// {
|
|
229
|
-
// inMonorepo:
|
|
229
|
+
// inMonorepo: inMonorepo && !inMonorepo.root,
|
|
230
230
|
// jsx,
|
|
231
231
|
// composite,
|
|
232
232
|
// monorepoPackageSrcPaths,
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
"newLine": "lf",
|
|
18
18
|
<% if (emit) { -%>
|
|
19
19
|
"outDir": "dist/definitions",
|
|
20
|
-
<% if (composite) {
|
|
21
|
-
|
|
20
|
+
<% if (composite) {
|
|
21
|
+
// dont emit in dist/definitions to avoid publish to npm
|
|
22
|
+
-%>
|
|
23
|
+
"tsBuildInfoFile": "node_modules/.cache/tsc/tsbuildinfo",
|
|
22
24
|
<% } -%>
|
|
23
25
|
<% } else if (composite) { -%>
|
|
24
26
|
<% if (cacheEnabled) { -%>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import Generator from 'yeoman-generator';
|
|
3
|
-
import
|
|
3
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
4
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
5
5
|
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
6
6
|
|
|
@@ -155,9 +155,9 @@ export default class CoreCIGenerator extends Generator {
|
|
|
155
155
|
publishSinglePackage: this.isReleasePleaseEnabled && !pkg.private,
|
|
156
156
|
publishMonorepo:
|
|
157
157
|
this.isReleasePleaseEnabled &&
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
inMonorepo &&
|
|
159
|
+
inMonorepo.root &&
|
|
160
|
+
inMonorepo.pobConfig?.project?.type === 'lib',
|
|
161
161
|
},
|
|
162
162
|
);
|
|
163
163
|
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
1
|
import Generator from 'yeoman-generator';
|
|
3
|
-
import inLerna from '../../../utils/inLerna.js';
|
|
4
2
|
|
|
5
3
|
export default class CoreNpmGenerator extends Generator {
|
|
6
4
|
constructor(args, opts) {
|
|
@@ -12,17 +10,18 @@ export default class CoreNpmGenerator extends Generator {
|
|
|
12
10
|
default: true,
|
|
13
11
|
desc: 'Enable npm',
|
|
14
12
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
|
|
14
|
+
this.option('srcDirectory', {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
default: 'lib',
|
|
18
|
+
desc: 'src directory to include in published files',
|
|
20
19
|
});
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
|
|
21
|
+
this.option('distDirectory', {
|
|
22
|
+
type: String,
|
|
23
23
|
required: false,
|
|
24
|
-
|
|
25
|
-
desc: 'Enabled testing',
|
|
24
|
+
desc: 'dist directory to include in published files',
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -30,25 +29,43 @@ export default class CoreNpmGenerator extends Generator {
|
|
|
30
29
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
|
|
31
30
|
|
|
32
31
|
if (!pkg.private && this.options.enable) {
|
|
33
|
-
const babelEnvs = pkg.pob.babelEnvs || [];
|
|
34
|
-
const withBabel = babelEnvs.length > 0;
|
|
35
|
-
|
|
36
32
|
this.fs.copyTpl(
|
|
37
33
|
this.templatePath('npmignore.ejs'),
|
|
38
34
|
this.destinationPath('.npmignore'),
|
|
39
|
-
{
|
|
40
|
-
inLerna,
|
|
41
|
-
ci: this.options.ci,
|
|
42
|
-
testing: this.options.testing,
|
|
43
|
-
babel: withBabel,
|
|
44
|
-
typedoc: pkg.devDependencies && pkg.devDependencies.typedoc,
|
|
45
|
-
yarn: fs.existsSync('.yarnrc.yml'),
|
|
46
|
-
npm: this.fs.exists('package-lock.json'),
|
|
47
|
-
codeclimate: this.fs.exists('.codeclimate.yml'),
|
|
48
|
-
},
|
|
35
|
+
{},
|
|
49
36
|
);
|
|
50
37
|
} else if (this.fs.exists(this.destinationPath('.npmignore'))) {
|
|
51
38
|
this.fs.delete(this.destinationPath('.npmignore'));
|
|
52
39
|
}
|
|
40
|
+
|
|
41
|
+
if (!pkg.private && this.options.enable) {
|
|
42
|
+
const files = new Set([
|
|
43
|
+
this.options.srcDirectory,
|
|
44
|
+
this.options.distDirectory,
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
if (pkg.bin) {
|
|
48
|
+
files.add('bin');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (pkg.exports) {
|
|
52
|
+
Object.values(pkg.exports).forEach((value) => {
|
|
53
|
+
if (
|
|
54
|
+
typeof value === 'string' &&
|
|
55
|
+
value.startsWith('./') &&
|
|
56
|
+
value !== './package.json' &&
|
|
57
|
+
![...files].some((file) => value.startsWith(`./${file}/`))
|
|
58
|
+
) {
|
|
59
|
+
files.add(value.slice('./'.length));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
pkg.files = [...files].filter(Boolean);
|
|
65
|
+
} else {
|
|
66
|
+
delete pkg.files;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
53
70
|
}
|
|
54
71
|
}
|
|
@@ -1,55 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/.husky
|
|
3
|
-
<% } -%>
|
|
4
|
-
<% if (!inLerna) { -%>
|
|
5
|
-
/.github
|
|
6
|
-
<% } -%>
|
|
7
|
-
<% if (!inLerna && codeclimate) { -%>
|
|
8
|
-
/.codeclimate.yml
|
|
9
|
-
<% } -%>
|
|
10
|
-
/build
|
|
11
|
-
/docs
|
|
12
|
-
/examples
|
|
13
|
-
/samples
|
|
14
|
-
/test
|
|
15
|
-
/*.config.js
|
|
16
|
-
/*.config.cjs
|
|
17
|
-
/*.config.mjs
|
|
18
|
-
<% if (babel) { -%>
|
|
19
|
-
/tsconfig.json
|
|
20
|
-
/dist/definitions/tsbuildinfo
|
|
21
|
-
<% if (typedoc) { -%>
|
|
22
|
-
/tsconfig.doc.json
|
|
23
|
-
<% } -%>
|
|
24
|
-
babel.config.json
|
|
25
|
-
<% } -%>
|
|
26
|
-
<% if (testing) { -%>
|
|
27
|
-
__snapshots__
|
|
28
|
-
/coverage
|
|
29
|
-
<% } -%>
|
|
30
|
-
.yo-rc.json
|
|
31
|
-
<% if (!inLerna) { -%>
|
|
32
|
-
/renovate.json
|
|
33
|
-
<% if (yarn) { -%>
|
|
34
|
-
/yarn.lock
|
|
35
|
-
/.yarn
|
|
36
|
-
/.yarnrc.yml
|
|
37
|
-
/.pnp.*
|
|
38
|
-
<% } -%>
|
|
39
|
-
<% } -%>
|
|
40
|
-
|
|
41
|
-
/.settings
|
|
42
|
-
/.project
|
|
43
|
-
/.idea
|
|
44
|
-
/.vscode
|
|
45
|
-
*.sublime-project
|
|
46
|
-
*.sublime-workspace
|
|
47
|
-
|
|
48
|
-
#*
|
|
49
|
-
*$
|
|
50
|
-
*.BAK
|
|
51
|
-
*.bak
|
|
52
|
-
*.log
|
|
53
|
-
*.old
|
|
54
|
-
*~
|
|
55
|
-
.#*
|
|
1
|
+
# keep an empty file to avoid using gitignore.
|
|
@@ -2,20 +2,27 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import askName from 'inquirer-npm-name';
|
|
4
4
|
import Generator from 'yeoman-generator';
|
|
5
|
-
import
|
|
5
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
6
6
|
import * as packageUtils from '../../../utils/package.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('
|
|
12
|
+
this.option('isMonorepo', {
|
|
13
13
|
type: Boolean,
|
|
14
14
|
required: true,
|
|
15
15
|
default: false,
|
|
16
16
|
desc: 'is monorepo',
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
+
this.option('inMonorepo', {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
required: true,
|
|
22
|
+
default: false,
|
|
23
|
+
desc: 'in monorepo',
|
|
24
|
+
});
|
|
25
|
+
|
|
19
26
|
this.option('isRoot', {
|
|
20
27
|
type: Boolean,
|
|
21
28
|
required: true,
|
|
@@ -46,7 +53,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
if (!this.options.updateOnly) {
|
|
49
|
-
if (this.options.
|
|
56
|
+
if (this.options.isMonorepo && this.options.isRoot) {
|
|
50
57
|
pkg.private = true;
|
|
51
58
|
} else if (this.options.private) {
|
|
52
59
|
pkg.private = true;
|
|
@@ -65,7 +72,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
65
72
|
}
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
if (this.options.
|
|
75
|
+
if (this.options.isMonorepo && this.options.isRoot) {
|
|
69
76
|
if (!pkg.name) {
|
|
70
77
|
const { name } = await this.prompt({
|
|
71
78
|
name: 'name',
|
|
@@ -96,7 +103,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
96
103
|
const props = await this.prompt(
|
|
97
104
|
[
|
|
98
105
|
!this.options.updateOnly &&
|
|
99
|
-
!(this.options.
|
|
106
|
+
!(this.options.isMonorepo && this.options.isRoot) && {
|
|
100
107
|
name: 'description',
|
|
101
108
|
message: 'Description',
|
|
102
109
|
default: pkg.description,
|
|
@@ -136,7 +143,11 @@ export default class CorePackageGenerator extends Generator {
|
|
|
136
143
|
);
|
|
137
144
|
|
|
138
145
|
if (!pkg.type) pkg.type = props.type;
|
|
139
|
-
if (
|
|
146
|
+
if (
|
|
147
|
+
inMonorepo &&
|
|
148
|
+
!inMonorepo.root &&
|
|
149
|
+
inMonorepo.rootMonorepoPkg.type === 'module'
|
|
150
|
+
) {
|
|
140
151
|
pkg.type = 'module';
|
|
141
152
|
}
|
|
142
153
|
|
|
@@ -144,8 +155,8 @@ export default class CorePackageGenerator extends Generator {
|
|
|
144
155
|
? pkg.description
|
|
145
156
|
: props.description || pkg.description;
|
|
146
157
|
|
|
147
|
-
if (this.options.
|
|
148
|
-
const rootMonorepoPkg =
|
|
158
|
+
if (this.options.inMonorepo && !this.options.isRoot) {
|
|
159
|
+
const rootMonorepoPkg = inMonorepo.rootMonorepoPkg;
|
|
149
160
|
const rootRepositoryUrl =
|
|
150
161
|
typeof rootMonorepoPkg.repository === 'string'
|
|
151
162
|
? rootMonorepoPkg.repository
|
|
@@ -153,7 +164,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
153
164
|
pkg.repository = {
|
|
154
165
|
type: 'git',
|
|
155
166
|
url: rootRepositoryUrl,
|
|
156
|
-
directory: process.cwd().slice(
|
|
167
|
+
directory: process.cwd().slice(inMonorepo.rootPath.length + 1),
|
|
157
168
|
};
|
|
158
169
|
pkg.homepage = rootMonorepoPkg.homepage;
|
|
159
170
|
|
|
@@ -165,9 +176,9 @@ export default class CorePackageGenerator extends Generator {
|
|
|
165
176
|
fs.unlinkSync(this.destinationPath('yarn-error.log'));
|
|
166
177
|
}
|
|
167
178
|
|
|
168
|
-
if (this.options.
|
|
179
|
+
if (this.options.inMonorepo && !this.options.isRoot) {
|
|
169
180
|
packageUtils.removeScripts(pkg, ['checks']);
|
|
170
|
-
} else if (this.options.
|
|
181
|
+
} else if (this.options.isMonorepo && this.options.isRoot) {
|
|
171
182
|
const doesMjsCheckPackagesExists = this.fs.exists(
|
|
172
183
|
this.destinationPath('scripts/check-packages.mjs'),
|
|
173
184
|
);
|
|
@@ -193,7 +204,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
193
204
|
}`,
|
|
194
205
|
},
|
|
195
206
|
);
|
|
196
|
-
} else if (
|
|
207
|
+
} else if (inMonorepo && !inMonorepo.root) {
|
|
197
208
|
if (this.fs.exists('scripts/check-package.js')) {
|
|
198
209
|
this.fs.delete('scripts/check-package.js');
|
|
199
210
|
}
|
|
@@ -303,7 +314,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
303
314
|
}
|
|
304
315
|
}
|
|
305
316
|
};
|
|
306
|
-
if (this.options.
|
|
317
|
+
if (this.options.inMonorepo || inMonorepo || pkg.private) {
|
|
307
318
|
uninstallPostinstallScript('postinstallDev');
|
|
308
319
|
if (this.options.isRoot) {
|
|
309
320
|
installPostinstallScript('postinstall');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Generator from 'yeoman-generator';
|
|
2
|
-
import
|
|
2
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
3
3
|
import { writeAndFormatJson } from '../../../utils/writeAndFormat.js';
|
|
4
4
|
|
|
5
5
|
export default class CoreRenovateGenerator extends Generator {
|
|
@@ -29,7 +29,7 @@ export default class CoreRenovateGenerator extends Generator {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
initializing() {
|
|
32
|
-
if (
|
|
32
|
+
if (inMonorepo && !inMonorepo.root) {
|
|
33
33
|
this.enableRenovate = false;
|
|
34
34
|
this.config.delete('renovate');
|
|
35
35
|
return;
|
|
@@ -39,7 +39,7 @@ export default class CoreRenovateGenerator extends Generator {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
async prompting() {
|
|
42
|
-
if (
|
|
42
|
+
if (inMonorepo && !inMonorepo.root) {
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import yml from 'js-yaml';
|
|
3
3
|
import Generator from 'yeoman-generator';
|
|
4
4
|
import ensureJsonFileFormatted from '../../../utils/ensureJsonFileFormatted.js';
|
|
5
|
-
import
|
|
5
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
6
6
|
import * as packageUtils from '../../../utils/package.js';
|
|
7
7
|
import { writeAndFormat } from '../../../utils/writeAndFormat.js';
|
|
8
8
|
|
|
@@ -97,7 +97,7 @@ export default class CoreYarnGenerator extends Generator {
|
|
|
97
97
|
const workspacesPluginName = '@yarnpkg/plugin-workspace-tools';
|
|
98
98
|
const versionPluginName = '@yarnpkg/plugin-conventional-version';
|
|
99
99
|
|
|
100
|
-
if (!
|
|
100
|
+
if (!inMonorepo && !pkg.private) {
|
|
101
101
|
installPluginIfNotInstalled(
|
|
102
102
|
postinstallDevPluginName,
|
|
103
103
|
'https://raw.githubusercontent.com/sachinraja/yarn-plugin-postinstall-dev/main/bundles/%40yarnpkg/plugin-postinstall-dev.js',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs, { rmSync } from 'node:fs';
|
|
2
2
|
import Generator from 'yeoman-generator';
|
|
3
|
-
import
|
|
3
|
+
import inMonorepo from '../../utils/inMonorepo.js';
|
|
4
4
|
import * as packageUtils from '../../utils/package.js';
|
|
5
5
|
|
|
6
6
|
export default class PobLibGenerator extends Generator {
|
|
@@ -164,7 +164,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
164
164
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
165
165
|
|
|
166
166
|
// documentation
|
|
167
|
-
if (
|
|
167
|
+
if (inMonorepo && !inMonorepo.root) {
|
|
168
168
|
this.pobjson.documentation = false;
|
|
169
169
|
} else if (!this.updateOnly) {
|
|
170
170
|
const answers = await this.prompt([
|
|
@@ -209,7 +209,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
209
209
|
});
|
|
210
210
|
this.pobjson.testing = !testing ? false : this.pobjson.testing || {};
|
|
211
211
|
|
|
212
|
-
if (this.pobjson.testing && !(
|
|
212
|
+
if (this.pobjson.testing && !(inMonorepo || inMonorepo.root)) {
|
|
213
213
|
const testingPrompts = await this.prompt([
|
|
214
214
|
{
|
|
215
215
|
type: 'confirm',
|
|
@@ -229,16 +229,16 @@ export default class PobLibGenerator extends Generator {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
232
|
-
}
|
|
233
232
|
|
|
234
|
-
default() {
|
|
235
233
|
this.composeWith('pob:common:babel', {
|
|
236
234
|
updateOnly: this.options.updateOnly,
|
|
237
235
|
testing: !!this.pobjson.testing,
|
|
238
236
|
documentation: !!this.pobjson.documentation,
|
|
239
237
|
fromPob: this.options.fromPob,
|
|
240
238
|
});
|
|
239
|
+
}
|
|
241
240
|
|
|
241
|
+
default() {
|
|
242
242
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
243
243
|
const babelEnvs = pkg.pob.babelEnvs || [];
|
|
244
244
|
|
|
@@ -267,7 +267,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
267
267
|
this.composeWith('pob:common:remove-old-dependencies');
|
|
268
268
|
|
|
269
269
|
const enableReleasePlease =
|
|
270
|
-
!
|
|
270
|
+
!inMonorepo && this.pobjson.testing && this.pobjson.testing.ci;
|
|
271
271
|
|
|
272
272
|
this.composeWith('pob:common:testing', {
|
|
273
273
|
enable: this.pobjson.testing,
|
|
@@ -312,14 +312,14 @@ export default class PobLibGenerator extends Generator {
|
|
|
312
312
|
});
|
|
313
313
|
|
|
314
314
|
this.composeWith('pob:common:release', {
|
|
315
|
-
enable: !
|
|
315
|
+
enable: !inMonorepo && this.pobjson.testing && this.pobjson.testing.ci,
|
|
316
316
|
withBabel: babelEnvs.length > 0,
|
|
317
317
|
documentation: !!this.pobjson.documentation,
|
|
318
318
|
updateOnly: this.options.updateOnly,
|
|
319
319
|
});
|
|
320
320
|
|
|
321
321
|
this.composeWith('pob:core:vscode', {
|
|
322
|
-
root: !
|
|
322
|
+
root: !inMonorepo,
|
|
323
323
|
monorepo: false,
|
|
324
324
|
packageManager: this.options.packageManager,
|
|
325
325
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
@@ -329,7 +329,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
329
329
|
|
|
330
330
|
// must be after doc, testing
|
|
331
331
|
this.composeWith('pob:core:gitignore', {
|
|
332
|
-
root: !
|
|
332
|
+
root: !inMonorepo,
|
|
333
333
|
withBabel: babelEnvs.length > 0,
|
|
334
334
|
typescript: babelEnvs.length > 0,
|
|
335
335
|
documentation: this.pobjson.documentation,
|
|
@@ -338,8 +338,8 @@ export default class PobLibGenerator extends Generator {
|
|
|
338
338
|
|
|
339
339
|
this.composeWith('pob:core:npm', {
|
|
340
340
|
enable: !pkg.private,
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
srcDirectory: withBabel ? 'src' : 'lib',
|
|
342
|
+
distDirectory: withBabel ? 'dist' : '',
|
|
343
343
|
});
|
|
344
344
|
}
|
|
345
345
|
|
|
@@ -358,7 +358,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
358
358
|
const withBabel = Boolean(pkg.pob.babelEnvs);
|
|
359
359
|
|
|
360
360
|
packageUtils.removeDevDependencies(pkg, ['lerna', '@pob/lerna-light']);
|
|
361
|
-
if (
|
|
361
|
+
if (inMonorepo) {
|
|
362
362
|
if (pkg.scripts) {
|
|
363
363
|
if (pkg.name !== 'pob-dependencies') {
|
|
364
364
|
delete pkg.scripts.preversion;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Generator from 'yeoman-generator';
|
|
2
|
-
import
|
|
2
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
3
3
|
import * as packageUtils from '../../../utils/package.js';
|
|
4
4
|
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
5
5
|
|
|
@@ -50,7 +50,7 @@ export default class LibDocGenerator extends Generator {
|
|
|
50
50
|
? pkg.pob.jsx
|
|
51
51
|
: packageUtils.hasReact(pkg);
|
|
52
52
|
|
|
53
|
-
if (
|
|
53
|
+
if (inMonorepo && inMonorepo.root) {
|
|
54
54
|
const existingConfig = this.fs.readJSON(
|
|
55
55
|
this.destinationPath('tsconfig.doc.json'),
|
|
56
56
|
{ typedocOptions: {} },
|
|
@@ -133,12 +133,12 @@ export default class LibDocGenerator extends Generator {
|
|
|
133
133
|
|
|
134
134
|
// packageUtils.addOrRemoveDevDependencies(
|
|
135
135
|
// pkg,
|
|
136
|
-
// this.options.enabled &&
|
|
136
|
+
// this.options.enabled && inMonorepo && inMonorepo.root,
|
|
137
137
|
// ['@chrp/typedoc-plugin-lerna-packages'],
|
|
138
138
|
// );
|
|
139
139
|
// packageUtils.addOrRemoveDependenciesMeta(
|
|
140
140
|
// pkg,
|
|
141
|
-
// this.options.enabled &&
|
|
141
|
+
// this.options.enabled && inMonorepo && inMonorepo.root,
|
|
142
142
|
// {
|
|
143
143
|
// 'typedoc-neo-theme': {
|
|
144
144
|
// unplugged: true,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import camelCase from 'lodash.camelcase';
|
|
2
2
|
import Generator from 'yeoman-generator';
|
|
3
|
-
import
|
|
3
|
+
import inMonorepo from '../../../utils/inMonorepo.js';
|
|
4
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
5
5
|
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
6
6
|
|
|
@@ -81,7 +81,7 @@ export default class LibReadmeGenerator extends Generator {
|
|
|
81
81
|
packageName: pkg.name,
|
|
82
82
|
camelCaseProjectName: camelCase(pkg.name),
|
|
83
83
|
description: pkg.description,
|
|
84
|
-
|
|
84
|
+
inMonorepo,
|
|
85
85
|
gitHost,
|
|
86
86
|
gitAccount,
|
|
87
87
|
gitName,
|
|
@@ -4,7 +4,7 @@ import Generator from 'yeoman-generator';
|
|
|
4
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
5
5
|
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
6
6
|
|
|
7
|
-
export default class
|
|
7
|
+
export default class MonorepoWorkspacesGenerator extends Generator {
|
|
8
8
|
constructor(args, opts) {
|
|
9
9
|
super(args, opts);
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: Release
|
|
2
2
|
on:
|
|
3
3
|
workflow_dispatch:
|
|
4
4
|
inputs:
|
|
@@ -20,7 +20,7 @@ on:
|
|
|
20
20
|
<% } -%>
|
|
21
21
|
|
|
22
22
|
jobs:
|
|
23
|
-
|
|
23
|
+
release:
|
|
24
24
|
runs-on: ubuntu-latest
|
|
25
25
|
steps:
|
|
26
26
|
- uses: actions/checkout@v4
|
|
@@ -74,7 +74,7 @@ jobs:
|
|
|
74
74
|
fi
|
|
75
75
|
echo >> ./.yarnrc.yml
|
|
76
76
|
echo "npmAuthToken: $NODE_AUTH_TOKEN" >> ./.yarnrc.yml
|
|
77
|
-
yarn workspaces foreach --no-private npm publish --tolerate-republish
|
|
77
|
+
yarn workspaces foreach --parallel --no-private npm publish --tolerate-republish
|
|
78
78
|
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
79
79
|
env:
|
|
80
80
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import { fileURLToPath } from 'node:url';
|
|
2
2
|
import Generator from 'yeoman-generator';
|
|
3
3
|
import ensureJsonFileFormatted from '../../utils/ensureJsonFileFormatted.js';
|
|
4
|
-
import
|
|
4
|
+
import inMonorepo from '../../utils/inMonorepo.js';
|
|
5
5
|
import * as packageUtils from '../../utils/package.js';
|
|
6
6
|
|
|
7
7
|
export default class PobBaseGenerator extends Generator {
|
|
8
8
|
constructor(args, opts) {
|
|
9
9
|
super(args, opts, { customInstallTask: true });
|
|
10
10
|
|
|
11
|
-
/** @deprecated use monorepo option instead */
|
|
12
|
-
this.option('lerna', {
|
|
13
|
-
type: Boolean,
|
|
14
|
-
required: false,
|
|
15
|
-
desc: 'Lerna monorepo',
|
|
16
|
-
});
|
|
17
|
-
|
|
18
11
|
this.option('monorepo', {
|
|
19
12
|
type: Boolean,
|
|
20
13
|
required: false,
|
|
@@ -54,14 +47,14 @@ export default class PobBaseGenerator extends Generator {
|
|
|
54
47
|
// prettier package.json to ensure diff is correct
|
|
55
48
|
ensureJsonFileFormatted(this.destinationPath('package.json'));
|
|
56
49
|
|
|
57
|
-
if (this.options.monorepo
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
50
|
+
if (this.options.monorepo) {
|
|
51
|
+
this.isMonorepo = true;
|
|
52
|
+
this.hasAncestor = false;
|
|
60
53
|
this.isRoot = true;
|
|
61
54
|
} else {
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
this.isRoot = !
|
|
55
|
+
this.isMonorepo = inMonorepo && inMonorepo.root;
|
|
56
|
+
this.hasAncestor = inMonorepo && !inMonorepo.root;
|
|
57
|
+
this.isRoot = !inMonorepo || this.isMonorepo;
|
|
65
58
|
}
|
|
66
59
|
}
|
|
67
60
|
|
|
@@ -130,12 +123,13 @@ export default class PobBaseGenerator extends Generator {
|
|
|
130
123
|
|
|
131
124
|
this.composeWith('pob:core:package', {
|
|
132
125
|
updateOnly: this.options.updateOnly,
|
|
133
|
-
private: this.
|
|
134
|
-
|
|
126
|
+
private: this.isMonorepo,
|
|
127
|
+
isMonorepo: this.isMonorepo,
|
|
128
|
+
inMonorepo: !!inMonorepo,
|
|
135
129
|
isRoot: this.isRoot,
|
|
136
130
|
});
|
|
137
131
|
|
|
138
|
-
if (this.
|
|
132
|
+
if (this.isMonorepo) {
|
|
139
133
|
this.composeWith('pob:monorepo:workspaces', {
|
|
140
134
|
force: this.options.force,
|
|
141
135
|
isAppProject: this.projectConfig.type === 'app',
|
|
@@ -166,13 +160,13 @@ export default class PobBaseGenerator extends Generator {
|
|
|
166
160
|
|
|
167
161
|
const onlyLatestLTS =
|
|
168
162
|
this.projectConfig.type === 'app' ||
|
|
169
|
-
(
|
|
170
|
-
(
|
|
171
|
-
|
|
163
|
+
(inMonorepo &&
|
|
164
|
+
(inMonorepo.pobConfig?.project?.supportsNode14 === false ||
|
|
165
|
+
inMonorepo.pobConfig?.project?.onlyLatestLTS === true));
|
|
172
166
|
|
|
173
|
-
if (!this.
|
|
167
|
+
if (!this.hasAncestor) {
|
|
174
168
|
const splitCIJobs =
|
|
175
|
-
|
|
169
|
+
inMonorepo && inMonorepo.pobMonorepoConfig?.packageNames.length > 8;
|
|
176
170
|
this.composeWith('pob:core:git', {
|
|
177
171
|
onlyLatestLTS,
|
|
178
172
|
splitCIJobs,
|
|
@@ -197,7 +191,7 @@ export default class PobBaseGenerator extends Generator {
|
|
|
197
191
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
198
192
|
}
|
|
199
193
|
|
|
200
|
-
if (this.
|
|
194
|
+
if (this.isMonorepo) {
|
|
201
195
|
this.composeWith(
|
|
202
196
|
// pob:monorepo <= for searching PobMonorepoGenerator.js
|
|
203
197
|
fileURLToPath(
|
|
@@ -216,7 +210,7 @@ export default class PobBaseGenerator extends Generator {
|
|
|
216
210
|
switch (this.projectConfig.type) {
|
|
217
211
|
case 'lib':
|
|
218
212
|
this.composeWith('pob:lib', {
|
|
219
|
-
monorepo: this.
|
|
213
|
+
monorepo: this.isMonorepo,
|
|
220
214
|
isRoot: this.isRoot,
|
|
221
215
|
disableYarnGitCache: this.projectConfig.disableYarnGitCache,
|
|
222
216
|
updateOnly: this.options.updateOnly,
|
|
@@ -227,7 +221,7 @@ export default class PobBaseGenerator extends Generator {
|
|
|
227
221
|
break;
|
|
228
222
|
case 'app':
|
|
229
223
|
this.composeWith('pob:app', {
|
|
230
|
-
monorepo: this.
|
|
224
|
+
monorepo: this.isMonorepo,
|
|
231
225
|
isRoot: this.isRoot,
|
|
232
226
|
disableYarnGitCache: this.projectConfig.disableYarnGitCache,
|
|
233
227
|
updateOnly: this.options.updateOnly,
|
|
@@ -256,7 +250,7 @@ export default class PobBaseGenerator extends Generator {
|
|
|
256
250
|
}
|
|
257
251
|
|
|
258
252
|
end() {
|
|
259
|
-
if (this.
|
|
253
|
+
if (this.isMonorepo && !this.options.updateOnly) {
|
|
260
254
|
console.log('To create a new lerna package: ');
|
|
261
255
|
console.log(' pob add <packageName>');
|
|
262
256
|
}
|
package/lib/pob.js
CHANGED
|
@@ -38,6 +38,7 @@ import LibDocGenerator from './generators/lib/doc/LibDocGenerator.js';
|
|
|
38
38
|
import LibReadmeGenerator from './generators/lib/readme/LibReadmeGenerator.js';
|
|
39
39
|
import MonorepoLernaGenerator from './generators/monorepo/lerna/MonorepoLernaGenerator.js';
|
|
40
40
|
import MonorepoTypescriptGenerator from './generators/monorepo/typescript/MonorepoTypescriptGenerator.js';
|
|
41
|
+
import MonorepoWorkspacesGenerator from './generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js';
|
|
41
42
|
import PobBaseGenerator from './generators/pob/PobBaseGenerator.js';
|
|
42
43
|
import { __dirname } from './pob-dirname.cjs';
|
|
43
44
|
|
|
@@ -208,7 +209,7 @@ env.registerStub(
|
|
|
208
209
|
`${__dirname}/generators/lib/readme/LibReadmeGenerator.js`,
|
|
209
210
|
);
|
|
210
211
|
env.registerStub(
|
|
211
|
-
|
|
212
|
+
MonorepoWorkspacesGenerator,
|
|
212
213
|
'pob:monorepo:workspaces',
|
|
213
214
|
`${__dirname}/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js`,
|
|
214
215
|
);
|
|
@@ -2,7 +2,6 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import findup from 'findup-sync';
|
|
4
4
|
|
|
5
|
-
const lernaJsonPath = findup('lerna.json');
|
|
6
5
|
const lintStagedConfigPath = findup('lint-staged.config.js');
|
|
7
6
|
const lintStagedConfigCjsPath = findup('lint-staged.config.cjs');
|
|
8
7
|
|
|
@@ -15,7 +14,7 @@ const rootMonorepoPkg =
|
|
|
15
14
|
rootMonorepo &&
|
|
16
15
|
JSON.parse(fs.readFileSync(path.resolve(rootMonorepo, 'package.json')));
|
|
17
16
|
|
|
18
|
-
const
|
|
17
|
+
const getInMonorepoThings = () => {
|
|
19
18
|
const rootYoConfig = JSON.parse(
|
|
20
19
|
fs.readFileSync(path.resolve(rootMonorepo, '.yo-rc.json')),
|
|
21
20
|
);
|
|
@@ -23,7 +22,6 @@ const getInLernaThings = () => {
|
|
|
23
22
|
|
|
24
23
|
return {
|
|
25
24
|
rootMonorepoPkg,
|
|
26
|
-
lernaJsonPath: lernaJsonPath || path.resolve('lerna.json'),
|
|
27
25
|
rootPath: rootMonorepo,
|
|
28
26
|
root: rootMonorepo === cwd,
|
|
29
27
|
rootPackageManager:
|
|
@@ -49,7 +47,7 @@ const getInLernaThings = () => {
|
|
|
49
47
|
|
|
50
48
|
export default !(
|
|
51
49
|
rootMonorepoPkg &&
|
|
52
|
-
(rootMonorepoPkg.workspaces || rootMonorepoPkg.lerna
|
|
50
|
+
(rootMonorepoPkg.workspaces || rootMonorepoPkg.lerna)
|
|
53
51
|
)
|
|
54
52
|
? false
|
|
55
|
-
:
|
|
53
|
+
: getInMonorepoThings();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.4.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
},
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"bin": "./lib/pob.js",
|
|
30
|
+
"files": [
|
|
31
|
+
"lib",
|
|
32
|
+
"bin"
|
|
33
|
+
],
|
|
30
34
|
"scripts": {
|
|
31
35
|
"clean:build": "true",
|
|
32
36
|
"format": "prettier --write",
|
|
@@ -36,18 +40,18 @@
|
|
|
36
40
|
"prettier": "@pob/root/prettier-config",
|
|
37
41
|
"pob": {},
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@pob/eslint-config": "51.0
|
|
40
|
-
"@pob/eslint-config-typescript": "51.0
|
|
41
|
-
"@pob/eslint-config-typescript-react": "51.0
|
|
42
|
-
"@pob/sort-eslint-config": "5.0.
|
|
43
|
-
"@pob/sort-object": "6.0.
|
|
44
|
-
"@pob/sort-pkg": "6.0.
|
|
45
|
-
"@types/inquirer": "9.0.
|
|
46
|
-
"@yarnpkg/cli": "3.6.
|
|
47
|
-
"@yarnpkg/core": "3.5.
|
|
43
|
+
"@pob/eslint-config": "51.1.0",
|
|
44
|
+
"@pob/eslint-config-typescript": "51.1.0",
|
|
45
|
+
"@pob/eslint-config-typescript-react": "51.1.0",
|
|
46
|
+
"@pob/sort-eslint-config": "5.0.2",
|
|
47
|
+
"@pob/sort-object": "6.0.2",
|
|
48
|
+
"@pob/sort-pkg": "6.0.2",
|
|
49
|
+
"@types/inquirer": "9.0.6",
|
|
50
|
+
"@yarnpkg/cli": "3.6.4",
|
|
51
|
+
"@yarnpkg/core": "3.5.4",
|
|
48
52
|
"@yarnpkg/fslib": "2.10.3",
|
|
49
|
-
"@yeoman/types": "1.
|
|
50
|
-
"eslint": "8.
|
|
53
|
+
"@yeoman/types": "1.1.1",
|
|
54
|
+
"eslint": "8.51.0",
|
|
51
55
|
"findup-sync": "^5.0.0",
|
|
52
56
|
"git-remote-url": "^1.0.1",
|
|
53
57
|
"github-username": "^7.0.0",
|
|
@@ -57,17 +61,17 @@
|
|
|
57
61
|
"lodash.camelcase": "^4.3.0",
|
|
58
62
|
"lodash.kebabcase": "^4.1.1",
|
|
59
63
|
"mem-fs": "3.0.0",
|
|
60
|
-
"mem-fs-editor": "10.0.
|
|
64
|
+
"mem-fs-editor": "10.0.3",
|
|
61
65
|
"minimist": "1.2.8",
|
|
62
66
|
"parse-author": "2.0.0",
|
|
63
|
-
"pob-dependencies": "8.
|
|
67
|
+
"pob-dependencies": "8.7.0",
|
|
64
68
|
"prettier": "2.8.8",
|
|
65
69
|
"semver": "7.5.4",
|
|
66
|
-
"yarn-workspace-utils": "1.0.
|
|
70
|
+
"yarn-workspace-utils": "1.0.2",
|
|
67
71
|
"yeoman-environment": "4.0.0-beta.5",
|
|
68
|
-
"yeoman-generator": "6.0.0-rc.
|
|
72
|
+
"yeoman-generator": "6.0.0-rc.6"
|
|
69
73
|
},
|
|
70
74
|
"devDependencies": {
|
|
71
|
-
"@pob/root": "8.
|
|
75
|
+
"@pob/root": "8.4.0"
|
|
72
76
|
}
|
|
73
77
|
}
|
package/.editorconfig
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# http://editorconfig.org
|
|
4
|
-
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
[*]
|
|
8
|
-
indent_style = space
|
|
9
|
-
indent_size = 2
|
|
10
|
-
end_of_line = lf
|
|
11
|
-
charset = utf-8
|
|
12
|
-
trim_trailing_whitespace = true
|
|
13
|
-
insert_final_newline = true
|
package/.eslintrc.json
DELETED
package/AUTHORS
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Christophe Hurpeau <christophe@hurpeau.com>
|