pob 9.16.2 → 10.2.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 CHANGED
@@ -3,6 +3,73 @@
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.2.1](https://github.com/christophehurpeau/pob/compare/pob@10.2.0...pob@10.2.1) (2022-02-19)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **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))
12
+ * only enable incremental for composite tsconfigs ([b73a16a](https://github.com/christophehurpeau/pob/commit/b73a16a15a09f68cde3ad22d01331418c3a5d92c))
13
+ * **pob:** clean script ([6f2646e](https://github.com/christophehurpeau/pob/commit/6f2646e150e5ca4c889f5657811273a44eb68549))
14
+
15
+
16
+
17
+
18
+
19
+ # [10.2.0](https://github.com/christophehurpeau/pob/compare/pob@10.1.0...pob@10.2.0) (2022-02-13)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * **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))
25
+ * **pob:** create eslint specific tsconfig ([fb80eac](https://github.com/christophehurpeau/pob/commit/fb80eaccce5c48dfe4af98c411ef3839c11f3be8))
26
+
27
+
28
+ ### Features
29
+
30
+ * build directory for apps and alp-rollup-plugin-config ([0d57816](https://github.com/christophehurpeau/pob/commit/0d57816fbe0ac0a86d0bf7204aed42c3313366df))
31
+
32
+
33
+
34
+
35
+
36
+ # [10.1.0](https://github.com/christophehurpeau/pob/compare/pob@10.0.0...pob@10.1.0) (2022-02-12)
37
+
38
+
39
+ ### Features
40
+
41
+ * **deps:** update @pob/eslint-config to v49 (major) ([#1203](https://github.com/christophehurpeau/pob/issues/1203)) ([c063b55](https://github.com/christophehurpeau/pob/commit/c063b553eb15e3d3422f149b89ac1f9f12958e43))
42
+
43
+
44
+
45
+
46
+
47
+ # [10.0.0](https://github.com/christophehurpeau/pob/compare/pob@9.16.2...pob@10.0.0) (2022-02-12)
48
+
49
+
50
+ ### Bug Fixes
51
+
52
+ * **deps:** update dependency @yarnpkg/parsers to v2.5.0-rc.12 ([#1195](https://github.com/christophehurpeau/pob/issues/1195)) ([90c432e](https://github.com/christophehurpeau/pob/commit/90c432e9c714db95901bec29f3899d4ac8f24bd8))
53
+ * **deps:** update dependency @yarnpkg/parsers to v2.5.0-rc.13 ([#1200](https://github.com/christophehurpeau/pob/issues/1200)) ([8351d60](https://github.com/christophehurpeau/pob/commit/8351d60fee9b6629fbba5876eaf142af3a3bc544))
54
+ * **pob:** nextjs generator ([5f814dd](https://github.com/christophehurpeau/pob/commit/5f814dd9243c46d5b96fdc8b01adadaa044f2734))
55
+
56
+
57
+ ### Features
58
+
59
+ * **deps:** update dependency eslint to v8.9.0 ([#1202](https://github.com/christophehurpeau/pob/issues/1202)) ([0c59870](https://github.com/christophehurpeau/pob/commit/0c59870f0cb4e9c7bf5a478446164de297c44ea8))
60
+ * **pob:** add watch in monorepo with rollup ([eba1e69](https://github.com/christophehurpeau/pob/commit/eba1e693149807b5a139eda1036b8d131e7a7228))
61
+ * **pob:** improve nextjs config ([17c4daf](https://github.com/christophehurpeau/pob/commit/17c4dafd3af2f982e0e0b260b7d5352f1e9f8c36))
62
+ * use react jsx-runtime ([5c8bd2b](https://github.com/christophehurpeau/pob/commit/5c8bd2ba8fc1153537a26e3439852fab4c7878de))
63
+
64
+
65
+ ### BREAKING CHANGES
66
+
67
+ * requires react with jsx-supported runtime
68
+
69
+
70
+
71
+
72
+
6
73
  ## [9.16.2](https://github.com/christophehurpeau/pob/compare/pob@9.16.1...pob@9.16.2) (2022-02-06)
7
74
 
8
75
 
@@ -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 appsWithNode = ['alp', 'next.js'];
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 = appsWithNode.includes(this.appConfig.type);
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
@@ -135,6 +138,7 @@ export default class PobAppGenerator extends Generator {
135
138
 
136
139
  this.composeWith('pob:common:typescript', {
137
140
  enable: babel,
141
+ // nextjs now supports src rootDir: this.appConfig.type === 'next.js' ? '.' : 'src',
138
142
  builddefs: false,
139
143
  dom: browser,
140
144
  jsx,
@@ -144,11 +148,13 @@ export default class PobAppGenerator extends Generator {
144
148
  if (
145
149
  this.appConfig.type === 'alp' ||
146
150
  this.appConfig.type === 'pobpack' ||
147
- this.appConfig.type === 'node'
151
+ this.appConfig.type === 'node' ||
152
+ this.appConfig.type === 'alp-node' ||
153
+ this.appConfig.type === 'next.js'
148
154
  ) {
149
155
  return './src';
150
156
  }
151
- if (this.appConfig.type === 'next.js') return '.';
157
+ // if (this.appConfig.type === 'next.js') return '.';
152
158
  return '';
153
159
  })(),
154
160
  });
@@ -172,10 +178,12 @@ export default class PobAppGenerator extends Generator {
172
178
  babel,
173
179
  node,
174
180
  browser,
181
+ // nextjs now supports src rootAsSrc: this.appConfig.type === 'next.js',
175
182
  enableSrcResolver: true,
176
183
  packageManager: this.options.packageManager,
177
184
  yarnNodeLinker: this.options.yarnNodeLinker,
178
185
  ignorePaths: ignorePaths.join('\n'),
186
+ buildDirectory: 'build',
179
187
  });
180
188
 
181
189
  this.composeWith('pob:common:release', {
@@ -217,6 +225,12 @@ export default class PobAppGenerator extends Generator {
217
225
  });
218
226
  break;
219
227
  }
228
+
229
+ execSync(
230
+ `rm -Rf ${['lib-*', 'coverage', 'docs', 'dist']
231
+ .filter(Boolean)
232
+ .join(' ')}`,
233
+ );
220
234
  }
221
235
 
222
236
  writing() {
@@ -1,7 +1,8 @@
1
1
  export const appIgnorePaths = {
2
2
  alp: (config) => ['# alp paths', '/build', '/public', '/data'],
3
- 'next.js': (config) => ['# next.js paths', '/.next', '/out'],
3
+ 'next.js': (config) => ['# next.js paths', '/.next', '/out', '/build'],
4
4
  pobpack: (config) => ['/build', '/public'],
5
- node: (config) => ['/dist'],
5
+ node: (config) => ['/build'],
6
+ 'alp-node': (config) => ['/build'],
6
7
  other: (config) => [],
7
8
  };
@@ -17,8 +17,9 @@ export default class AppNextjsGenerator extends Generator {
17
17
  const pkg = this.fs.readJSON(this.destinationPath('package.json'));
18
18
 
19
19
  packageUtils.addScripts(pkg, {
20
+ start: 'next dev',
21
+ 'start:prod': 'next start',
20
22
  build: 'next build',
21
- start: 'next',
22
23
  });
23
24
 
24
25
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
@@ -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': 'rm -Rf dist',
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': 'rm -Rf dist',
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',
@@ -712,13 +725,22 @@ export default class CommonBabelGenerator extends Generator {
712
725
  /* pob-babel config */
713
726
 
714
727
  packageUtils.removeDevDependencies(pkg, ['@rollup/plugin-run']);
728
+ packageUtils.addOrRemoveDependencies(
729
+ pkg,
730
+ useBabel && this.options.isApp && this.options.useAppConfig,
731
+ ['alp-rollup-plugin-config'],
732
+ );
715
733
 
716
734
  this.fs.delete('rollup.config.js');
717
735
  if (useBabel) {
718
736
  if (this.options.isApp) {
719
- this.fs.copy(
737
+ copyAndFormatTpl(
738
+ this.fs,
720
739
  this.templatePath('app.rollup.config.mjs.ejs'),
721
740
  this.destinationPath('rollup.config.mjs'),
741
+ {
742
+ config: this.options.useAppConfig,
743
+ },
722
744
  );
723
745
  } else {
724
746
  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
- plugins: [watch && run({ execArgv: ['--enable-source-maps'] })],
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
  });
@@ -47,6 +47,13 @@ export default class CommonLintGenerator extends Generator {
47
47
  desc: 'Enable resolving from src directory',
48
48
  });
49
49
 
50
+ this.option('rootAsSrc', {
51
+ type: Boolean,
52
+ required: false,
53
+ defaults: false,
54
+ desc: 'src directory is root',
55
+ });
56
+
50
57
  this.option('appTypes', {
51
58
  type: String,
52
59
  required: false,
@@ -71,6 +78,12 @@ export default class CommonLintGenerator extends Generator {
71
78
  defaults: 'node-modules',
72
79
  desc: 'Defines what linker should be used for installing Node packages (useful to enable the node-modules plugin), one of: pnp, node-modules.',
73
80
  });
81
+
82
+ this.option('buildDirectory', {
83
+ type: String,
84
+ required: false,
85
+ defaults: 'dist',
86
+ });
74
87
  }
75
88
 
76
89
  writing() {
@@ -368,19 +381,16 @@ export default class CommonLintGenerator extends Generator {
368
381
  this.fs.delete(`${eslintrcBadPath}.yml`);
369
382
  this.fs.delete(`${eslintrcBadPath}.js`);
370
383
 
371
- const rootEslintrcPath = this.destinationPath('.eslintrc.json');
384
+ const rootEslintrcPath = this.options.rootAsSrc
385
+ ? false
386
+ : this.destinationPath('.eslintrc.json');
372
387
 
373
- const srcEslintrcPath = this.destinationPath(
374
- `${useBabel ? 'src/' : 'lib/'}.eslintrc.json`,
375
- );
388
+ const srcEslintrcPath = this.options.rootAsSrc
389
+ ? this.destinationPath('.eslintrc.json')
390
+ : this.destinationPath(`${useBabel ? 'src/' : 'lib/'}.eslintrc.json`);
376
391
 
377
392
  const useTypescript = useBabel;
378
-
379
- try {
380
- if (this.fs.exists(rootEslintrcPath)) {
381
- ensureJsonFileFormatted(rootEslintrcPath);
382
- }
383
-
393
+ const getRootIgnorePatterns = () => {
384
394
  const ignorePatterns = new Set();
385
395
 
386
396
  if (inLerna && !inLerna.root && (this.options.typescript || pkg.types)) {
@@ -392,7 +402,7 @@ export default class CommonLintGenerator extends Generator {
392
402
  }
393
403
 
394
404
  if ((!inLerna || !inLerna.root) && useBabel) {
395
- ignorePatterns.add('/dist', '/test');
405
+ ignorePatterns.add(`/${this.options.buildDirectory}`, '/test');
396
406
  }
397
407
  if (inLerna && inLerna.root && this.options.typescript) {
398
408
  ignorePatterns.add('/rollup.config.mjs');
@@ -401,26 +411,41 @@ export default class CommonLintGenerator extends Generator {
401
411
  if (this.options.ignorePaths) {
402
412
  this.options.ignorePaths
403
413
  .split('\n')
404
- .filter((path) => path !== '/dist' && path)
414
+ .filter((path) => path !== `/${this.options.buildDirectory}` && path)
405
415
  .forEach((ignorePath) => {
406
416
  if (ignorePath.startsWith('#')) return;
407
417
  ignorePatterns.add(ignorePath);
408
418
  });
409
419
  }
410
420
 
411
- const rootEslintrcConfig = updateEslintConfig(
412
- this.fs.readJSON(rootEslintrcPath, {}),
413
- {
414
- extendsConfig: extendsConfigRoot,
415
- ignorePatterns:
416
- ignorePatterns.size === 0 ? undefined : [...ignorePatterns],
417
- },
418
- );
421
+ return ignorePatterns;
422
+ };
423
+
424
+ if (rootEslintrcPath) {
425
+ try {
426
+ if (this.fs.exists(rootEslintrcPath)) {
427
+ ensureJsonFileFormatted(rootEslintrcPath);
428
+ }
429
+
430
+ const rootIgnorePatterns = getRootIgnorePatterns();
431
+
432
+ const rootEslintrcConfig = updateEslintConfig(
433
+ this.fs.readJSON(rootEslintrcPath, {}),
434
+ {
435
+ extendsConfig: extendsConfigRoot,
436
+ ignorePatterns:
437
+ rootIgnorePatterns.size === 0
438
+ ? undefined
439
+ : [...rootIgnorePatterns],
440
+ },
441
+ );
419
442
 
420
- writeAndFormatJson(this.fs, rootEslintrcPath, rootEslintrcConfig);
421
- } catch (err) {
422
- console.warn(`Could not parse/edit ${rootEslintrcPath}: `, err);
443
+ writeAndFormatJson(this.fs, rootEslintrcPath, rootEslintrcConfig);
444
+ } catch (err) {
445
+ console.warn(`Could not parse/edit ${rootEslintrcPath}: `, err);
446
+ }
423
447
  }
448
+ // no else: dont delete root eslintrc, src is root
424
449
 
425
450
  if ((inLerna && inLerna.root) || this.options.monorepo) {
426
451
  if (this.fs.exists(srcEslintrcPath)) {
@@ -432,6 +457,13 @@ export default class CommonLintGenerator extends Generator {
432
457
  ensureJsonFileFormatted(srcEslintrcPath);
433
458
  }
434
459
 
460
+ const ignorePatterns = this.options.rootAsSrc
461
+ ? getRootIgnorePatterns()
462
+ : new Set();
463
+ if (useTypescript || pkg.types) {
464
+ ignorePatterns.add('*.d.ts');
465
+ }
466
+
435
467
  const srcEslintrcConfig = updateEslintConfig(
436
468
  this.fs.readJSON(srcEslintrcPath, {}),
437
469
  {
@@ -439,7 +471,8 @@ export default class CommonLintGenerator extends Generator {
439
471
  jestOverride,
440
472
  useTypescript: useBabel,
441
473
  globalEslint,
442
- ignorePatterns: useTypescript || pkg.types ? ['*.d.ts'] : undefined,
474
+ ignorePatterns:
475
+ ignorePatterns.size === 0 ? undefined : [...ignorePatterns],
443
476
  settings: {
444
477
  'import/resolver': this.options.enableSrcResolver
445
478
  ? {
@@ -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 {
@@ -12,8 +12,10 @@ module.exports = function babelConfig(api) {
12
12
  <% if (hasReact) { %>, [
13
13
  '@babel/preset-react',
14
14
  {
15
+ runtime: 'automatic',
15
16
  development: false,
16
17
  useBuiltIns: true,
18
+ useSpread: true,
17
19
  },
18
20
  ]<% } %>
19
21
  <% if (hasLinaria) { %>, [
@@ -14,6 +14,12 @@ export default class CommonTypescriptGenerator extends Generator {
14
14
  desc: 'enable typescript',
15
15
  });
16
16
 
17
+ this.option('rootDir', {
18
+ type: String,
19
+ defaults: 'src',
20
+ desc: 'customize rootDir',
21
+ });
22
+
17
23
  this.option('jsx', {
18
24
  type: Boolean,
19
25
  defaults: true,
@@ -67,11 +73,12 @@ export default class CommonTypescriptGenerator extends Generator {
67
73
  );
68
74
 
69
75
  const tsconfigPath = this.destinationPath('tsconfig.json');
76
+ const tsconfigEslintPath = this.destinationPath('tsconfig.eslint.json');
70
77
  const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
71
78
  if (this.options.enable) {
72
79
  const { jsx, dom } = this.options;
73
80
  let composite;
74
- let monorepoPackageNames;
81
+ let monorepoPackageBuildReferences;
75
82
  let monorepoPackageSrcPaths;
76
83
 
77
84
  if (inLerna && !inLerna.root) {
@@ -89,26 +96,39 @@ export default class CommonTypescriptGenerator extends Generator {
89
96
  ['typescript'],
90
97
  );
91
98
 
92
- monorepoPackageNames = yoConfig.pob.monorepo.packageNames.filter(
93
- (packageName) =>
94
- ((pkg.dependencies && pkg.dependencies[packageName]) ||
95
- (pkg.devDependencies && pkg.devDependencies[packageName]) ||
96
- (pkg.peerDependencies && pkg.peerDependencies[packageName])) &&
97
- existsSync(
99
+ const packageLocations = new Map(
100
+ yoConfig.pob.monorepo.packageNames
101
+ .filter(
102
+ (packageName) =>
103
+ (pkg.dependencies && pkg.dependencies[packageName]) ||
104
+ (pkg.devDependencies && pkg.devDependencies[packageName]) ||
105
+ (pkg.peerDependencies && pkg.peerDependencies[packageName]),
106
+ )
107
+ .map((packageName) => [
108
+ packageName,
98
109
  `../../${
99
110
  packageName[0] === '@'
100
111
  ? packageName
101
112
  : `packages/${packageName}`
102
- }/tsconfig.build.json`,
103
- ),
113
+ }`,
114
+ ]),
104
115
  );
105
116
 
106
- monorepoPackageSrcPaths = monorepoPackageNames.map(
107
- (packageName) =>
108
- `${
109
- packageName[0] === '@' ? packageName : `packages/${packageName}`
110
- }/${existsSync(`../${packageName}/src`) ? 'src' : 'lib'}`,
117
+ monorepoPackageSrcPaths = [...packageLocations.entries()].map(
118
+ ([packageName, packageLocation]) => [
119
+ packageName,
120
+ `${packageLocation}/${
121
+ existsSync(`${packageLocation}/src`) ? 'src' : 'lib'
122
+ }`,
123
+ ],
111
124
  );
125
+ monorepoPackageBuildReferences = yoConfig.pob.monorepo.packageNames
126
+ .filter((packageName) =>
127
+ existsSync(
128
+ `${packageLocations.get(packageName)}/tsconfig.build.json`,
129
+ ),
130
+ )
131
+ .map((packageName) => packageLocations.get(packageName));
112
132
  }
113
133
  }
114
134
 
@@ -117,8 +137,9 @@ export default class CommonTypescriptGenerator extends Generator {
117
137
  this.templatePath('tsconfig.json.ejs'),
118
138
  tsconfigPath,
119
139
  {
120
- monorepoPackageNames,
121
140
  monorepoPackageSrcPaths,
141
+ monorepoPackageBuildReferences,
142
+ rootDir: this.options.rootDir,
122
143
  jsx,
123
144
  composite,
124
145
  dom,
@@ -126,6 +147,12 @@ export default class CommonTypescriptGenerator extends Generator {
126
147
  resolveJsonModule: this.options.resolveJsonModule,
127
148
  },
128
149
  );
150
+ copyAndFormatTpl(
151
+ this.fs,
152
+ this.templatePath('tsconfig.eslint.json.ejs'),
153
+ tsconfigEslintPath,
154
+ {},
155
+ );
129
156
  if (
130
157
  this.options.builddefs // &&
131
158
  // (!composite || monorepoPackageNames.length !== 0)
@@ -138,8 +165,8 @@ export default class CommonTypescriptGenerator extends Generator {
138
165
  inMonorepo: inLerna && !inLerna.root,
139
166
  jsx,
140
167
  composite,
141
- monorepoPackageNames,
142
168
  monorepoPackageSrcPaths,
169
+ monorepoPackageBuildReferences,
143
170
  },
144
171
  );
145
172
  } else {
@@ -148,6 +175,7 @@ export default class CommonTypescriptGenerator extends Generator {
148
175
  } else {
149
176
  if (pkg.scripts) delete pkg.scripts.tsc;
150
177
  this.fs.delete(tsconfigPath);
178
+ this.fs.delete(tsconfigEslintPath);
151
179
  this.fs.delete(tsconfigBuildPath);
152
180
  }
153
181
 
@@ -2,7 +2,6 @@
2
2
  "extends": "./tsconfig.json",
3
3
 
4
4
  "compilerOptions": {
5
- "rootDir": "src",
6
5
  "noEmit": false,
7
6
  "declaration": true,
8
7
  "declarationMap": true,
@@ -23,11 +22,11 @@
23
22
  "src/**/*.test.tsx",
24
23
  <% } -%>
25
24
  "src/**/__tests__/**"
26
- ]<% if (monorepoPackageNames && monorepoPackageNames.length) { %>,<% } -%>
27
- <% if (monorepoPackageNames && monorepoPackageNames.length) { %>
25
+ ]<% if (monorepoPackageBuildReferences && monorepoPackageBuildReferences.length) { %>,<% } -%>
26
+ <% if (monorepoPackageBuildReferences && monorepoPackageBuildReferences.length) { %>
28
27
  "references": [
29
- <% monorepoPackageNames.forEach((packageName, index) => { -%>
30
- { "path": "../<%= packageName %>/tsconfig.build.json" }<%= index === monorepoPackageNames.length -1 ? '' : ',' %>
28
+ <% monorepoPackageBuildReferences.forEach((monorepoPackageSrcPath, index) => { -%>
29
+ { "path": "<%= monorepoPackageSrcPath %>/tsconfig.json" }<%= index === monorepoPackageBuildReferences.length -1 ? '' : ',' %>
31
30
  <% }) -%>
32
31
  ]<% } -%>
33
32
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+
4
+ "compilerOptions": {
5
+ "noEmit": true,
6
+ }
7
+ }
@@ -1,16 +1,21 @@
1
1
  {
2
2
  "include": [
3
- "src/**/*.ts"<% if (jsx) { -%>,
4
- "src/**/*.tsx"<% } %>
3
+ "<%= rootDir %>/**/*.ts"<% if (jsx) { -%>,
4
+ "<%= rootDir %>/**/*.tsx"<% } %>
5
5
  ],
6
+ <% if(rootDir === '.') { -%>
7
+ "exclude": [
8
+ "node_modules"
9
+ ],
10
+ <% } -%>
6
11
  "compilerOptions": {
7
- "rootDir": "src",
12
+ "rootDir": "<%= rootDir %>",
8
13
  <% if(!composite) { -%>
9
14
  /* No emit in default config file. See build config file for config to build declaration files */
10
15
  "noEmit": true,
11
16
  <% } else { -%>
12
- "composite": true,
13
17
  "incremental": true,
18
+ "composite": true,
14
19
  "noEmit": false,
15
20
  "noEmitOnError": true,
16
21
  "declaration": true,
@@ -26,7 +31,7 @@
26
31
  "target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
27
32
  "module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
28
33
  "lib": [<%- dom ? '"dom", ' : '' %>"esnext"], /* Polyfills are imported either by babel or with polyfill.io */
29
- <%= jsx ? '' : '// ' %>"jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
34
+ <%= jsx ? '' : '// ' %>"jsx": "react-jsx", /* 'react-jsx' is used with react/jsx-runtime (react >=17 || >= 16.14.0 | >= 15.7.0) */
30
35
  "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
31
36
 
32
37
  /* Enable all strict type-checking options. */
@@ -46,18 +51,18 @@
46
51
  <% if (resolveJsonModule) { -%>
47
52
  "resolveJsonModule": <%= resolveJsonModule %>,
48
53
  <% } -%>
49
- "baseUrl": "<%= baseUrl %>"<% if (monorepoPackageNames) { %>,<% } %> /* Base directory to resolve non-absolute module names. */
50
- <% if (monorepoPackageNames && monorepoPackageNames.length !== 0) { -%>
54
+ "baseUrl": "<%= baseUrl %>"<% if (monorepoPackageSrcPaths) { %>,<% } %> /* Base directory to resolve non-absolute module names. */
55
+ <% if (monorepoPackageSrcPaths && monorepoPackageSrcPaths.length !== 0) { -%>
51
56
  "paths": {
52
- <% monorepoPackageNames.forEach((packageName, index) => { %>
53
- "<%= packageName %>": ["../../../<%= monorepoPackageSrcPaths[index] %>"],
54
- "<%= packageName %>/*": ["../../../<%= monorepoPackageSrcPaths[index] %>/*"]<%= index === monorepoPackageNames.length -1 ? '' : ',' -%>
57
+ <% monorepoPackageSrcPaths.forEach(([packageName, packageLocation], index) => { %>
58
+ "<%= packageName %>": ["../<%= packageLocation %>"],
59
+ "<%= packageName %>/*": ["../<%= packageLocation %>/*"]<%= index === monorepoPackageSrcPaths.length -1 ? '' : ',' -%>
55
60
  <% }) %>
56
61
  }<% } %>
57
- }<% if (monorepoPackageNames && monorepoPackageNames.length) { -%>,
62
+ }<% if (monorepoPackageBuildReferences && monorepoPackageBuildReferences.length) { -%>,
58
63
  "references": [
59
- <% monorepoPackageNames.forEach((packageName, index) => { -%>
60
- { "path": "../<%= packageName %>/tsconfig.json" }<%= index === monorepoPackageNames.length -1 ? '' : ',' %>
64
+ <% monorepoPackageBuildReferences.forEach((monorepoPackageSrcPath, index) => { -%>
65
+ { "path": "<%= monorepoPackageSrcPath %>/tsconfig.json" }<%= index === monorepoPackageBuildReferences.length -1 ? '' : ',' %>
61
66
  <% }) -%>
62
67
  ],
63
68
  <% } -%>
@@ -1,12 +1,6 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
3
 
4
-
5
- "compilerOptions": {
6
- "rootDirs": [],
7
- "rootDir": "src"
8
- },
9
-
10
4
  "typedocOptions": {
11
5
  "entryPoints": [
12
6
  <%- entryPoints.map(entryPoint => `"${entryPoint}"`).join(', ') %>
@@ -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: hasDist(this.packages, this.packageConfigs) ? '/dist' : '',
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,9 +297,10 @@ 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',
303
+ watch: 'yarn clean:build && rollup --config rollup.config.mjs --watch',
287
304
  });
288
305
  packageUtils.addOrRemoveDevDependencies(pkg, rollupConfigs.length, [
289
306
  '@babel/core',
package/lib/pob.js CHANGED
@@ -6,6 +6,7 @@ import path from 'path';
6
6
  import argv from 'minimist-argv';
7
7
  import yeoman from 'yeoman-environment';
8
8
  import PobAppGenerator from './generators/app/PobAppGenerator.js';
9
+ import AppNextjsGenerator from './generators/app/nextjs/AppNextjsGenerator.js';
9
10
  import CommonBabelGenerator from './generators/common/babel/CommonBabelGenerator.js';
10
11
  import CommonLintGenerator from './generators/common/format-lint/CommonLintGenerator.js';
11
12
  import CommonHuskyGenerator from './generators/common/husky/CommonHuskyGenerator.js';
@@ -78,6 +79,11 @@ env.registerStub(
78
79
  'pob:app',
79
80
  `${__dirname}/generators/app/PobAppGenerator.js`,
80
81
  );
82
+ env.registerStub(
83
+ AppNextjsGenerator,
84
+ 'pob:app:nextjs',
85
+ `${__dirname}/generators/app/nextjs/AppNextjsGenerator.js`,
86
+ );
81
87
  env.registerStub(
82
88
  CommonBabelGenerator,
83
89
  'pob:common:babel',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "9.16.2",
3
+ "version": "10.2.1",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -41,14 +41,14 @@
41
41
  "dependencies": {
42
42
  "@lerna/package-graph": "^4.0.0",
43
43
  "@lerna/project": "^4.0.0",
44
- "@pob/eslint-config": "48.1.1",
45
- "@pob/eslint-config-typescript": "48.1.1",
46
- "@pob/eslint-config-typescript-react": "48.1.1",
44
+ "@pob/eslint-config": "49.0.0",
45
+ "@pob/eslint-config-typescript": "49.0.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.11",
51
- "eslint": "8.8.0",
50
+ "@yarnpkg/parsers": "2.5.0-rc.14",
51
+ "eslint": "8.9.0",
52
52
  "findup-sync": "^5.0.0",
53
53
  "git-remote-url": "^1.0.1",
54
54
  "github-username": "^6.0.0",
@@ -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.12.1",
64
+ "pob-dependencies": "6.16.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": "97e55d45699b7fa32b72635f3f202e9d3cf326df"
70
+ "gitHead": "f23f89112a35d2df5b8e6da96dee061043b4c362"
71
71
  }