pob 9.4.0 → 9.7.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 +76 -0
- package/lib/.eslintrc.json +17 -1
- package/lib/generators/common/babel/CommonBabelGenerator.js +3 -22
- package/lib/generators/common/babel/templates/app.rollup.config.mjs.ejs +1 -1
- package/lib/generators/common/format-lint/CommonLintGenerator.js +22 -20
- package/lib/generators/common/testing/CommonTestingGenerator.js +99 -7
- package/lib/generators/common/testing/templates/babel.config.cjs.ejs +12 -0
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +1 -0
- package/lib/generators/common/typescript/templates/tsconfig.build.json.ejs +3 -0
- package/lib/generators/core/package/CorePackageGenerator.js +48 -2
- package/lib/generators/core/package/templates/check-package.js.ejs +3 -0
- package/lib/generators/core/package/templates/check-packages.js.ejs +5 -0
- package/lib/generators/core/package/templates/licenses/ISC.ejs +15 -0
- package/lib/generators/core/package/templates/licenses/MIT.ejs +21 -0
- package/lib/generators/core/package/templates/licenses/UNLICENSED.ejs +2 -0
- package/lib/generators/core/renovate/CoreRenovateGenerator.js +19 -4
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +8 -0
- package/lib/generators/core/vscode/templates/settings.json.ejs +1 -1
- package/lib/generators/core/vscode/templates/tasks.json.ejs +1 -2
- package/lib/generators/lib/PobLibGenerator.js +0 -7
- package/lib/generators/lib/release/LibReleaseGenerator.js +4 -1
- package/lib/generators/monorepo/PobMonorepoGenerator.js +13 -25
- package/lib/generators/monorepo/lerna/templates/workflow-publish.yml.ejs +2 -2
- package/lib/generators/pob/PobBaseGenerator.js +2 -21
- package/lib/pob.js +7 -9
- package/lib/utils/dependenciesPackages.cjs +10 -0
- package/lib/utils/json5.js +7 -0
- package/lib/utils/package.js +31 -3
- package/package.json +8 -14
- package/lib/generators/common/babel/templates/babel.config.cjs.ejs +0 -14
- package/lib/generators/core/renovate/templates/renovate.app.json +0 -3
- package/lib/generators/core/renovate/templates/renovate.lib.json +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,82 @@
|
|
|
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.7.0](https://github.com/christophehurpeau/pob/compare/pob@9.6.1...pob@9.7.0) (2021-12-12)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* remove dependency generator-license ([f087175](https://github.com/christophehurpeau/pob/commit/f0871751cbd883b4a7e64f56853da73d1c2daef0))
|
|
12
|
+
* remove resolutions in pob ([04940d3](https://github.com/christophehurpeau/pob/commit/04940d36da39cc3771b241ff695b2ad54f28c5d3))
|
|
13
|
+
* update generator-license ([ef71b4d](https://github.com/christophehurpeau/pob/commit/ef71b4d2e0cb47736436945e4865df4e8eccd890))
|
|
14
|
+
* use lerna version with exact param ([9dd6a5c](https://github.com/christophehurpeau/pob/commit/9dd6a5c8d965cd4af40db3d93e022e6824baf97a))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* support workspace:* in dependencies ([258a5e8](https://github.com/christophehurpeau/pob/commit/258a5e88ad890f0e2f429d63f8011e8d01c3ebe3))
|
|
20
|
+
* update @yarnpkg/parsers ([f778458](https://github.com/christophehurpeau/pob/commit/f778458f8e49f610f52e1111846d9465f54576a6))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## [9.6.1](https://github.com/christophehurpeau/pob/compare/pob@9.6.0...pob@9.6.1) (2021-12-12)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* vscode settings for eslint 8 ([841b0ff](https://github.com/christophehurpeau/pob/commit/841b0ff3cf18b1aed9a070445508128806572680))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# [9.6.0](https://github.com/christophehurpeau/pob/compare/pob@9.5.0...pob@9.6.0) (2021-12-12)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
### Bug Fixes
|
|
41
|
+
|
|
42
|
+
* **pob:** move babel config generator to testing generator and configure for monorepo ([1d2a4e6](https://github.com/christophehurpeau/pob/commit/1d2a4e6f97adae84b8e4e045e36aa10c47913e5f))
|
|
43
|
+
* package locations in mongorepo generator ([63e7f62](https://github.com/christophehurpeau/pob/commit/63e7f62e934e6703066ac16ddb4fff7975811295))
|
|
44
|
+
* **pob:** dont remove preversion script for pob-dependencies ([f62355d](https://github.com/christophehurpeau/pob/commit/f62355d35ab186a9c680fee4836e4aaa5293d77b))
|
|
45
|
+
* **pob:** only add test-setup in ignored build tsconfig when package is not in a monorepo ([dba09fd](https://github.com/christophehurpeau/pob/commit/dba09fdec9a15617274ffe7acdb39c627ba84ab6))
|
|
46
|
+
* add missing clean script in apps ([a871c2c](https://github.com/christophehurpeau/pob/commit/a871c2c74386d9af0febf62ae09962ba092f6a29))
|
|
47
|
+
* add src/test-setup.ts in build exclude ([118efc9](https://github.com/christophehurpeau/pob/commit/118efc90130d07c1689db1f58ccab7762eefe0dd))
|
|
48
|
+
* allow extendable renovate config ([5d9a053](https://github.com/christophehurpeau/pob/commit/5d9a053f0485fa66586fb237b7770f450799c045))
|
|
49
|
+
* allow to extends renovate config ([e61b0b7](https://github.com/christophehurpeau/pob/commit/e61b0b792f63e9e938a9172a102089ff9eb3aa2f))
|
|
50
|
+
* doesJsCheckPackagesExists should be let ([6aac69f](https://github.com/christophehurpeau/pob/commit/6aac69f1a2eb6df4e98d4289da2e4b245a278e94))
|
|
51
|
+
* dont create and delete check-package script in workspace packages ([3398ef5](https://github.com/christophehurpeau/pob/commit/3398ef56a97933149eaea02cea58949cadfc61b2))
|
|
52
|
+
* dont delete plugin dependencies in eslint-config-pob ([31fe081](https://github.com/christophehurpeau/pob/commit/31fe08106647624317f277d2e31f820911445532))
|
|
53
|
+
* get eslint dependency versions from @pob/eslint-config ([4100cc5](https://github.com/christophehurpeau/pob/commit/4100cc5a342b1cc970f614de99692600f9ec89f9))
|
|
54
|
+
* order pob-babel/plugin-run.cjs ([57d6c8b](https://github.com/christophehurpeau/pob/commit/57d6c8bfbcfd756a23f96b436614db8991cf1ed2))
|
|
55
|
+
* read vscode tasks file ([436c480](https://github.com/christophehurpeau/pob/commit/436c480d4538b68893b3521573ab50199d63a23e))
|
|
56
|
+
* **pob:** esm condition for babel.config.cjs ([6aeb96f](https://github.com/christophehurpeau/pob/commit/6aeb96fd7648484755c595310008b0dff20fa6a4))
|
|
57
|
+
* **pob:** global testing config ([fc56a6d](https://github.com/christophehurpeau/pob/commit/fc56a6d28413a8ae2c7a45235f853b5123005c84))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Features
|
|
61
|
+
|
|
62
|
+
* configure pob-lcov-reporter for pob monorepo ([e7f40c4](https://github.com/christophehurpeau/pob/commit/e7f40c4dc9a2400e48a1497ac4ea0bdc5f842a15))
|
|
63
|
+
* **pob:** add default check-package-dependencies script if it doesnt exists and package type is module ([7e54041](https://github.com/christophehurpeau/pob/commit/7e540417e34d908f06f6263d668f9cbb4d9c7990))
|
|
64
|
+
* update eslint 8 and eslint-config-pob ([f881f05](https://github.com/christophehurpeau/pob/commit/f881f05852e00c22a35178979e1425445413ce70))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# [9.5.0](https://github.com/christophehurpeau/pob/compare/pob@9.4.0...pob@9.5.0) (2021-12-11)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Features
|
|
74
|
+
|
|
75
|
+
* **pob-babel:** include plugin-run as export ([9a4515d](https://github.com/christophehurpeau/pob/commit/9a4515d26d816df6f257a90647046c7da5d83a16))
|
|
76
|
+
* enable global testing in monorepo ([178775b](https://github.com/christophehurpeau/pob/commit/178775bb7fc971bc6a9712b105623508f739ba7b))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
6
82
|
# [9.4.0](https://github.com/christophehurpeau/pob/compare/pob@9.3.1...pob@9.4.0) (2021-12-11)
|
|
7
83
|
|
|
8
84
|
|
package/lib/.eslintrc.json
CHANGED
|
@@ -7,5 +7,21 @@
|
|
|
7
7
|
"no-nested-ternary": "off",
|
|
8
8
|
"no-console": "off",
|
|
9
9
|
"complexity": "off"
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
|
+
"overrides": [
|
|
12
|
+
{
|
|
13
|
+
"files": ["**/*.test.{cjs,js}", "__tests__/**/*.{cjs,js}"],
|
|
14
|
+
"env": {
|
|
15
|
+
"jest": true
|
|
16
|
+
},
|
|
17
|
+
"rules": {
|
|
18
|
+
"import/no-extraneous-dependencies": [
|
|
19
|
+
"error",
|
|
20
|
+
{
|
|
21
|
+
"devDependencies": true
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
11
27
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import semver from 'semver';
|
|
3
3
|
import Generator from 'yeoman-generator';
|
|
4
|
-
import inLerna from '../../../utils/inLerna.js';
|
|
5
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
6
5
|
|
|
7
6
|
export default class CommonBabelGenerator extends Generator {
|
|
@@ -278,12 +277,14 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
278
277
|
packageUtils.addOrRemoveScripts(pkg, useBabel, {
|
|
279
278
|
build: 'pob-build',
|
|
280
279
|
start: 'pob-watch',
|
|
280
|
+
clean: 'rm -Rf dist',
|
|
281
281
|
});
|
|
282
282
|
} else {
|
|
283
283
|
packageUtils.removeScripts(['start']);
|
|
284
284
|
packageUtils.addOrRemoveScripts(pkg, useBabel, {
|
|
285
285
|
build: 'pob-build',
|
|
286
286
|
watch: 'pob-watch',
|
|
287
|
+
clean: 'rm -Rf dist',
|
|
287
288
|
});
|
|
288
289
|
}
|
|
289
290
|
|
|
@@ -688,15 +689,10 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
688
689
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
689
690
|
|
|
690
691
|
const useBabel = this.babelEnvs && this.babelEnvs.length > 0;
|
|
691
|
-
const hasReact = useBabel && packageUtils.hasReact(pkg);
|
|
692
692
|
|
|
693
693
|
/* pob-babel config */
|
|
694
694
|
|
|
695
|
-
packageUtils.
|
|
696
|
-
pkg,
|
|
697
|
-
useBabel && this.options.isApp,
|
|
698
|
-
['@rollup/plugin-run'],
|
|
699
|
-
);
|
|
695
|
+
packageUtils.removeDevDependencies(pkg, ['@rollup/plugin-run']);
|
|
700
696
|
|
|
701
697
|
this.fs.delete('rollup.config.js');
|
|
702
698
|
if (useBabel) {
|
|
@@ -727,21 +723,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
727
723
|
);
|
|
728
724
|
}
|
|
729
725
|
|
|
730
|
-
if (useBabel && this.options.testing) {
|
|
731
|
-
// cjs for jest compat
|
|
732
|
-
this.fs.copyTpl(
|
|
733
|
-
this.templatePath('babel.config.cjs.ejs'),
|
|
734
|
-
this.destinationPath('babel.config.cjs'),
|
|
735
|
-
{
|
|
736
|
-
hasReact,
|
|
737
|
-
testing: this.options.testing,
|
|
738
|
-
jestExperimentalESM: !inLerna,
|
|
739
|
-
},
|
|
740
|
-
);
|
|
741
|
-
} else {
|
|
742
|
-
this.fs.delete('babel.config.cjs');
|
|
743
|
-
}
|
|
744
|
-
|
|
745
726
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
746
727
|
}
|
|
747
728
|
}
|
|
@@ -159,14 +159,9 @@ export default class CommonLintGenerator extends Generator {
|
|
|
159
159
|
'babel-eslint',
|
|
160
160
|
'eslint-config-pob',
|
|
161
161
|
'eslint-config-prettier',
|
|
162
|
-
'eslint-plugin-babel',
|
|
163
|
-
'eslint-plugin-flowtype',
|
|
164
|
-
'eslint-plugin-prefer-class-properties',
|
|
165
|
-
'eslint-plugin-prettier',
|
|
166
|
-
'eslint-plugin-react',
|
|
167
|
-
'eslint-plugin-react-hooks',
|
|
168
162
|
'typescript-eslint-parser',
|
|
169
163
|
'standard',
|
|
164
|
+
'eslint-import-resolver-node',
|
|
170
165
|
]);
|
|
171
166
|
|
|
172
167
|
if (!pkg.name.startsWith('@pob/eslint-config')) {
|
|
@@ -174,11 +169,18 @@ export default class CommonLintGenerator extends Generator {
|
|
|
174
169
|
'eslint-plugin-jsx-a11y',
|
|
175
170
|
'eslint-config-airbnb',
|
|
176
171
|
'eslint-config-airbnb-base',
|
|
172
|
+
'eslint-plugin-babel',
|
|
173
|
+
'eslint-plugin-flowtype',
|
|
174
|
+
'eslint-plugin-prefer-class-properties',
|
|
175
|
+
'eslint-plugin-prettier',
|
|
176
|
+
'eslint-plugin-react',
|
|
177
|
+
'eslint-plugin-react-hooks',
|
|
177
178
|
]);
|
|
178
179
|
}
|
|
179
180
|
|
|
180
181
|
const yoConfigPobMonorepo = inLerna && inLerna.pobMonorepoConfig;
|
|
181
182
|
const globalEslint = yoConfigPobMonorepo && yoConfigPobMonorepo.eslint;
|
|
183
|
+
const globalTesting = yoConfigPobMonorepo && yoConfigPobMonorepo.testing;
|
|
182
184
|
const composite = yoConfigPobMonorepo && yoConfigPobMonorepo.typescript;
|
|
183
185
|
const { rootPackageManager, rootYarnNodeLinker } = inLerna || {};
|
|
184
186
|
const lernaProjectType =
|
|
@@ -202,7 +204,6 @@ export default class CommonLintGenerator extends Generator {
|
|
|
202
204
|
'@pob/eslint-config-react',
|
|
203
205
|
'@typescript-eslint/eslint-plugin',
|
|
204
206
|
'@typescript-eslint/parser',
|
|
205
|
-
'eslint-import-resolver-node',
|
|
206
207
|
'eslint-plugin-node',
|
|
207
208
|
'eslint-plugin-unicorn',
|
|
208
209
|
'eslint-plugin-import',
|
|
@@ -244,7 +245,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
244
245
|
packageUtils.addOrRemoveDevDependencies(
|
|
245
246
|
pkg,
|
|
246
247
|
shouldHavePluginsDependencies,
|
|
247
|
-
['eslint-plugin-node'
|
|
248
|
+
['eslint-plugin-node'],
|
|
248
249
|
);
|
|
249
250
|
|
|
250
251
|
if ((inLerna && inLerna.root) || this.options.monorepo) {
|
|
@@ -337,18 +338,19 @@ export default class CommonLintGenerator extends Generator {
|
|
|
337
338
|
? `{${pkg.type === 'commonjs' ? 'mjs' : 'cjs'},js}`
|
|
338
339
|
: `${hasReact ? '{ts,tsx}' : 'ts'}`;
|
|
339
340
|
|
|
340
|
-
const jestOverride =
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
'
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
341
|
+
const jestOverride =
|
|
342
|
+
!pkg.jest && !globalTesting
|
|
343
|
+
? null
|
|
344
|
+
: {
|
|
345
|
+
files: [`**/*.test.${ext}`, `__tests__/**/*.${ext}`],
|
|
346
|
+
env: { jest: true },
|
|
347
|
+
rules: {
|
|
348
|
+
'import/no-extraneous-dependencies': [
|
|
349
|
+
'error',
|
|
350
|
+
{ devDependencies: true },
|
|
351
|
+
],
|
|
352
|
+
},
|
|
353
|
+
};
|
|
352
354
|
|
|
353
355
|
if (jestOverride) {
|
|
354
356
|
// if (!useBabel) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Generator from 'yeoman-generator';
|
|
2
2
|
import inLerna from '../../../utils/inLerna.js';
|
|
3
3
|
import * as packageUtils from '../../../utils/package.js';
|
|
4
|
+
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
4
5
|
|
|
5
6
|
export default class CommonTestingGenerator extends Generator {
|
|
6
7
|
constructor(args, opts) {
|
|
@@ -79,11 +80,10 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
79
80
|
'babel-jest',
|
|
80
81
|
]);
|
|
81
82
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const globalTesting = false;
|
|
85
|
-
|
|
83
|
+
const yoConfigPobMonorepo = inLerna && inLerna.pobMonorepoConfig;
|
|
84
|
+
const globalTesting = yoConfigPobMonorepo && yoConfigPobMonorepo.testing;
|
|
86
85
|
const enableForMonorepo = this.options.monorepo && globalTesting;
|
|
86
|
+
const transpileWithBabel = yoConfigPobMonorepo.typescript;
|
|
87
87
|
|
|
88
88
|
if (!this.options.enable) {
|
|
89
89
|
packageUtils.removeDevDependencies(pkg, ['jest', '@types/jest']);
|
|
@@ -106,20 +106,84 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
106
106
|
packageUtils.addOrRemoveDevDependencies(
|
|
107
107
|
pkg,
|
|
108
108
|
enableForMonorepo || !globalTesting,
|
|
109
|
-
[
|
|
109
|
+
[
|
|
110
|
+
pkg.name !== 'pob-monorepo' && 'pob-lcov-reporter',
|
|
111
|
+
'jest',
|
|
112
|
+
'@types/jest',
|
|
113
|
+
],
|
|
110
114
|
);
|
|
111
115
|
|
|
112
|
-
if (this.options.monorepo) {
|
|
116
|
+
if (this.options.monorepo && !globalTesting) {
|
|
113
117
|
delete pkg.jest;
|
|
114
118
|
packageUtils.addScripts(pkg, {
|
|
115
119
|
test: 'yarn workspaces foreach --parallel -Av run test',
|
|
116
120
|
});
|
|
121
|
+
} else if (this.options.monorepo) {
|
|
122
|
+
const shouldUseExperimentalVmModules = pkg.type === 'module';
|
|
123
|
+
|
|
124
|
+
const jestCommand = `${
|
|
125
|
+
shouldUseExperimentalVmModules
|
|
126
|
+
? 'NODE_OPTIONS=--experimental-vm-modules '
|
|
127
|
+
: ''
|
|
128
|
+
}jest`;
|
|
129
|
+
|
|
130
|
+
packageUtils.addScripts(pkg, {
|
|
131
|
+
test: jestCommand,
|
|
132
|
+
'generate:test-coverage': [
|
|
133
|
+
'rm -Rf docs/coverage/',
|
|
134
|
+
`NODE_ENV=production ${
|
|
135
|
+
transpileWithBabel ? 'BABEL_ENV=test ' : ''
|
|
136
|
+
}${jestCommand} --coverage --coverageReporters=pob-lcov-reporter --coverageDirectory=docs/coverage/`,
|
|
137
|
+
].join(' ; '),
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const workspacesWithoutStar = pkg.workspaces.map((workspace) => {
|
|
141
|
+
if (!workspace.endsWith('/*')) {
|
|
142
|
+
throw new Error(`Invalid workspace format: ${workspace}`);
|
|
143
|
+
}
|
|
144
|
+
return workspace.slice(0, -2);
|
|
145
|
+
});
|
|
146
|
+
const workspacesPattern =
|
|
147
|
+
workspacesWithoutStar.length === 1
|
|
148
|
+
? workspacesWithoutStar[0]
|
|
149
|
+
: `(${workspacesWithoutStar.join('|')})`;
|
|
150
|
+
const hasReact = packageUtils.hasReact(pkg);
|
|
151
|
+
|
|
152
|
+
if (!pkg.jest) pkg.jest = {};
|
|
153
|
+
Object.assign(pkg.jest, {
|
|
154
|
+
cacheDirectory: './node_modules/.cache/jest',
|
|
155
|
+
testEnvironment: 'node',
|
|
156
|
+
testMatch: [
|
|
157
|
+
`<rootDir>/${workspacesPattern}/*/(src|lib)/**/__tests__/**/*.${
|
|
158
|
+
transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
|
|
159
|
+
}${hasReact ? '?(x)' : ''}`,
|
|
160
|
+
`<rootDir>/${workspacesPattern}/*/(src|lib)/**/*.test.${
|
|
161
|
+
transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
|
|
162
|
+
}${hasReact ? '?(x)' : ''}`,
|
|
163
|
+
],
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
if (shouldUseExperimentalVmModules) {
|
|
167
|
+
pkg.jest.extensionsToTreatAsEsm = [
|
|
168
|
+
transpileWithBabel && '.ts',
|
|
169
|
+
transpileWithBabel && hasReact && '.tsx',
|
|
170
|
+
].filter(Boolean);
|
|
171
|
+
} else {
|
|
172
|
+
delete pkg.jest.extensionsToTreatAsEsm;
|
|
173
|
+
}
|
|
174
|
+
} else if (globalTesting) {
|
|
175
|
+
delete pkg.jest;
|
|
176
|
+
if (pkg.scripts) {
|
|
177
|
+
delete pkg.scripts.test;
|
|
178
|
+
delete pkg.scripts['generate:test-coverage'];
|
|
179
|
+
delete pkg.scripts['test:watch'];
|
|
180
|
+
}
|
|
117
181
|
} else {
|
|
118
182
|
const babelEnvs = pkg.pob.babelEnvs || [];
|
|
119
183
|
const transpileWithBabel = packageUtils.transpileWithBabel(pkg);
|
|
120
184
|
|
|
121
185
|
const shouldUseExperimentalVmModules =
|
|
122
|
-
pkg.type === 'module'
|
|
186
|
+
pkg.type === 'module' && !inLerna;
|
|
123
187
|
|
|
124
188
|
const jestCommand = `${
|
|
125
189
|
shouldUseExperimentalVmModules
|
|
@@ -192,6 +256,34 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
192
256
|
}
|
|
193
257
|
}
|
|
194
258
|
|
|
259
|
+
if (
|
|
260
|
+
transpileWithBabel &&
|
|
261
|
+
((this.options.monorepo && globalTesting) || !globalTesting)
|
|
262
|
+
) {
|
|
263
|
+
const hasReact = transpileWithBabel && packageUtils.hasReact(pkg);
|
|
264
|
+
// cjs for jest compat
|
|
265
|
+
copyAndFormatTpl(
|
|
266
|
+
this.fs,
|
|
267
|
+
this.templatePath('babel.config.cjs.ejs'),
|
|
268
|
+
this.destinationPath('babel.config.cjs'),
|
|
269
|
+
{
|
|
270
|
+
only: !this.options.monorepo
|
|
271
|
+
? "'src'"
|
|
272
|
+
: pkg.workspaces
|
|
273
|
+
.flatMap((workspace) => [
|
|
274
|
+
`'${workspace}/src'`,
|
|
275
|
+
`'${workspace}/lib'`,
|
|
276
|
+
])
|
|
277
|
+
.join(', '),
|
|
278
|
+
hasReact,
|
|
279
|
+
testing: this.options.testing,
|
|
280
|
+
jestExperimentalESM: pkg.type === 'module',
|
|
281
|
+
},
|
|
282
|
+
);
|
|
283
|
+
} else {
|
|
284
|
+
this.fs.delete('babel.config.cjs');
|
|
285
|
+
}
|
|
286
|
+
|
|
195
287
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
196
288
|
}
|
|
197
289
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
module.exports = function babelConfig(api) {
|
|
4
|
+
const isTest = api.env('test');
|
|
5
|
+
|
|
6
|
+
if (!isTest) return {};
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
only: [<%- only %>],
|
|
10
|
+
presets: [[require.resolve('pob-babel/preset.cjs')<% if (!jestExperimentalESM) { %>, { modules: 'commonjs' }<% } %>]],
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -128,6 +128,13 @@ export default class CorePackageGenerator extends Generator {
|
|
|
128
128
|
choices: ['commonjs', 'module'],
|
|
129
129
|
when: !pkg.type,
|
|
130
130
|
},
|
|
131
|
+
{
|
|
132
|
+
name: 'license',
|
|
133
|
+
message: 'License Type',
|
|
134
|
+
type: 'list',
|
|
135
|
+
choices: ['MIT', 'ISC', 'UNLICENSED'],
|
|
136
|
+
when: !pkg.license,
|
|
137
|
+
},
|
|
131
138
|
].filter(Boolean),
|
|
132
139
|
);
|
|
133
140
|
|
|
@@ -164,10 +171,19 @@ export default class CorePackageGenerator extends Generator {
|
|
|
164
171
|
const doesMjsCheckPackagesExists = this.fs.exists(
|
|
165
172
|
this.destinationPath('scripts/check-packages.mjs'),
|
|
166
173
|
);
|
|
167
|
-
|
|
174
|
+
let doesJsCheckPackagesExists = this.fs.exists(
|
|
168
175
|
this.destinationPath('scripts/check-packages.js'),
|
|
169
176
|
);
|
|
170
177
|
|
|
178
|
+
if (pkg.type === 'module' && !doesJsCheckPackagesExists) {
|
|
179
|
+
doesJsCheckPackagesExists = true;
|
|
180
|
+
this.fs.copyTpl(
|
|
181
|
+
this.templatePath('check-packages.js.ejs'),
|
|
182
|
+
this.destinationPath('scripts/check-packages.js'),
|
|
183
|
+
{},
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
171
187
|
packageUtils.addOrRemoveScripts(
|
|
172
188
|
pkg,
|
|
173
189
|
doesMjsCheckPackagesExists || doesJsCheckPackagesExists,
|
|
@@ -177,13 +193,31 @@ export default class CorePackageGenerator extends Generator {
|
|
|
177
193
|
}`,
|
|
178
194
|
},
|
|
179
195
|
);
|
|
196
|
+
} else if (inLerna && !inLerna.root) {
|
|
197
|
+
if (this.fs.exists('scripts/check-package.js')) {
|
|
198
|
+
this.fs.delete('scripts/check-package.js');
|
|
199
|
+
}
|
|
200
|
+
if (this.fs.exists('scripts/check-package.mjs')) {
|
|
201
|
+
this.fs.delete('scripts/check-package.mjs');
|
|
202
|
+
}
|
|
203
|
+
packageUtils.removeScripts(pkg, ['checks']);
|
|
180
204
|
} else {
|
|
181
205
|
const doesMjsCheckPackageExists = this.fs.exists(
|
|
182
206
|
this.destinationPath('scripts/check-package.mjs'),
|
|
183
207
|
);
|
|
184
|
-
|
|
208
|
+
let doesJsCheckPackageExists = this.fs.exists(
|
|
185
209
|
this.destinationPath('scripts/check-package.js'),
|
|
186
210
|
);
|
|
211
|
+
|
|
212
|
+
if (pkg.type === 'module' && !doesJsCheckPackageExists) {
|
|
213
|
+
doesJsCheckPackageExists = true;
|
|
214
|
+
this.fs.copyTpl(
|
|
215
|
+
this.templatePath('check-package.js.ejs'),
|
|
216
|
+
this.destinationPath('scripts/check-package.js'),
|
|
217
|
+
{},
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
187
221
|
packageUtils.addOrRemoveScripts(
|
|
188
222
|
pkg,
|
|
189
223
|
doesMjsCheckPackageExists || doesJsCheckPackageExists,
|
|
@@ -205,6 +239,18 @@ export default class CorePackageGenerator extends Generator {
|
|
|
205
239
|
author.url ? ` (${author.url})` : ''
|
|
206
240
|
}`;
|
|
207
241
|
|
|
242
|
+
if (!pkg.license) {
|
|
243
|
+
pkg.license = props.license;
|
|
244
|
+
this.fs.copyTpl(
|
|
245
|
+
this.templatePath(`licenses/${props.license}.ejs`),
|
|
246
|
+
this.destinationPath('LICENSE'),
|
|
247
|
+
{
|
|
248
|
+
year: new Date().getFullYear(),
|
|
249
|
+
author: pkg.author,
|
|
250
|
+
},
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
|
|
208
254
|
if (pkg.private) {
|
|
209
255
|
if (!pkg.description) delete pkg.description;
|
|
210
256
|
if (!pkg.keywords || pkg.keywords.length === 0) delete pkg.keywords;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Copyright (c) <%- year %> <%- author %>
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for
|
|
4
|
+
any purpose with or without fee is hereby granted, provided that the
|
|
5
|
+
above copyright notice and this permission notice appear in all
|
|
6
|
+
copies.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
|
9
|
+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
|
10
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
|
11
|
+
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
12
|
+
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
13
|
+
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
14
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) <%- year %> <%- author %>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Generator from 'yeoman-generator';
|
|
2
2
|
import inLerna from '../../../utils/inLerna.js';
|
|
3
|
+
import { writeAndFormatJson } from '../../../utils/writeAndFormat.js';
|
|
3
4
|
|
|
4
5
|
export default class CoreRenovateGenerator extends Generator {
|
|
5
6
|
constructor(args, opts) {
|
|
@@ -58,11 +59,25 @@ export default class CoreRenovateGenerator extends Generator {
|
|
|
58
59
|
|
|
59
60
|
writing() {
|
|
60
61
|
if (this.enableRenovate) {
|
|
61
|
-
this.fs.
|
|
62
|
-
|
|
63
|
-
this.options.app ? 'renovate.app.json' : 'renovate.lib.json',
|
|
64
|
-
),
|
|
62
|
+
const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
|
|
63
|
+
const renovateConfig = this.fs.readJSON(
|
|
65
64
|
this.destinationPath('renovate.json'),
|
|
65
|
+
{},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
if (this.options.app) {
|
|
69
|
+
renovateConfig.extends = ['config:js-app', '@pob'];
|
|
70
|
+
} else {
|
|
71
|
+
renovateConfig.extends = [
|
|
72
|
+
'config:js-lib',
|
|
73
|
+
pkg.name === 'pob-monorepo' ? undefined : '@pob',
|
|
74
|
+
].filter(Boolean);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
writeAndFormatJson(
|
|
78
|
+
this.fs,
|
|
79
|
+
this.destinationPath('renovate.json'),
|
|
80
|
+
renovateConfig,
|
|
66
81
|
);
|
|
67
82
|
} else if (this.fs.exists(this.destinationPath('renovate.json'))) {
|
|
68
83
|
this.fs.delete(this.destinationPath('renovate.json'));
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Generator from 'yeoman-generator';
|
|
2
|
+
import { readJSON5 } from '../../../utils/json5.js';
|
|
2
3
|
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
3
4
|
|
|
4
5
|
export default class CoreVSCodeGenerator extends Generator {
|
|
@@ -56,12 +57,19 @@ export default class CoreVSCodeGenerator extends Generator {
|
|
|
56
57
|
typescript: this.options.typescript,
|
|
57
58
|
},
|
|
58
59
|
);
|
|
60
|
+
|
|
61
|
+
const tasksConfig = readJSON5(
|
|
62
|
+
this.fs,
|
|
63
|
+
this.destinationPath('.vscode/tasks.json'),
|
|
64
|
+
{},
|
|
65
|
+
);
|
|
59
66
|
copyAndFormatTpl(
|
|
60
67
|
this.fs,
|
|
61
68
|
this.templatePath('tasks.json.ejs'),
|
|
62
69
|
this.destinationPath('.vscode/tasks.json'),
|
|
63
70
|
{
|
|
64
71
|
typescript: this.options.typescript,
|
|
72
|
+
tasks: JSON.stringify(tasksConfig.tasks || [], null, 2),
|
|
65
73
|
},
|
|
66
74
|
);
|
|
67
75
|
} else {
|
|
@@ -320,13 +320,6 @@ export default class PobLibGenerator extends Generator {
|
|
|
320
320
|
delete pkg.scripts.version;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
if (withBabel && (!inLerna || !inLerna.root)) {
|
|
324
|
-
packageUtils.addScripts(pkg, {
|
|
325
|
-
clean: 'rm -Rf dist',
|
|
326
|
-
});
|
|
327
|
-
} else {
|
|
328
|
-
delete pkg.scripts.clean;
|
|
329
|
-
}
|
|
330
323
|
|
|
331
324
|
if (!withBabel) {
|
|
332
325
|
if (
|
|
@@ -39,7 +39,10 @@ export default class LibReleaseGenerator extends Generator {
|
|
|
39
39
|
|
|
40
40
|
if (!isStandardVersionEnabled) {
|
|
41
41
|
packageUtils.removeDevDependencies(pkg, ['standard-version']);
|
|
42
|
-
packageUtils.removeScripts(pkg, [
|
|
42
|
+
packageUtils.removeScripts(pkg, [
|
|
43
|
+
'release',
|
|
44
|
+
pkg.name === 'pob-dependencies' ? null : 'preversion',
|
|
45
|
+
]);
|
|
43
46
|
} else {
|
|
44
47
|
packageUtils.addDevDependencies(pkg, ['standard-version']);
|
|
45
48
|
packageUtils.addScripts(pkg, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
2
3
|
import { PackageGraph } from '@lerna/package-graph';
|
|
3
4
|
import { Project as LernaProject } from '@lerna/project';
|
|
4
5
|
import Generator from 'yeoman-generator';
|
|
@@ -82,10 +83,15 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
82
83
|
const batch = [...graph.values()].filter(
|
|
83
84
|
(node) => node.localDependencies.size === 0,
|
|
84
85
|
);
|
|
86
|
+
batch.sort((a, b) => a.name.localeCompare(b.name, 'en'));
|
|
85
87
|
|
|
86
88
|
// batches are composed of Package instances, not PackageGraphNodes
|
|
87
89
|
this.packages.push(...batch.map((node) => node.pkg));
|
|
88
|
-
this.packageLocations.push(
|
|
90
|
+
this.packageLocations.push(
|
|
91
|
+
...batch.map((node) =>
|
|
92
|
+
path.relative(this.destinationPath(), node.location),
|
|
93
|
+
),
|
|
94
|
+
);
|
|
89
95
|
|
|
90
96
|
// pruning the graph changes the node.localDependencies.size test
|
|
91
97
|
graph.prune(...batch);
|
|
@@ -165,32 +171,14 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
165
171
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
|
|
166
172
|
|
|
167
173
|
const packageNames = this.packageNames;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const packagePaths = packageNames
|
|
174
|
-
.map((packageName) =>
|
|
175
|
-
this.options.isAppProject && packageName.startsWith(basePackageName)
|
|
176
|
-
? `packages/${packageName.slice(basePackageName.length)}`
|
|
177
|
-
: `${packageName[0] === '@' ? '' : 'packages/'}${packageName}`,
|
|
178
|
-
)
|
|
179
|
-
.filter(
|
|
180
|
-
this.pobLernaConfig.typescript
|
|
181
|
-
? (packagePath) => fs.existsSync(`${packagePath}/tsconfig.json`)
|
|
182
|
-
: Boolean,
|
|
183
|
-
);
|
|
174
|
+
const packagePaths = this.packageLocations.filter(
|
|
175
|
+
this.pobLernaConfig.typescript
|
|
176
|
+
? (packagePath) => fs.existsSync(`${packagePath}/tsconfig.json`)
|
|
177
|
+
: Boolean,
|
|
178
|
+
);
|
|
184
179
|
|
|
185
180
|
if (packagePaths.length === 0 && packageNames.length > 0) {
|
|
186
|
-
console.log(
|
|
187
|
-
packageNames,
|
|
188
|
-
packageNames.map((packageName) =>
|
|
189
|
-
this.options.isAppProject && packageName.startsWith(basePackageName)
|
|
190
|
-
? `packages/${packageName.slice(basePackageName.length)}`
|
|
191
|
-
: `${packageName[0] === '@' ? '' : 'packages/'}${packageName}`,
|
|
192
|
-
),
|
|
193
|
-
);
|
|
181
|
+
console.log(packageNames, packagePaths);
|
|
194
182
|
throw new Error('packages should not be empty');
|
|
195
183
|
}
|
|
196
184
|
|
|
@@ -39,7 +39,7 @@ jobs:
|
|
|
39
39
|
if: |
|
|
40
40
|
github.ref == 'refs/heads/main'
|
|
41
41
|
&& contains(github.event.inputs.dry-run, 'y')
|
|
42
|
-
run: yarn lerna version --yes --no-push --conventional-commits --conventional-graduate --no-git-tag-version --loglevel=verbose
|
|
42
|
+
run: yarn lerna version --yes --no-push --exact --conventional-commits --conventional-graduate --no-git-tag-version --loglevel=verbose
|
|
43
43
|
|
|
44
44
|
- name: Configure Git user
|
|
45
45
|
if: |
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
github.ref == 'refs/heads/main'
|
|
55
55
|
&& contains(github.event.inputs.dry-run, 'y') == false
|
|
56
56
|
run: |
|
|
57
|
-
yarn lerna version --yes --push --conventional-commits --conventional-graduate --create-release=github -m 'chore: release [skip ci]'
|
|
57
|
+
yarn lerna version --yes --push --exact --conventional-commits --conventional-graduate --create-release=github -m 'chore: release [skip ci]'
|
|
58
58
|
env:
|
|
59
59
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
60
60
|
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
|
@@ -43,13 +43,6 @@ export default class PobBaseGenerator extends Generator {
|
|
|
43
43
|
required: true,
|
|
44
44
|
desc: "Don't check diff",
|
|
45
45
|
});
|
|
46
|
-
|
|
47
|
-
this.option('license', {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
required: false,
|
|
50
|
-
defaults: true,
|
|
51
|
-
desc: 'Include a license',
|
|
52
|
-
});
|
|
53
46
|
}
|
|
54
47
|
|
|
55
48
|
rootGeneratorName() {
|
|
@@ -145,20 +138,6 @@ export default class PobBaseGenerator extends Generator {
|
|
|
145
138
|
this.fs.delete('Makefile');
|
|
146
139
|
this.fs.delete(this.destinationPath('.commitrc.js'));
|
|
147
140
|
|
|
148
|
-
const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
|
|
149
|
-
if (
|
|
150
|
-
this.options.license &&
|
|
151
|
-
!this.fs.exists(this.destinationPath('LICENSE'))
|
|
152
|
-
) {
|
|
153
|
-
const author = packageUtils.parsePkgAuthor(pkg) || {};
|
|
154
|
-
this.composeWith('generator-license/app', {
|
|
155
|
-
name: author.name,
|
|
156
|
-
email: author.email,
|
|
157
|
-
website: author.url,
|
|
158
|
-
defaultLicense: 'ISC',
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
141
|
this.composeWith('pob:core:editorconfig');
|
|
163
142
|
|
|
164
143
|
this.composeWith('pob:core:clean', {
|
|
@@ -170,6 +149,8 @@ export default class PobBaseGenerator extends Generator {
|
|
|
170
149
|
app: this.projectConfig.type === 'app',
|
|
171
150
|
});
|
|
172
151
|
|
|
152
|
+
const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
|
|
153
|
+
|
|
173
154
|
this.composeWith('pob:core:vscode', {
|
|
174
155
|
root: this.isRoot,
|
|
175
156
|
packageManager: this.projectConfig.packageManager,
|
package/lib/pob.js
CHANGED
|
@@ -286,16 +286,14 @@ const options = {
|
|
|
286
286
|
force: argv.force,
|
|
287
287
|
};
|
|
288
288
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
process.exit(1);
|
|
296
|
-
}
|
|
289
|
+
try {
|
|
290
|
+
await env.run('pob', options);
|
|
291
|
+
} catch (err) {
|
|
292
|
+
if (err) {
|
|
293
|
+
console.error(err.stack || err.message || err);
|
|
294
|
+
process.exit(1);
|
|
297
295
|
}
|
|
298
|
-
}
|
|
296
|
+
}
|
|
299
297
|
|
|
300
298
|
// generator.on('error', (err) => {
|
|
301
299
|
// console.error(err.stack || err.message || err);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
|
+
exports.pobEslintConfig = require('@pob/eslint-config/package.json');
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
7
|
+
exports.pobEslintConfigTypescript = require('@pob/eslint-config-typescript/package.json');
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
10
|
+
exports.pobEslintConfigTypescriptReact = require('@pob/eslint-config-typescript-react/package.json');
|
package/lib/utils/package.js
CHANGED
|
@@ -3,6 +3,11 @@ import sortPkg from '@pob/sort-pkg';
|
|
|
3
3
|
import parseAuthor from 'parse-author';
|
|
4
4
|
import pobDependencies from 'pob-dependencies';
|
|
5
5
|
import semver from 'semver';
|
|
6
|
+
import {
|
|
7
|
+
pobEslintConfig,
|
|
8
|
+
pobEslintConfigTypescript,
|
|
9
|
+
pobEslintConfigTypescriptReact,
|
|
10
|
+
} from './dependenciesPackages.cjs';
|
|
6
11
|
|
|
7
12
|
export { default as parseAuthor } from 'parse-author';
|
|
8
13
|
|
|
@@ -62,7 +67,7 @@ function internalAddToObject(pkg, key, object) {
|
|
|
62
67
|
|
|
63
68
|
function internalRemoveFromObject(pkg, key, keys) {
|
|
64
69
|
if (!pkg[key]) return;
|
|
65
|
-
keys.forEach((k) => {
|
|
70
|
+
keys.filter(Boolean).forEach((k) => {
|
|
66
71
|
delete pkg[key][k];
|
|
67
72
|
});
|
|
68
73
|
if (Object.keys(pkg[key]).length === 0) {
|
|
@@ -78,6 +83,26 @@ const internalRemoveDependencies = (pkg, type, dependencyKeys) => {
|
|
|
78
83
|
};
|
|
79
84
|
|
|
80
85
|
const getVersionFromDependencyName = (dependency) => {
|
|
86
|
+
if (
|
|
87
|
+
[
|
|
88
|
+
// 'eslint-import-resolver-node',
|
|
89
|
+
'eslint-plugin-import',
|
|
90
|
+
'eslint-plugin-node',
|
|
91
|
+
'eslint-plugin-unicorn',
|
|
92
|
+
].includes(dependency)
|
|
93
|
+
) {
|
|
94
|
+
return pobEslintConfig.dependencies[dependency];
|
|
95
|
+
}
|
|
96
|
+
if (['eslint-plugin-jsx-a11y', 'eslint-plugin-react'].includes(dependency)) {
|
|
97
|
+
return pobEslintConfigTypescriptReact.dependencies[dependency];
|
|
98
|
+
}
|
|
99
|
+
if (
|
|
100
|
+
['@typescript-eslint/eslint-plugin', '@typescript-eslint/parser'].includes(
|
|
101
|
+
dependency,
|
|
102
|
+
)
|
|
103
|
+
) {
|
|
104
|
+
return pobEslintConfigTypescript.dependencies[dependency];
|
|
105
|
+
}
|
|
81
106
|
return pobDependencies[dependency];
|
|
82
107
|
};
|
|
83
108
|
|
|
@@ -88,7 +113,7 @@ const internalAddDependencies = (pkg, type, dependencies, cleaned, prefix) => {
|
|
|
88
113
|
const removeDependencies = [];
|
|
89
114
|
|
|
90
115
|
const dependenciesToCheck = [];
|
|
91
|
-
dependencies.forEach((dependency) => {
|
|
116
|
+
dependencies.filter(Boolean).forEach((dependency) => {
|
|
92
117
|
if (ignoreDependencies[dependency] || pkg.name === dependency) {
|
|
93
118
|
removeDependencies.push(dependency);
|
|
94
119
|
} else {
|
|
@@ -120,7 +145,10 @@ const internalAddDependencies = (pkg, type, dependencies, cleaned, prefix) => {
|
|
|
120
145
|
? `${prefix || ''}${potentialNewVersionCleaned}`
|
|
121
146
|
: potentialNewVersion;
|
|
122
147
|
try {
|
|
123
|
-
if (
|
|
148
|
+
if (currentVersion === 'workspace:*') {
|
|
149
|
+
// the package is in the monorepo
|
|
150
|
+
return;
|
|
151
|
+
} else if (
|
|
124
152
|
!currentVersion ||
|
|
125
153
|
semver.gt(potentialNewVersionCleaned, cleanVersion(currentVersion))
|
|
126
154
|
) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.7.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -38,37 +38,31 @@
|
|
|
38
38
|
"arrowParens": "always"
|
|
39
39
|
},
|
|
40
40
|
"pob": {},
|
|
41
|
-
"resolutions": {
|
|
42
|
-
"yeoman-generator": "4.13.0"
|
|
43
|
-
},
|
|
44
|
-
"resolutionsExplained": {
|
|
45
|
-
"yeoman-generator": "generator-license has a dependency to yeoman-generator@2.0.5"
|
|
46
|
-
},
|
|
47
41
|
"dependencies": {
|
|
48
42
|
"@lerna/package-graph": "^4.0.0",
|
|
49
43
|
"@lerna/project": "^4.0.0",
|
|
50
|
-
"@pob/sort-eslint-config": "^3.0.
|
|
51
|
-
"@pob/sort-object": "^4.0.
|
|
52
|
-
"@pob/sort-pkg": "^4.0.
|
|
53
|
-
"@yarnpkg/parsers": "
|
|
44
|
+
"@pob/sort-eslint-config": "^3.0.1",
|
|
45
|
+
"@pob/sort-object": "^4.0.1",
|
|
46
|
+
"@pob/sort-pkg": "^4.0.1",
|
|
47
|
+
"@yarnpkg/parsers": "2.5.0-rc.6",
|
|
54
48
|
"findup-sync": "^5.0.0",
|
|
55
|
-
"generator-license": "^5.4.0",
|
|
56
49
|
"git-remote-url": "^1.0.1",
|
|
57
50
|
"github-username": "^6.0.0",
|
|
58
51
|
"got": "^11.8.1",
|
|
59
52
|
"inquirer-npm-name": "^4.0.0",
|
|
53
|
+
"json5": "^2.2.0",
|
|
60
54
|
"lodash.camelcase": "^4.3.0",
|
|
61
55
|
"lodash.kebabcase": "^4.1.1",
|
|
62
56
|
"mem-fs": "1.2.0",
|
|
63
57
|
"mem-fs-editor": "8.1.2",
|
|
64
58
|
"minimist-argv": "^1.1.0",
|
|
65
59
|
"parse-author": "^2.0.0",
|
|
66
|
-
"pob-dependencies": "
|
|
60
|
+
"pob-dependencies": "6.3.0",
|
|
67
61
|
"prettier": "2.5.1",
|
|
68
62
|
"semver": "^7.3.4",
|
|
69
63
|
"update-notifier": "^5.0.1",
|
|
70
64
|
"yeoman-environment": "^3.5.1",
|
|
71
65
|
"yeoman-generator": "^5.4.0"
|
|
72
66
|
},
|
|
73
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "64c950f50f9ebd3fd0a135bc911a9edd6b70f23f"
|
|
74
68
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
module.exports = function babelConfig(api) {
|
|
6
|
-
const isTest = api.env('test');
|
|
7
|
-
|
|
8
|
-
if (!isTest) return {};
|
|
9
|
-
|
|
10
|
-
return {
|
|
11
|
-
only: [path.resolve(__dirname, 'src')],
|
|
12
|
-
presets: [[require.resolve('pob-babel/preset')<% if (!jestExperimentalESM) { %>, { modules: 'commonjs' }<% } %>]],
|
|
13
|
-
};
|
|
14
|
-
};
|