pob 10.1.0 → 10.3.1
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 +59 -0
- package/lib/generators/app/PobAppGenerator.js +15 -4
- package/lib/generators/app/ignorePaths.js +2 -1
- package/lib/generators/common/babel/CommonBabelGenerator.js +46 -22
- package/lib/generators/common/babel/templates/app.rollup.config.mjs.ejs +11 -1
- package/lib/generators/common/format-lint/CommonLintGenerator.js +9 -3
- package/lib/generators/common/format-lint/updateEslintConfig.js +11 -3
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +15 -1
- package/lib/generators/common/typescript/templates/tsconfig.eslint.json.ejs +7 -0
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +4 -4
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +3 -1
- package/lib/generators/core/vscode/templates/settings.json.ejs +5 -0
- package/lib/generators/monorepo/PobMonorepoGenerator.js +18 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,65 @@
|
|
|
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
|
+
## [10.3.1](https://github.com/christophehurpeau/pob/compare/pob@10.3.0...pob@10.3.1) (2022-02-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **pob:** fix app import/resolver config ([5179b36](https://github.com/christophehurpeau/pob/commit/5179b364d1b72f0ed3a3b7df577e46d49e23d69a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [10.3.0](https://github.com/christophehurpeau/pob/compare/pob@10.2.1...pob@10.3.0) (2022-02-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* alllow "allow-unsafe" in extends in eslint configs ([e1c0d69](https://github.com/christophehurpeau/pob/commit/e1c0d695feaba044c8a80d430254481854861dec))
|
|
23
|
+
* **pob:** fix tsconfig references for apps ([ea5e185](https://github.com/christophehurpeau/pob/commit/ea5e185ae67ded3ea55f5d4bc992e9526ba98c0a))
|
|
24
|
+
* use buid directory option in babel generator ([03a6754](https://github.com/christophehurpeau/pob/commit/03a6754a5356ed97dd39dc4e9292126f0696a44e))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* experimental vscode tasks generator ([d7a727f](https://github.com/christophehurpeau/pob/commit/d7a727fa1f8aec1e0f6f56b8219ea781b0759240))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## [10.2.1](https://github.com/christophehurpeau/pob/compare/pob@10.2.0...pob@10.2.1) (2022-02-19)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* **deps:** update dependency @yarnpkg/parsers to v2.5.0-rc.14 ([#1213](https://github.com/christophehurpeau/pob/issues/1213)) ([82319b2](https://github.com/christophehurpeau/pob/commit/82319b27f6091cbb19851573d650620cfa361519))
|
|
41
|
+
* only enable incremental for composite tsconfigs ([b73a16a](https://github.com/christophehurpeau/pob/commit/b73a16a15a09f68cde3ad22d01331418c3a5d92c))
|
|
42
|
+
* **pob:** clean script ([6f2646e](https://github.com/christophehurpeau/pob/commit/6f2646e150e5ca4c889f5657811273a44eb68549))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# [10.2.0](https://github.com/christophehurpeau/pob/compare/pob@10.1.0...pob@10.2.0) (2022-02-13)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Bug Fixes
|
|
52
|
+
|
|
53
|
+
* **deps:** update dependency @pob/eslint-config-typescript-react to v49.0.1 ([#1204](https://github.com/christophehurpeau/pob/issues/1204)) ([5fc0b39](https://github.com/christophehurpeau/pob/commit/5fc0b39970645a99188f8a74fb473535a6d38461))
|
|
54
|
+
* **pob:** create eslint specific tsconfig ([fb80eac](https://github.com/christophehurpeau/pob/commit/fb80eaccce5c48dfe4af98c411ef3839c11f3be8))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
* build directory for apps and alp-rollup-plugin-config ([0d57816](https://github.com/christophehurpeau/pob/commit/0d57816fbe0ac0a86d0bf7204aed42c3313366df))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
6
65
|
# [10.1.0](https://github.com/christophehurpeau/pob/compare/pob@10.0.0...pob@10.1.0) (2022-02-12)
|
|
7
66
|
|
|
8
67
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { execSync } from 'child_process';
|
|
1
2
|
import Generator from 'yeoman-generator';
|
|
2
3
|
import inLerna from '../../utils/inLerna.js';
|
|
3
4
|
import inNpmLerna from '../../utils/inNpmLerna.js';
|
|
@@ -5,7 +6,7 @@ import * as packageUtils from '../../utils/package.js';
|
|
|
5
6
|
import { appIgnorePaths } from './ignorePaths.js';
|
|
6
7
|
|
|
7
8
|
const appsWithTypescript = ['alp', 'next.js', 'pobpack'];
|
|
8
|
-
const
|
|
9
|
+
const appsWithBrowser = ['alp', 'next.js'];
|
|
9
10
|
|
|
10
11
|
export default class PobAppGenerator extends Generator {
|
|
11
12
|
constructor(args, opts) {
|
|
@@ -66,7 +67,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
66
67
|
name: 'type',
|
|
67
68
|
message: 'What kind of app is this ?',
|
|
68
69
|
default: (config && config.type) || 'alp',
|
|
69
|
-
choices: ['alp', 'pobpack', 'next.js', 'node', 'other'],
|
|
70
|
+
choices: ['alp', 'pobpack', 'next.js', 'node', 'alp-node', 'other'],
|
|
70
71
|
},
|
|
71
72
|
{
|
|
72
73
|
type: 'confirm',
|
|
@@ -103,13 +104,15 @@ export default class PobAppGenerator extends Generator {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
default() {
|
|
106
|
-
if (this.appConfig.type === 'node') {
|
|
107
|
+
if (this.appConfig.type === 'node' || this.appConfig.type === 'alp-node') {
|
|
107
108
|
this.composeWith('pob:common:babel', {
|
|
108
109
|
updateOnly: this.options.updateOnly,
|
|
109
110
|
isApp: true,
|
|
111
|
+
useAppConfig: this.appConfig.type === 'alp-node',
|
|
110
112
|
testing: this.appConfig.testing,
|
|
111
113
|
documentation: false,
|
|
112
114
|
fromPob: this.options.fromPob,
|
|
115
|
+
buildDirectory: 'build',
|
|
113
116
|
});
|
|
114
117
|
}
|
|
115
118
|
|
|
@@ -123,7 +126,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
123
126
|
const babel =
|
|
124
127
|
babelEnvs.length > 0 || appsWithTypescript.includes(this.appConfig.type);
|
|
125
128
|
const node = true;
|
|
126
|
-
const browser =
|
|
129
|
+
const browser = appsWithBrowser.includes(this.appConfig.type);
|
|
127
130
|
const jsx =
|
|
128
131
|
babelEnvs.length > 0 && pkg.pob.jsx !== undefined
|
|
129
132
|
? pkg.pob.jsx
|
|
@@ -146,6 +149,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
146
149
|
this.appConfig.type === 'alp' ||
|
|
147
150
|
this.appConfig.type === 'pobpack' ||
|
|
148
151
|
this.appConfig.type === 'node' ||
|
|
152
|
+
this.appConfig.type === 'alp-node' ||
|
|
149
153
|
this.appConfig.type === 'next.js'
|
|
150
154
|
) {
|
|
151
155
|
return './src';
|
|
@@ -179,6 +183,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
179
183
|
packageManager: this.options.packageManager,
|
|
180
184
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
181
185
|
ignorePaths: ignorePaths.join('\n'),
|
|
186
|
+
buildDirectory: 'build',
|
|
182
187
|
});
|
|
183
188
|
|
|
184
189
|
this.composeWith('pob:common:release', {
|
|
@@ -220,6 +225,12 @@ export default class PobAppGenerator extends Generator {
|
|
|
220
225
|
});
|
|
221
226
|
break;
|
|
222
227
|
}
|
|
228
|
+
|
|
229
|
+
execSync(
|
|
230
|
+
`rm -Rf ${['lib-*', 'coverage', 'docs', 'dist']
|
|
231
|
+
.filter(Boolean)
|
|
232
|
+
.join(' ')}`,
|
|
233
|
+
);
|
|
223
234
|
}
|
|
224
235
|
|
|
225
236
|
writing() {
|
|
@@ -2,6 +2,7 @@ export const appIgnorePaths = {
|
|
|
2
2
|
alp: (config) => ['# alp paths', '/build', '/public', '/data'],
|
|
3
3
|
'next.js': (config) => ['# next.js paths', '/.next', '/out', '/build'],
|
|
4
4
|
pobpack: (config) => ['/build', '/public'],
|
|
5
|
-
node: (config) => ['/
|
|
5
|
+
node: (config) => ['/build'],
|
|
6
|
+
'alp-node': (config) => ['/build'],
|
|
6
7
|
other: (config) => [],
|
|
7
8
|
};
|
|
@@ -2,6 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import semver from 'semver';
|
|
3
3
|
import Generator from 'yeoman-generator';
|
|
4
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
5
|
+
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
5
6
|
|
|
6
7
|
export default class CommonBabelGenerator extends Generator {
|
|
7
8
|
constructor(args, opts) {
|
|
@@ -32,6 +33,18 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
32
33
|
required: false,
|
|
33
34
|
defaults: false,
|
|
34
35
|
});
|
|
36
|
+
|
|
37
|
+
this.option('useAppConfig', {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
required: false,
|
|
40
|
+
defaults: false,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
this.option('buildDirectory', {
|
|
44
|
+
type: String,
|
|
45
|
+
required: false,
|
|
46
|
+
defaults: 'dist',
|
|
47
|
+
});
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
initializing() {
|
|
@@ -271,7 +284,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
271
284
|
if (this.options.isApp) {
|
|
272
285
|
packageUtils.removeScripts(['watch']);
|
|
273
286
|
packageUtils.addOrRemoveScripts(pkg, useBabel, {
|
|
274
|
-
'clean:build':
|
|
287
|
+
'clean:build': `rm -Rf ${this.options.buildDirectory}`,
|
|
275
288
|
build: 'yarn clean:build && rollup --config rollup.config.mjs',
|
|
276
289
|
start: 'yarn clean:build && rollup --config rollup.config.mjs --watch',
|
|
277
290
|
clean: 'yarn clean:build',
|
|
@@ -279,7 +292,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
279
292
|
} else {
|
|
280
293
|
packageUtils.removeScripts(['start']);
|
|
281
294
|
packageUtils.addOrRemoveScripts(pkg, useBabel, {
|
|
282
|
-
'clean:build':
|
|
295
|
+
'clean:build': `rm -Rf ${this.options.buildDirectory}`,
|
|
283
296
|
build: 'yarn clean:build && rollup --config rollup.config.mjs',
|
|
284
297
|
watch: 'yarn clean:build && rollup --config rollup.config.mjs --watch',
|
|
285
298
|
clean: 'yarn clean:build',
|
|
@@ -457,7 +470,9 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
457
470
|
if (useBabel) {
|
|
458
471
|
// see pkg.exports instead.
|
|
459
472
|
delete pkg.main;
|
|
460
|
-
if (!this.options.isApp)
|
|
473
|
+
if (!this.options.isApp) {
|
|
474
|
+
pkg.types = `./${this.options.buildDirectory}/index.d.ts`;
|
|
475
|
+
}
|
|
461
476
|
} else {
|
|
462
477
|
if (!pkg.main) {
|
|
463
478
|
pkg.exports = './lib/index.js';
|
|
@@ -516,15 +531,17 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
516
531
|
|
|
517
532
|
/* webpack 4 */
|
|
518
533
|
if (esAllBrowserEnv) {
|
|
519
|
-
pkg.module =
|
|
520
|
-
pkg.browser =
|
|
534
|
+
pkg.module = `./${this.options.buildDirectory}/index-browser.es.js`;
|
|
535
|
+
pkg.browser = `./${this.options.buildDirectory}/index-browser.es.js`;
|
|
521
536
|
} else {
|
|
522
537
|
delete pkg.module;
|
|
523
538
|
delete pkg.browser;
|
|
524
539
|
}
|
|
525
540
|
|
|
526
541
|
if (esModernBrowserEnv) {
|
|
527
|
-
pkg[
|
|
542
|
+
pkg[
|
|
543
|
+
'module:modern-browsers'
|
|
544
|
+
] = `./${this.options.buildDirectory}/index-browsermodern.es.js`;
|
|
528
545
|
} else {
|
|
529
546
|
delete pkg['module:modern-browsers'];
|
|
530
547
|
}
|
|
@@ -533,7 +550,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
533
550
|
// webpack 4 node
|
|
534
551
|
pkg[
|
|
535
552
|
'module:node'
|
|
536
|
-
] =
|
|
553
|
+
] = `./${this.options.buildDirectory}/index-${esNodeEnv.target}${esNodeEnv.version}.mjs`;
|
|
537
554
|
}
|
|
538
555
|
|
|
539
556
|
const aliases = (this.entries || []).filter((entry) => entry !== 'index');
|
|
@@ -559,11 +576,9 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
559
576
|
const isBrowserOnly =
|
|
560
577
|
aliasName === 'browser' && env.target !== 'node';
|
|
561
578
|
const aliasDistName = isBrowserOnly ? 'index' : aliasName;
|
|
562
|
-
pkg[`module:aliases-${key}`][
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
env.version || ''
|
|
566
|
-
}.es.js`;
|
|
579
|
+
pkg[`module:aliases-${key}`][`./${aliasName}.js`] = `./${
|
|
580
|
+
this.options.buildDirectory
|
|
581
|
+
}/${aliasDistName}-${env.target}${env.version || ''}.es.js`;
|
|
567
582
|
});
|
|
568
583
|
});
|
|
569
584
|
}
|
|
@@ -597,13 +612,13 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
597
612
|
if (target === 'node') {
|
|
598
613
|
const cjsExt = pkg.type === 'module' ? 'cjs' : 'cjs.js';
|
|
599
614
|
if (formats.includes('es')) {
|
|
600
|
-
exportTarget.import =
|
|
615
|
+
exportTarget.import = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.mjs`;
|
|
601
616
|
|
|
602
617
|
if (formats.includes('cjs')) {
|
|
603
|
-
exportTarget.require =
|
|
618
|
+
exportTarget.require = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
|
|
604
619
|
}
|
|
605
620
|
} else if (formats.includes('cjs')) {
|
|
606
|
-
exportTarget.default =
|
|
621
|
+
exportTarget.default = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
|
|
607
622
|
}
|
|
608
623
|
// eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
|
|
609
624
|
// jest: https://github.com/facebook/jest/issues/9771
|
|
@@ -617,15 +632,15 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
617
632
|
}
|
|
618
633
|
} else if (target === 'browser') {
|
|
619
634
|
if (formats.includes('es')) {
|
|
620
|
-
exportTarget.import =
|
|
621
|
-
|
|
622
|
-
}.es.js`;
|
|
635
|
+
exportTarget.import = `./${
|
|
636
|
+
this.options.buildDirectory
|
|
637
|
+
}/${entryDistName}-${target}${version || ''}.es.js`;
|
|
623
638
|
}
|
|
624
639
|
|
|
625
640
|
if (formats.includes('cjs')) {
|
|
626
|
-
exportTarget.require =
|
|
627
|
-
|
|
628
|
-
}.cjs.js`;
|
|
641
|
+
exportTarget.require = `./${
|
|
642
|
+
this.options.buildDirectory
|
|
643
|
+
}/index-${target}${version || ''}.cjs.js`;
|
|
629
644
|
}
|
|
630
645
|
}
|
|
631
646
|
|
|
@@ -712,13 +727,22 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
712
727
|
/* pob-babel config */
|
|
713
728
|
|
|
714
729
|
packageUtils.removeDevDependencies(pkg, ['@rollup/plugin-run']);
|
|
730
|
+
packageUtils.addOrRemoveDependencies(
|
|
731
|
+
pkg,
|
|
732
|
+
useBabel && this.options.isApp && this.options.useAppConfig,
|
|
733
|
+
['alp-rollup-plugin-config'],
|
|
734
|
+
);
|
|
715
735
|
|
|
716
736
|
this.fs.delete('rollup.config.js');
|
|
717
737
|
if (useBabel) {
|
|
718
738
|
if (this.options.isApp) {
|
|
719
|
-
|
|
739
|
+
copyAndFormatTpl(
|
|
740
|
+
this.fs,
|
|
720
741
|
this.templatePath('app.rollup.config.mjs.ejs'),
|
|
721
742
|
this.destinationPath('rollup.config.mjs'),
|
|
743
|
+
{
|
|
744
|
+
config: this.options.useAppConfig,
|
|
745
|
+
},
|
|
722
746
|
);
|
|
723
747
|
} else {
|
|
724
748
|
this.fs.copy(
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
<% if (config) { -%>
|
|
2
|
+
import config from 'alp-rollup-plugin-config';
|
|
3
|
+
<% } -%>
|
|
1
4
|
import createRollupConfig from 'pob-babel/createRollupConfig.js';
|
|
2
5
|
import run from 'pob-babel/plugin-run.cjs';
|
|
3
6
|
|
|
@@ -5,5 +8,12 @@ const watch = process.env.ROLLUP_WATCH === 'true';
|
|
|
5
8
|
|
|
6
9
|
export default createRollupConfig({
|
|
7
10
|
cwd: new URL('.', import.meta.url).pathname,
|
|
8
|
-
|
|
11
|
+
outDirectory: 'build',
|
|
12
|
+
plugins: [
|
|
13
|
+
<% if (config) { -%>
|
|
14
|
+
config({
|
|
15
|
+
targets: [{ src: 'src/config/**/*.yml' }],
|
|
16
|
+
}),
|
|
17
|
+
<% } -%>
|
|
18
|
+
watch && run({ execArgv: ['--enable-source-maps'] })],
|
|
9
19
|
});
|
|
@@ -78,6 +78,12 @@ export default class CommonLintGenerator extends Generator {
|
|
|
78
78
|
defaults: 'node-modules',
|
|
79
79
|
desc: 'Defines what linker should be used for installing Node packages (useful to enable the node-modules plugin), one of: pnp, node-modules.',
|
|
80
80
|
});
|
|
81
|
+
|
|
82
|
+
this.option('buildDirectory', {
|
|
83
|
+
type: String,
|
|
84
|
+
required: false,
|
|
85
|
+
defaults: 'dist',
|
|
86
|
+
});
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
writing() {
|
|
@@ -396,7 +402,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
396
402
|
}
|
|
397
403
|
|
|
398
404
|
if ((!inLerna || !inLerna.root) && useBabel) {
|
|
399
|
-
ignorePatterns.add(
|
|
405
|
+
ignorePatterns.add(`/${this.options.buildDirectory}`, '/test');
|
|
400
406
|
}
|
|
401
407
|
if (inLerna && inLerna.root && this.options.typescript) {
|
|
402
408
|
ignorePatterns.add('/rollup.config.mjs');
|
|
@@ -405,7 +411,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
405
411
|
if (this.options.ignorePaths) {
|
|
406
412
|
this.options.ignorePaths
|
|
407
413
|
.split('\n')
|
|
408
|
-
.filter((path) => path !==
|
|
414
|
+
.filter((path) => path !== `/${this.options.buildDirectory}` && path)
|
|
409
415
|
.forEach((ignorePath) => {
|
|
410
416
|
if (ignorePath.startsWith('#')) return;
|
|
411
417
|
ignorePatterns.add(ignorePath);
|
|
@@ -471,7 +477,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
471
477
|
'import/resolver': this.options.enableSrcResolver
|
|
472
478
|
? {
|
|
473
479
|
node: {
|
|
474
|
-
|
|
480
|
+
moduleDirectory: ['node_modules', 'src'],
|
|
475
481
|
},
|
|
476
482
|
}
|
|
477
483
|
: false,
|
|
@@ -38,12 +38,12 @@ function updateParserAndPlugins(
|
|
|
38
38
|
|
|
39
39
|
if (!globalEslint) {
|
|
40
40
|
config.parserOptions = {
|
|
41
|
-
project: './tsconfig.json',
|
|
41
|
+
project: './tsconfig.eslint.json',
|
|
42
42
|
createDefaultProgram: true, // fix for lint-staged
|
|
43
43
|
};
|
|
44
44
|
} else {
|
|
45
45
|
config.parserOptions = {
|
|
46
|
-
project: `${relativePath}/tsconfig.json`,
|
|
46
|
+
project: `${relativePath}/tsconfig.eslint.json`,
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
} else {
|
|
@@ -112,7 +112,15 @@ export default function updateEslintConfig(
|
|
|
112
112
|
},
|
|
113
113
|
) {
|
|
114
114
|
config.root = true;
|
|
115
|
-
config.extends =
|
|
115
|
+
config.extends = [
|
|
116
|
+
...extendsConfig,
|
|
117
|
+
...(config?.extends
|
|
118
|
+
? config.extends.filter(
|
|
119
|
+
(extendsValue) =>
|
|
120
|
+
extendsValue === '@pob/eslint-config-typescript/allow-unsafe',
|
|
121
|
+
)
|
|
122
|
+
: []),
|
|
123
|
+
];
|
|
116
124
|
|
|
117
125
|
config = updateParserAndPlugins(
|
|
118
126
|
config,
|
|
@@ -73,10 +73,12 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
73
73
|
);
|
|
74
74
|
|
|
75
75
|
const tsconfigPath = this.destinationPath('tsconfig.json');
|
|
76
|
+
const tsconfigEslintPath = this.destinationPath('tsconfig.eslint.json');
|
|
76
77
|
const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
|
|
77
78
|
if (this.options.enable) {
|
|
78
79
|
const { jsx, dom } = this.options;
|
|
79
80
|
let composite;
|
|
81
|
+
let monorepoPackageReferences;
|
|
80
82
|
let monorepoPackageBuildReferences;
|
|
81
83
|
let monorepoPackageSrcPaths;
|
|
82
84
|
|
|
@@ -121,6 +123,11 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
121
123
|
}`,
|
|
122
124
|
],
|
|
123
125
|
);
|
|
126
|
+
monorepoPackageReferences = yoConfig.pob.monorepo.packageNames
|
|
127
|
+
.filter((packageName) =>
|
|
128
|
+
existsSync(`${packageLocations.get(packageName)}/tsconfig.json`),
|
|
129
|
+
)
|
|
130
|
+
.map((packageName) => packageLocations.get(packageName));
|
|
124
131
|
monorepoPackageBuildReferences = yoConfig.pob.monorepo.packageNames
|
|
125
132
|
.filter((packageName) =>
|
|
126
133
|
existsSync(
|
|
@@ -137,7 +144,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
137
144
|
tsconfigPath,
|
|
138
145
|
{
|
|
139
146
|
monorepoPackageSrcPaths,
|
|
140
|
-
|
|
147
|
+
monorepoPackageReferences,
|
|
141
148
|
rootDir: this.options.rootDir,
|
|
142
149
|
jsx,
|
|
143
150
|
composite,
|
|
@@ -146,6 +153,12 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
146
153
|
resolveJsonModule: this.options.resolveJsonModule,
|
|
147
154
|
},
|
|
148
155
|
);
|
|
156
|
+
copyAndFormatTpl(
|
|
157
|
+
this.fs,
|
|
158
|
+
this.templatePath('tsconfig.eslint.json.ejs'),
|
|
159
|
+
tsconfigEslintPath,
|
|
160
|
+
{},
|
|
161
|
+
);
|
|
149
162
|
if (
|
|
150
163
|
this.options.builddefs // &&
|
|
151
164
|
// (!composite || monorepoPackageNames.length !== 0)
|
|
@@ -168,6 +181,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
168
181
|
} else {
|
|
169
182
|
if (pkg.scripts) delete pkg.scripts.tsc;
|
|
170
183
|
this.fs.delete(tsconfigPath);
|
|
184
|
+
this.fs.delete(tsconfigEslintPath);
|
|
171
185
|
this.fs.delete(tsconfigBuildPath);
|
|
172
186
|
}
|
|
173
187
|
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
<% } -%>
|
|
11
11
|
"compilerOptions": {
|
|
12
12
|
"rootDir": "<%= rootDir %>",
|
|
13
|
-
"incremental": true,
|
|
14
13
|
<% if(!composite) { -%>
|
|
15
14
|
/* No emit in default config file. See build config file for config to build declaration files */
|
|
16
15
|
"noEmit": true,
|
|
17
16
|
<% } else { -%>
|
|
17
|
+
"incremental": true,
|
|
18
18
|
"composite": true,
|
|
19
19
|
"noEmit": false,
|
|
20
20
|
"noEmitOnError": true,
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
"<%= packageName %>/*": ["../<%= packageLocation %>/*"]<%= index === monorepoPackageSrcPaths.length -1 ? '' : ',' -%>
|
|
60
60
|
<% }) %>
|
|
61
61
|
}<% } %>
|
|
62
|
-
}<% if (
|
|
62
|
+
}<% if (monorepoPackageReferences && monorepoPackageReferences.length) { -%>,
|
|
63
63
|
"references": [
|
|
64
|
-
<%
|
|
65
|
-
{ "path": "<%= monorepoPackageSrcPath %>/tsconfig.json" }<%= index ===
|
|
64
|
+
<% monorepoPackageReferences.forEach((monorepoPackageSrcPath, index) => { -%>
|
|
65
|
+
{ "path": "<%= monorepoPackageSrcPath %>/tsconfig.json" }<%= index === monorepoPackageReferences.length -1 ? '' : ',' %>
|
|
66
66
|
<% }) -%>
|
|
67
67
|
],
|
|
68
68
|
<% } -%>
|
|
@@ -93,13 +93,15 @@ export default class CoreVSCodeGenerator extends Generator {
|
|
|
93
93
|
this.destinationPath('.vscode/tasks.json'),
|
|
94
94
|
{},
|
|
95
95
|
);
|
|
96
|
+
const tasks = tasksConfig.tasks || [];
|
|
97
|
+
|
|
96
98
|
copyAndFormatTpl(
|
|
97
99
|
this.fs,
|
|
98
100
|
this.templatePath('tasks.json.ejs'),
|
|
99
101
|
this.destinationPath('.vscode/tasks.json'),
|
|
100
102
|
{
|
|
101
103
|
typescript: this.options.typescript,
|
|
102
|
-
tasks: JSON.stringify(
|
|
104
|
+
tasks: JSON.stringify(tasks, null, 2),
|
|
103
105
|
},
|
|
104
106
|
);
|
|
105
107
|
|
|
@@ -21,6 +21,11 @@
|
|
|
21
21
|
"typescript.enablePromptUseWorkspaceTsdk": true,
|
|
22
22
|
<% } -%>
|
|
23
23
|
|
|
24
|
+
<% if (yarn) { -%>
|
|
25
|
+
// set yarn as package manager to run scripts and tasks
|
|
26
|
+
"npm.packageManager": "yarn",
|
|
27
|
+
<% } -%>
|
|
28
|
+
|
|
24
29
|
// save config
|
|
25
30
|
"editor.formatOnSave": true,
|
|
26
31
|
"eslint.codeActionsOnSave.mode": "all",
|
|
@@ -31,6 +31,17 @@ const hasDist = (packages, configs) =>
|
|
|
31
31
|
),
|
|
32
32
|
);
|
|
33
33
|
|
|
34
|
+
const hasBuild = (packages, configs) =>
|
|
35
|
+
configs.some(
|
|
36
|
+
(config, index) =>
|
|
37
|
+
!!(
|
|
38
|
+
config &&
|
|
39
|
+
config.project &&
|
|
40
|
+
config.project.type === 'app' &&
|
|
41
|
+
config.app.type === 'alp-node'
|
|
42
|
+
),
|
|
43
|
+
);
|
|
44
|
+
|
|
34
45
|
export default class PobMonorepoGenerator extends Generator {
|
|
35
46
|
constructor(args, opts) {
|
|
36
47
|
super(args, opts);
|
|
@@ -206,7 +217,12 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
206
217
|
packageManager: this.options.packageManager,
|
|
207
218
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
208
219
|
appTypes: JSON.stringify(getAppTypes(this.packageConfigs)),
|
|
209
|
-
ignorePaths:
|
|
220
|
+
ignorePaths: [
|
|
221
|
+
hasDist(this.packages, this.packageConfigs) && '/dist',
|
|
222
|
+
hasBuild(this.packages, this.packageConfigs) && '/build',
|
|
223
|
+
]
|
|
224
|
+
.filter(Boolean)
|
|
225
|
+
.join('\n'),
|
|
210
226
|
});
|
|
211
227
|
|
|
212
228
|
this.composeWith('pob:lib:doc', {
|
|
@@ -281,7 +297,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
281
297
|
}
|
|
282
298
|
packageUtils.addOrRemoveScripts(pkg, rollupConfigs.length > 0, {
|
|
283
299
|
'clean:build': `(${pkg.workspaces
|
|
284
|
-
.map((workspaces) => `rm -Rf ${workspaces}/dist`)
|
|
300
|
+
.map((workspaces) => `rm -Rf ${workspaces}/dist ${workspaces}/build`)
|
|
285
301
|
.join(' && ')}) || true`,
|
|
286
302
|
build: 'yarn clean:build && rollup --config rollup.config.mjs',
|
|
287
303
|
watch: 'yarn clean:build && rollup --config rollup.config.mjs --watch',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "10.1
|
|
3
|
+
"version": "10.3.1",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@lerna/project": "^4.0.0",
|
|
44
44
|
"@pob/eslint-config": "49.0.0",
|
|
45
45
|
"@pob/eslint-config-typescript": "49.0.0",
|
|
46
|
-
"@pob/eslint-config-typescript-react": "49.0.
|
|
46
|
+
"@pob/eslint-config-typescript-react": "49.0.1",
|
|
47
47
|
"@pob/sort-eslint-config": "^3.0.1",
|
|
48
48
|
"@pob/sort-object": "^4.0.1",
|
|
49
49
|
"@pob/sort-pkg": "^4.0.1",
|
|
50
|
-
"@yarnpkg/parsers": "2.5.0-rc.
|
|
50
|
+
"@yarnpkg/parsers": "2.5.0-rc.14",
|
|
51
51
|
"eslint": "8.9.0",
|
|
52
52
|
"findup-sync": "^5.0.0",
|
|
53
53
|
"git-remote-url": "^1.0.1",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"mem-fs-editor": "9.4.0",
|
|
62
62
|
"minimist-argv": "^1.1.0",
|
|
63
63
|
"parse-author": "^2.0.0",
|
|
64
|
-
"pob-dependencies": "6.
|
|
64
|
+
"pob-dependencies": "6.17.0",
|
|
65
65
|
"prettier": "2.5.1",
|
|
66
66
|
"semver": "^7.3.4",
|
|
67
67
|
"yeoman-environment": "^3.5.1",
|
|
68
68
|
"yeoman-generator": "^5.4.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "653a6285b86a5d132da7b351abdad31eb5f44e1d"
|
|
71
71
|
}
|