pob 11.2.0 → 11.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 +37 -0
- package/lib/generators/common/babel/CommonBabelGenerator.js +28 -24
- package/lib/generators/common/format-lint/CommonLintGenerator.js +1 -1
- package/lib/generators/common/format-lint/updateEslintConfig.js +2 -2
- package/lib/generators/common/husky/CommonHuskyGenerator.js +1 -1
- package/lib/generators/common/testing/CommonTestingGenerator.js +6 -1
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +45 -34
- package/lib/generators/common/typescript/templates/tsconfig.build.json.ejs +0 -8
- package/lib/generators/common/typescript/templates/tsconfig.check.json.ejs +13 -0
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +14 -8
- package/lib/generators/core/npm/templates/npmignore.ejs +1 -3
- package/lib/generators/lib/doc/templates/tsconfig.doc.json.ejs +1 -1
- package/lib/generators/lib/doc/templates/tsconfig.doc.json.lerna.ejs +1 -1
- package/lib/generators/monorepo/PobMonorepoGenerator.js +1 -3
- package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +1 -4
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +55 -37
- package/lib/generators/monorepo/typescript/templates/tsconfig.check.json.ejs +8 -0
- package/lib/generators/pob/PobBaseGenerator.js +1 -1
- package/package.json +9 -9
- package/lib/generators/common/typescript/templates/tsconfig.eslint.json.ejs +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,43 @@
|
|
|
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
|
+
# [11.4.0](https://github.com/christophehurpeau/pob/compare/pob@11.3.0...pob@11.4.0) (2022-11-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix clean:build script in workspace ([990dbb9](https://github.com/christophehurpeau/pob/commit/990dbb9815d550fb154d25deb7540e175a58f409))
|
|
12
|
+
* **pob:** fix removed @pob/root ([79f2b1f](https://github.com/christophehurpeau/pob/commit/79f2b1f1ea8e20a60f7ccecf796e1cd8d8fdb706))
|
|
13
|
+
* **pob:** packageUtils ([ce3df65](https://github.com/christophehurpeau/pob/commit/ce3df6583c415b5e59fafdc8ea300730237bdbef))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **deps:** update dependency eslint to v8.28.0 ([#1458](https://github.com/christophehurpeau/pob/issues/1458)) ([dab9337](https://github.com/christophehurpeau/pob/commit/dab93371c4e8ff4e424e97c6ffad8232ac2e68aa))
|
|
19
|
+
* simplify tsconfig ([83e1ad1](https://github.com/christophehurpeau/pob/commit/83e1ad11dac522c93821fb91dc1b2ccdebd0be16))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [11.3.0](https://github.com/christophehurpeau/pob/compare/pob@11.2.0...pob@11.3.0) (2022-11-15)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **pob:** fix in babel generator when formats is not defined ([8f975c8](https://github.com/christophehurpeau/pob/commit/8f975c84a9ef48475fbd70979b8a86ede5d8f3e6))
|
|
31
|
+
* **pob:** fix in babel generator when formats is not defined ([3a0fe7d](https://github.com/christophehurpeau/pob/commit/3a0fe7d8a5b937b8bdf31486e0d9cd86aa06acee))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* **pob:** improve lint:eslint and add test scripts in monorepo ([3d6c9d5](https://github.com/christophehurpeau/pob/commit/3d6c9d5f462bf11e57683b2fa1fe198503eb4f71))
|
|
37
|
+
* **pob:** remove formats when cjs not in it ([e86d3f4](https://github.com/christophehurpeau/pob/commit/e86d3f4589ea19d32614ba1198018122229b1a45))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
6
43
|
# [11.2.0](https://github.com/christophehurpeau/pob/compare/pob@11.1.0...pob@11.2.0) (2022-11-15)
|
|
7
44
|
|
|
8
45
|
|
|
@@ -106,8 +106,10 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
106
106
|
.filter((env) => env.target === 'browser')
|
|
107
107
|
.map((env) => (env.version === undefined ? 'supported' : env.version));
|
|
108
108
|
const formats = [
|
|
109
|
-
babelEnvs.some((env) => env.formats
|
|
110
|
-
babelEnvs.some((env) => env.formats.includes('es'))
|
|
109
|
+
babelEnvs.some((env) => env.formats?.includes('cjs')) ? 'cjs' : undefined,
|
|
110
|
+
babelEnvs.some((env) => !env.formats || env.formats.includes('es'))
|
|
111
|
+
? 'es'
|
|
112
|
+
: undefined,
|
|
111
113
|
].filter(Boolean);
|
|
112
114
|
const jsx =
|
|
113
115
|
(pkg.pob.jsx || pkg.pob.withReact) === undefined
|
|
@@ -201,8 +203,8 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
201
203
|
? // eslint-disable-next-line unicorn/no-nested-ternary
|
|
202
204
|
version === '16'
|
|
203
205
|
? babelConfig.formats
|
|
204
|
-
:
|
|
205
|
-
:
|
|
206
|
+
: undefined
|
|
207
|
+
: undefined,
|
|
206
208
|
})),
|
|
207
209
|
...(babelConfig.browserVersions || []).map((version) => ({
|
|
208
210
|
target: 'browser',
|
|
@@ -212,8 +214,8 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
212
214
|
? // eslint-disable-next-line unicorn/no-nested-ternary
|
|
213
215
|
version === 'supported'
|
|
214
216
|
? babelConfig.formats
|
|
215
|
-
:
|
|
216
|
-
:
|
|
217
|
+
: undefined
|
|
218
|
+
: undefined,
|
|
217
219
|
})),
|
|
218
220
|
];
|
|
219
221
|
|
|
@@ -247,14 +249,15 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
247
249
|
if (this.entries) {
|
|
248
250
|
this.entries.forEach((entry) => {
|
|
249
251
|
const entryDestPath = this.destinationPath(`${entry}.js`);
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
252
|
+
// TODO check nightingale before uncomment this
|
|
253
|
+
// if (this.options.isApp && entry !== 'index') {
|
|
254
|
+
// this.fs.write(
|
|
255
|
+
// entryDestPath,
|
|
256
|
+
// `// resolution for eslint-plugin-import\nexport * from './src/${entry}/index.ts';\n`,
|
|
257
|
+
// );
|
|
258
|
+
// } else {
|
|
259
|
+
this.fs.delete(entryDestPath);
|
|
260
|
+
// }
|
|
258
261
|
});
|
|
259
262
|
}
|
|
260
263
|
//
|
|
@@ -297,7 +300,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
297
300
|
|
|
298
301
|
const shouldBuildDefinitions = !this.options.isApp && useBabel;
|
|
299
302
|
packageUtils.addOrRemoveScripts(pkg, shouldBuildDefinitions, {
|
|
300
|
-
'build:definitions': 'tsc -p
|
|
303
|
+
'build:definitions': 'tsc -p',
|
|
301
304
|
});
|
|
302
305
|
|
|
303
306
|
if (shouldBuildDefinitions) {
|
|
@@ -467,7 +470,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
467
470
|
// see pkg.exports instead.
|
|
468
471
|
delete pkg.main;
|
|
469
472
|
if (!this.options.isApp) {
|
|
470
|
-
pkg.types = `./${this.options.buildDirectory}/index.d.ts`;
|
|
473
|
+
pkg.types = `./${this.options.buildDirectory}/definitions/index.d.ts`;
|
|
471
474
|
}
|
|
472
475
|
} else {
|
|
473
476
|
if (!pkg.main) {
|
|
@@ -505,18 +508,19 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
505
508
|
(env) =>
|
|
506
509
|
env.target === 'browser' &&
|
|
507
510
|
env.version === undefined &&
|
|
508
|
-
env.formats.includes('es'),
|
|
511
|
+
(!env.formats || env.formats.includes('es')),
|
|
509
512
|
);
|
|
510
513
|
|
|
511
514
|
const esModernBrowserEnv = this.babelEnvs.find(
|
|
512
515
|
(env) =>
|
|
513
516
|
env.target === 'browser' &&
|
|
514
517
|
env.version === 'modern' &&
|
|
515
|
-
env.formats.includes('es'),
|
|
518
|
+
(!env.formats || env.formats.includes('es')),
|
|
516
519
|
);
|
|
517
520
|
|
|
518
521
|
const esNodeEnv = this.babelEnvs.find(
|
|
519
|
-
(env) =>
|
|
522
|
+
(env) =>
|
|
523
|
+
env.target === 'node' && (!env.formats || env.formats.includes('es')),
|
|
520
524
|
);
|
|
521
525
|
|
|
522
526
|
// Legacy "dev" builds
|
|
@@ -601,13 +605,13 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
601
605
|
|
|
602
606
|
if (target === 'node') {
|
|
603
607
|
const cjsExt = pkg.type === 'module' ? 'cjs' : 'cjs.js';
|
|
604
|
-
if (formats.includes('es')) {
|
|
608
|
+
if (!formats || formats.includes('es')) {
|
|
605
609
|
exportTarget.import = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.mjs`;
|
|
606
610
|
|
|
607
|
-
if (formats.includes('cjs')) {
|
|
611
|
+
if (formats && formats.includes('cjs')) {
|
|
608
612
|
exportTarget.require = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
|
|
609
613
|
}
|
|
610
|
-
} else if (formats.includes('cjs')) {
|
|
614
|
+
} else if (formats && formats.includes('cjs')) {
|
|
611
615
|
exportTarget.default = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
|
|
612
616
|
}
|
|
613
617
|
// eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
|
|
@@ -621,13 +625,13 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
621
625
|
exportTarget.import;
|
|
622
626
|
}
|
|
623
627
|
} else if (target === 'browser') {
|
|
624
|
-
if (formats.includes('es')) {
|
|
628
|
+
if (!formats || formats.includes('es')) {
|
|
625
629
|
exportTarget.import = `./${
|
|
626
630
|
this.options.buildDirectory
|
|
627
631
|
}/${entryDistName}-${target}${version || ''}.es.js`;
|
|
628
632
|
}
|
|
629
633
|
|
|
630
|
-
if (formats.includes('cjs')) {
|
|
634
|
+
if (formats && formats.includes('cjs')) {
|
|
631
635
|
exportTarget.require = `./${
|
|
632
636
|
this.options.buildDirectory
|
|
633
637
|
}/index-${target}${version || ''}.cjs.js`;
|
|
@@ -524,7 +524,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
524
524
|
|
|
525
525
|
packageUtils.addScripts(pkg, {
|
|
526
526
|
'lint:eslint': globalEslint
|
|
527
|
-
? `
|
|
527
|
+
? `yarn ../.. run eslint ${args} ${path
|
|
528
528
|
.relative('../..', '.')
|
|
529
529
|
.replace('\\', '/')}`
|
|
530
530
|
: `eslint ${args} ${lintPaths.join(' ')}`,
|
|
@@ -38,12 +38,12 @@ function updateParserAndPlugins(
|
|
|
38
38
|
|
|
39
39
|
if (!globalEslint) {
|
|
40
40
|
config.parserOptions = {
|
|
41
|
-
project: './tsconfig.
|
|
41
|
+
project: './tsconfig.json',
|
|
42
42
|
createDefaultProgram: true, // fix for lint-staged
|
|
43
43
|
};
|
|
44
44
|
} else {
|
|
45
45
|
config.parserOptions = {
|
|
46
|
-
project: `${relativePath}/tsconfig.
|
|
46
|
+
project: `${relativePath}/tsconfig.json`,
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
} else {
|
|
@@ -103,7 +103,7 @@ export default class CommonHuskyGenerator extends Generator {
|
|
|
103
103
|
// this.fs.delete('.git/hooks/husky.local.sh');
|
|
104
104
|
} else {
|
|
105
105
|
packageUtils.removeDevDependencies(pkg, [
|
|
106
|
-
'@pob/root',
|
|
106
|
+
pkg.name !== 'pob' && '@pob/root',
|
|
107
107
|
'@pob/commitlint-config',
|
|
108
108
|
]);
|
|
109
109
|
this.fs.delete(this.destinationPath('lint-staged.config.cjs'));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
1
2
|
import Generator from 'yeoman-generator';
|
|
2
3
|
import inLerna from '../../../utils/inLerna.js';
|
|
3
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
@@ -189,10 +190,14 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
189
190
|
} else if (globalTesting) {
|
|
190
191
|
delete pkg.jest;
|
|
191
192
|
if (pkg.scripts) {
|
|
192
|
-
delete pkg.scripts.test;
|
|
193
193
|
delete pkg.scripts['generate:test-coverage'];
|
|
194
194
|
delete pkg.scripts['test:watch'];
|
|
195
195
|
}
|
|
196
|
+
packageUtils.addScripts(pkg, {
|
|
197
|
+
test: `yarn ../../ run test -- ${path
|
|
198
|
+
.relative('../..', '.')
|
|
199
|
+
.replace('\\', '/')}`,
|
|
200
|
+
});
|
|
196
201
|
} else {
|
|
197
202
|
const babelEnvs = pkg.pob.babelEnvs || [];
|
|
198
203
|
const transpileWithBabel = packageUtils.transpileWithBabel(pkg);
|
|
@@ -91,13 +91,15 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
const tsconfigPath = this.destinationPath('tsconfig.json');
|
|
94
|
+
const tsconfigCheckPath = this.destinationPath('tsconfig.check.json');
|
|
94
95
|
const tsconfigEslintPath = this.destinationPath('tsconfig.eslint.json');
|
|
95
96
|
const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
|
|
97
|
+
|
|
96
98
|
if (this.options.enable) {
|
|
97
99
|
const { jsx, dom } = this.options;
|
|
98
100
|
let composite;
|
|
99
101
|
let monorepoPackageReferences;
|
|
100
|
-
let monorepoPackageBuildReferences;
|
|
102
|
+
// let monorepoPackageBuildReferences;
|
|
101
103
|
let monorepoPackageSrcPaths;
|
|
102
104
|
|
|
103
105
|
if (inLerna && !inLerna.root) {
|
|
@@ -153,21 +155,34 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
153
155
|
existsSync(`${packageLocations.get(packageName)}/tsconfig.json`),
|
|
154
156
|
)
|
|
155
157
|
.map((packageName) => packageLocations.get(packageName));
|
|
156
|
-
monorepoPackageBuildReferences = yoConfig.pob.monorepo.packageNames
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
158
|
+
// monorepoPackageBuildReferences = yoConfig.pob.monorepo.packageNames
|
|
159
|
+
// .filter((packageName) =>
|
|
160
|
+
// existsSync(
|
|
161
|
+
// `${packageLocations.get(packageName)}/tsconfig.build.json`,
|
|
162
|
+
// ),
|
|
163
|
+
// )
|
|
164
|
+
// .map((packageName) => packageLocations.get(packageName));
|
|
163
165
|
}
|
|
164
166
|
}
|
|
165
167
|
|
|
168
|
+
if (this.fs.exists(tsconfigEslintPath)) {
|
|
169
|
+
this.fs.delete(tsconfigEslintPath);
|
|
170
|
+
}
|
|
171
|
+
if (this.fs.exists(tsconfigCheckPath)) {
|
|
172
|
+
this.fs.delete(tsconfigCheckPath);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/*
|
|
176
|
+
Only using one file:
|
|
177
|
+
- allows IDE and typedoc to behave correctly
|
|
178
|
+
- generate useless definition files for not excluded tests files. However, it also use them for cache.
|
|
179
|
+
*/
|
|
166
180
|
copyAndFormatTpl(
|
|
167
181
|
this.fs,
|
|
168
182
|
this.templatePath('tsconfig.json.ejs'),
|
|
169
183
|
tsconfigPath,
|
|
170
184
|
{
|
|
185
|
+
emit: this.options.builddefs,
|
|
171
186
|
monorepoPackageSrcPaths,
|
|
172
187
|
monorepoPackageReferences,
|
|
173
188
|
rootDir: this.options.rootDir,
|
|
@@ -181,36 +196,32 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
181
196
|
forceAllowJs: this.options.forceAllowJs,
|
|
182
197
|
},
|
|
183
198
|
);
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
},
|
|
205
|
-
);
|
|
206
|
-
} else {
|
|
207
|
-
this.fs.delete(tsconfigBuildPath);
|
|
208
|
-
}
|
|
199
|
+
|
|
200
|
+
// if (
|
|
201
|
+
// this.options.builddefs // &&
|
|
202
|
+
// // (!composite || monorepoPackageNames.length !== 0)
|
|
203
|
+
// ) {
|
|
204
|
+
// copyAndFormatTpl(
|
|
205
|
+
// this.fs,
|
|
206
|
+
// this.templatePath('tsconfig.build.json.ejs'),
|
|
207
|
+
// tsconfigBuildPath,
|
|
208
|
+
// {
|
|
209
|
+
// inMonorepo: inLerna && !inLerna.root,
|
|
210
|
+
// jsx,
|
|
211
|
+
// composite,
|
|
212
|
+
// monorepoPackageSrcPaths,
|
|
213
|
+
// monorepoPackageBuildReferences,
|
|
214
|
+
// },
|
|
215
|
+
// );
|
|
216
|
+
// } else {
|
|
217
|
+
this.fs.delete(tsconfigBuildPath);
|
|
218
|
+
// }
|
|
209
219
|
} else {
|
|
210
220
|
if (pkg.scripts) delete pkg.scripts.tsc;
|
|
211
221
|
this.fs.delete(tsconfigPath);
|
|
212
|
-
this.fs.delete(tsconfigEslintPath);
|
|
213
222
|
this.fs.delete(tsconfigBuildPath);
|
|
223
|
+
this.fs.delete(tsconfigCheckPath);
|
|
224
|
+
this.fs.delete(tsconfigEslintPath);
|
|
214
225
|
}
|
|
215
226
|
|
|
216
227
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
@@ -3,14 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"noEmit": false,
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"emitDeclarationOnly": true,
|
|
9
|
-
"outDir": "dist",
|
|
10
|
-
"newLine": "lf"<% if(composite) { -%>,
|
|
11
|
-
"composite": true,
|
|
12
|
-
"tsBuildInfoFile": "dist/tsbuildinfo"
|
|
13
|
-
<% } -%>
|
|
14
6
|
},
|
|
15
7
|
|
|
16
8
|
"exclude": [
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"noEmit": true,
|
|
6
|
+
}<% if (monorepoPackageCheckReferences && monorepoPackageCheckReferences.length) { %>,<% } -%>
|
|
7
|
+
<% if (monorepoPackageCheckReferences && monorepoPackageCheckReferences.length) { %>
|
|
8
|
+
"references": [
|
|
9
|
+
<% monorepoPackageCheckReferences.forEach((monorepoPackageSrcPath, index) => { -%>
|
|
10
|
+
{ "path": "<%= monorepoPackageSrcPath %>/tsconfig.check.json" }<%= index === monorepoPackageCheckReferences.length -1 ? '' : ',' %>
|
|
11
|
+
<% }) -%>
|
|
12
|
+
]<% } -%>
|
|
13
|
+
}
|
|
@@ -10,19 +10,25 @@
|
|
|
10
10
|
<% } -%>
|
|
11
11
|
"compilerOptions": {
|
|
12
12
|
"rootDir": "<%= rootDir %>",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
13
|
+
"newLine": "lf",
|
|
14
|
+
<% if (emit) { -%>
|
|
15
|
+
"outDir": "dist/definitions",
|
|
16
|
+
"tsBuildInfoFile": "dist/definitions/tsbuildinfo",
|
|
17
|
+
<% } else if (composite) { -%>
|
|
18
|
+
"outDir": "node_modules/.cache/tsc",
|
|
19
|
+
"tsBuildInfoFile": "node_modules/.cache/tsc/tsbuildinfo",
|
|
16
20
|
<% } else { -%>
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
"noEmit": true,
|
|
22
|
+
<% } -%>
|
|
23
|
+
<% if (composite || emit) { -%>
|
|
20
24
|
"noEmitOnError": true,
|
|
21
25
|
"declaration": true,
|
|
22
26
|
"declarationMap": true,
|
|
23
27
|
"emitDeclarationOnly": true,
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
<% } -%>
|
|
29
|
+
<% if(composite) { -%>
|
|
30
|
+
"incremental": true,
|
|
31
|
+
"composite": true,
|
|
26
32
|
<% } -%>
|
|
27
33
|
|
|
28
34
|
/* No need to check .d.ts files */
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
"references": [
|
|
24
24
|
<% packagePaths.forEach((packagePath, index) => { -%>
|
|
25
|
-
{ "path": "<%= packagePath %>/tsconfig.
|
|
25
|
+
{ "path": "<%= packagePath %>/tsconfig.json" }<%= index === packagePaths.length -1 ? '' : ',' %>
|
|
26
26
|
<% }) -%>
|
|
27
27
|
],
|
|
28
28
|
|
|
@@ -315,9 +315,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
315
315
|
this.fs.delete('rollup.config.mjs');
|
|
316
316
|
}
|
|
317
317
|
packageUtils.addOrRemoveScripts(pkg, rollupConfigs.length > 0, {
|
|
318
|
-
'clean:build':
|
|
319
|
-
.map((workspaces) => `rm -Rf ${workspaces}/dist ${workspaces}/build`)
|
|
320
|
-
.join(' ; ')}) || true`,
|
|
318
|
+
'clean:build': 'yarn workspaces foreach run clean:build',
|
|
321
319
|
build: 'yarn clean:build && rollup --config rollup.config.mjs',
|
|
322
320
|
watch: 'yarn clean:build && rollup --config rollup.config.mjs --watch',
|
|
323
321
|
});
|
|
@@ -109,10 +109,7 @@ export default class MonorepoLernaGenerator extends Generator {
|
|
|
109
109
|
];
|
|
110
110
|
|
|
111
111
|
if (withBabel) {
|
|
112
|
-
lernaConfig.command.publish.ignoreChanges.push(
|
|
113
|
-
'**/tsconfig.json',
|
|
114
|
-
'**/tsconfig.build.json',
|
|
115
|
-
);
|
|
112
|
+
lernaConfig.command.publish.ignoreChanges.push('**/tsconfig.json');
|
|
116
113
|
}
|
|
117
114
|
|
|
118
115
|
writeAndFormatJson(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { existsSync } from 'fs';
|
|
2
1
|
import Generator from 'yeoman-generator';
|
|
3
2
|
import * as packageUtils from '../../../utils/package.js';
|
|
4
3
|
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
@@ -48,14 +47,12 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
48
47
|
'typescript',
|
|
49
48
|
]);
|
|
50
49
|
|
|
51
|
-
const tsconfigPath = this.destinationPath('tsconfig.json');
|
|
52
|
-
const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
|
|
53
50
|
if (this.options.enable) {
|
|
54
51
|
packageUtils.addScripts(pkg, {
|
|
55
52
|
tsc: 'tsc -b',
|
|
56
53
|
});
|
|
57
54
|
packageUtils.addOrRemoveScripts(pkg, !this.options.isAppProject, {
|
|
58
|
-
'build:definitions': 'tsc -b
|
|
55
|
+
'build:definitions': 'tsc -b',
|
|
59
56
|
});
|
|
60
57
|
|
|
61
58
|
delete pkg.scripts.postbuild;
|
|
@@ -63,7 +60,35 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
63
60
|
if (!this.options.isAppProject) {
|
|
64
61
|
pkg.scripts.build += ' && yarn run build:definitions';
|
|
65
62
|
}
|
|
63
|
+
} else if (pkg.scripts) {
|
|
64
|
+
delete pkg.scripts.tsc;
|
|
65
|
+
if (
|
|
66
|
+
pkg.scripts.postbuild === 'tsc -b tsconfig.build.json' ||
|
|
67
|
+
pkg.scripts.postbuild === 'tsc -b'
|
|
68
|
+
) {
|
|
69
|
+
delete pkg.scripts.postbuild;
|
|
70
|
+
}
|
|
71
|
+
delete pkg.scripts['build:definitions'];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (pkg.scripts) {
|
|
75
|
+
delete pkg.scripts['typescript-check'];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// after pob ran in workspaces
|
|
82
|
+
end() {
|
|
83
|
+
const tsconfigPath = this.destinationPath('tsconfig.json');
|
|
84
|
+
const tsconfigCheckPath = this.destinationPath('tsconfig.check.json');
|
|
85
|
+
const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
|
|
66
86
|
|
|
87
|
+
if (!this.options.enable) {
|
|
88
|
+
this.fs.delete(tsconfigPath);
|
|
89
|
+
this.fs.delete(tsconfigCheckPath);
|
|
90
|
+
this.fs.delete(tsconfigBuildPath);
|
|
91
|
+
} else {
|
|
67
92
|
const packagePaths = JSON.parse(this.options.packagePaths);
|
|
68
93
|
|
|
69
94
|
copyAndFormatTpl(
|
|
@@ -74,40 +99,33 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
74
99
|
packagePaths,
|
|
75
100
|
},
|
|
76
101
|
);
|
|
77
|
-
if (this.options.isAppProject) {
|
|
78
|
-
this.fs.delete(tsconfigBuildPath);
|
|
79
|
-
} else {
|
|
80
|
-
copyAndFormatTpl(
|
|
81
|
-
this.fs,
|
|
82
|
-
this.templatePath('tsconfig.build.json.ejs'),
|
|
83
|
-
tsconfigBuildPath,
|
|
84
|
-
{
|
|
85
|
-
packagePaths: packagePaths.filter((packagePath) =>
|
|
86
|
-
existsSync(
|
|
87
|
-
`${packagePath}/tsconfig${
|
|
88
|
-
this.options.isAppProject ? '' : '.build'
|
|
89
|
-
}.json`,
|
|
90
|
-
),
|
|
91
|
-
),
|
|
92
|
-
},
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
} else {
|
|
96
|
-
if (pkg.scripts) {
|
|
97
|
-
delete pkg.scripts.tsc;
|
|
98
|
-
if (pkg.scripts.postbuild === 'tsc -b tsconfig.build.json') {
|
|
99
|
-
delete pkg.scripts.postbuild;
|
|
100
|
-
}
|
|
101
|
-
delete pkg.scripts['build:definitions'];
|
|
102
|
-
}
|
|
103
|
-
this.fs.delete(tsconfigPath);
|
|
104
|
-
this.fs.delete(tsconfigBuildPath);
|
|
105
|
-
}
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
delete
|
|
103
|
+
this.fs.delete(tsconfigCheckPath);
|
|
104
|
+
this.fs.delete(tsconfigBuildPath);
|
|
105
|
+
// if (this.options.isAppProject) {
|
|
106
|
+
// } else {
|
|
107
|
+
// copyAndFormatTpl(
|
|
108
|
+
// this.fs,
|
|
109
|
+
// this.templatePath('tsconfig.check.json.ejs'),
|
|
110
|
+
// tsconfigCheckPath,
|
|
111
|
+
// {
|
|
112
|
+
// packagePaths: packagePaths.filter((packagePath) =>
|
|
113
|
+
// existsSync(`${packagePath}/tsconfig.check.json`),
|
|
114
|
+
// ),
|
|
115
|
+
// },
|
|
116
|
+
// );
|
|
117
|
+
|
|
118
|
+
// copyAndFormatTpl(
|
|
119
|
+
// this.fs,
|
|
120
|
+
// this.templatePath('tsconfig.build.json.ejs'),
|
|
121
|
+
// tsconfigBuildPath,
|
|
122
|
+
// {
|
|
123
|
+
// packagePaths: packagePaths.filter((packagePath) =>
|
|
124
|
+
// existsSync(`${packagePath}/tsconfig.build.json`),
|
|
125
|
+
// ),
|
|
126
|
+
// },
|
|
127
|
+
// );
|
|
128
|
+
// }
|
|
109
129
|
}
|
|
110
|
-
|
|
111
|
-
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
112
130
|
}
|
|
113
131
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.4.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"scripts": {
|
|
31
31
|
"format": "prettier --write",
|
|
32
32
|
"lint": "yarn run lint:eslint",
|
|
33
|
-
"lint:eslint": "
|
|
33
|
+
"lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/pob"
|
|
34
34
|
},
|
|
35
35
|
"prettier": "@pob/root/prettier-config",
|
|
36
36
|
"pob": {},
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"@pob/eslint-config": "49.4.0",
|
|
41
41
|
"@pob/eslint-config-typescript": "49.4.0",
|
|
42
42
|
"@pob/eslint-config-typescript-react": "49.4.0",
|
|
43
|
-
"@pob/sort-eslint-config": "4.
|
|
44
|
-
"@pob/sort-object": "5.
|
|
45
|
-
"@pob/sort-pkg": "5.
|
|
46
|
-
"eslint": "8.
|
|
43
|
+
"@pob/sort-eslint-config": "4.1.0",
|
|
44
|
+
"@pob/sort-object": "5.1.0",
|
|
45
|
+
"@pob/sort-pkg": "5.1.0",
|
|
46
|
+
"eslint": "8.28.0",
|
|
47
47
|
"findup-sync": "^5.0.0",
|
|
48
48
|
"git-remote-url": "^1.0.1",
|
|
49
49
|
"github-username": "^6.0.0",
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
"minimist": "1.2.7",
|
|
58
58
|
"node-fetch": "3.3.0",
|
|
59
59
|
"parse-author": "2.0.0",
|
|
60
|
-
"pob-dependencies": "7.
|
|
60
|
+
"pob-dependencies": "7.2.0",
|
|
61
61
|
"prettier": "2.7.1",
|
|
62
62
|
"semver": "7.3.8",
|
|
63
63
|
"yeoman-environment": "3.12.1",
|
|
64
64
|
"yeoman-generator": "5.7.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@pob/root": "7.
|
|
67
|
+
"@pob/root": "7.2.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "e251d920020bbd336916da28d2681a45b5acf807"
|
|
70
70
|
}
|