pob 11.8.1 → 12.0.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 CHANGED
@@ -3,6 +3,50 @@
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
+ ## [12.0.0](https://github.com/christophehurpeau/pob/compare/pob@11.9.0...pob@12.0.0) (2023-04-18)
7
+
8
+
9
+ ### ⚠ BREAKING CHANGES
10
+
11
+ * require node 18 for pob and monorepo
12
+
13
+ ### Features
14
+
15
+ * **deps:** update dependency eslint to v8.38.0 ([#1596](https://github.com/christophehurpeau/pob/issues/1596)) ([6e0c03b](https://github.com/christophehurpeau/pob/commit/6e0c03b39fe040e9af465fa1e29ec757af3a9311))
16
+ * **deps:** update dependency semver to v7.4.0 ([#1599](https://github.com/christophehurpeau/pob/issues/1599)) ([d71ada7](https://github.com/christophehurpeau/pob/commit/d71ada7ca259ccf83b3226221fb6288e5cf42fcc))
17
+ * **deps:** update dependency semver to v7.5.0 ([#1608](https://github.com/christophehurpeau/pob/issues/1608)) ([1dda98b](https://github.com/christophehurpeau/pob/commit/1dda98b556f670f1316fea18b31a9ce806dd114e))
18
+ * **pob:** add node runner as testing option ([c96f6d8](https://github.com/christophehurpeau/pob/commit/c96f6d888a3cc62a5cba50f069e1c51124acb0d9))
19
+ * require node 18 for pob and monorepo ([5953695](https://github.com/christophehurpeau/pob/commit/5953695fc2a7a440bfaebc8abce8533b05a68f65))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * fix rootIgnorePatterns for monorepo ([6731118](https://github.com/christophehurpeau/pob/commit/673111827a0c378febae87f7fefa9917cd8354c3))
25
+
26
+
27
+
28
+ ## [11.9.0](https://github.com/christophehurpeau/pob/compare/pob@11.8.1...pob@11.9.0) (2023-04-03)
29
+
30
+
31
+ ### Features
32
+
33
+ * add expo app ([5b48a8e](https://github.com/christophehurpeau/pob/commit/5b48a8e03b14a414d2e758dbe348be67afc15710))
34
+ * **deps:** update dependency eslint to v8.37.0 ([#1589](https://github.com/christophehurpeau/pob/issues/1589)) ([e9be11e](https://github.com/christophehurpeau/pob/commit/e9be11eefc8f15e591327f7bf12397f30a4f6a4e))
35
+ * **pob:** add supportedArchitectures in .yarnrc.yml ([21c48f5](https://github.com/christophehurpeau/pob/commit/21c48f50ae3867d9ce69e190b1f6a4437a05970a))
36
+ * update tsconfig moduleResolution to bundler with ts 5 ([9f08112](https://github.com/christophehurpeau/pob/commit/9f08112a50c68fc38d119a5ac44cae94f264227f))
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * **deps:** update @pob/eslint-config to v50.0.4 ([#1576](https://github.com/christophehurpeau/pob/issues/1576)) ([570f4fb](https://github.com/christophehurpeau/pob/commit/570f4fb25410db55d11b29453eecef23950d19ef))
42
+ * **deps:** update dependency prettier to v2.8.5 ([#1578](https://github.com/christophehurpeau/pob/issues/1578)) ([07d8197](https://github.com/christophehurpeau/pob/commit/07d81974a850e43792811622845182d8b36ec4ce))
43
+ * **deps:** update dependency prettier to v2.8.6 ([#1580](https://github.com/christophehurpeau/pob/issues/1580)) ([d351ea0](https://github.com/christophehurpeau/pob/commit/d351ea01238a4899eb69cb4c54274ace45249aed))
44
+ * **deps:** update dependency prettier to v2.8.7 ([#1585](https://github.com/christophehurpeau/pob/issues/1585)) ([742de64](https://github.com/christophehurpeau/pob/commit/742de64a8ccaeb94cea5f2edf9c6003158844934))
45
+ * disable baseUrl for expo for now ([fbbe531](https://github.com/christophehurpeau/pob/commit/fbbe531ee6d2d51c4f4cf43a4142122e02dca7ff))
46
+ * prevent removing eslint-config dev deps ([dec1360](https://github.com/christophehurpeau/pob/commit/dec1360e4814a216b0db50e1bcbe7dbd4c677c26))
47
+
48
+
49
+
6
50
  ## [11.8.1](https://github.com/christophehurpeau/pob/compare/pob@11.8.0...pob@11.8.1) (2023-03-19)
7
51
 
8
52
 
@@ -5,7 +5,7 @@ import inLerna from '../../utils/inLerna.js';
5
5
  import * as packageUtils from '../../utils/package.js';
6
6
  import { appIgnorePaths } from './ignorePaths.js';
7
7
 
8
- const appsWithTypescript = ['alp', 'next.js', 'remix', 'pobpack'];
8
+ const appsWithTypescript = ['alp', 'next.js', 'remix', 'pobpack', 'expo'];
9
9
  const appsWithBrowser = ['alp', 'next.js', 'remix'];
10
10
 
11
11
  export default class PobAppGenerator extends Generator {
@@ -75,6 +75,7 @@ export default class PobAppGenerator extends Generator {
75
75
  'node',
76
76
  'node-library', // monorepo library for app. Not a real library
77
77
  'alp-node',
78
+ 'expo',
78
79
  'other',
79
80
  ],
80
81
  },
@@ -151,7 +152,9 @@ export default class PobAppGenerator extends Generator {
151
152
 
152
153
  this.composeWith('pob:common:typescript', {
153
154
  enable: babel,
154
- // nextjs now supports src rootDir: this.appConfig.type === 'next.js' ? '.' : 'src',
155
+ // nextjs now supports src
156
+ rootDir: this.appConfig.type === 'expo' ? '.' : 'src',
157
+ srcDir: 'src',
155
158
  builddefs: false,
156
159
  dom: browser,
157
160
  jsx,
@@ -169,7 +172,9 @@ export default class PobAppGenerator extends Generator {
169
172
  ) {
170
173
  return './src';
171
174
  }
172
- if (this.appConfig.type === 'remix') return '.';
175
+ if (this.appConfig.type === 'remix') {
176
+ return '.';
177
+ }
173
178
  return '';
174
179
  })(),
175
180
  });
@@ -185,6 +190,7 @@ export default class PobAppGenerator extends Generator {
185
190
  enableReleasePlease,
186
191
  testing: this.appConfig.testing,
187
192
  typescript: babel,
193
+ build: babel && this.appConfig.type !== 'expo',
188
194
  documentation: false,
189
195
  codecov: this.appConfig.codecov,
190
196
  ci: this.appConfig.ci,
@@ -206,7 +212,7 @@ export default class PobAppGenerator extends Generator {
206
212
  packageManager: this.options.packageManager,
207
213
  yarnNodeLinker: this.options.yarnNodeLinker,
208
214
  ignorePaths: ignorePaths.join('\n'),
209
- buildDirectory: 'build',
215
+ buildDirectory: this.appConfig.type === 'expo' ? '.expo' : 'build',
210
216
  });
211
217
 
212
218
  this.composeWith('pob:common:release', {
@@ -13,4 +13,17 @@ export const appIgnorePaths = {
13
13
  'node-library': (config) => ['/build'],
14
14
  'alp-node': (config) => ['/build'],
15
15
  other: (config) => [],
16
+ expo: (config) => [
17
+ '/.expo/',
18
+ '*.jks',
19
+ '*.p8',
20
+ '*.p12',
21
+ '*.key',
22
+ '*.mobileprovision',
23
+ '*.orig.*',
24
+ '/web-build/',
25
+
26
+ '# Temporary files created by Metro to check the health of the file watcher',
27
+ '.metro-health-check*',
28
+ ],
16
29
  };
@@ -185,7 +185,6 @@ export default class CommonLintGenerator extends Generator {
185
185
  '@pob/eslint-config-typescript-node',
186
186
  'babel-eslint',
187
187
  'eslint-config-pob',
188
- 'eslint-config-prettier',
189
188
  'typescript-eslint-parser',
190
189
  'standard',
191
190
  'eslint-import-resolver-node',
@@ -196,6 +195,7 @@ export default class CommonLintGenerator extends Generator {
196
195
  'eslint-plugin-jsx-a11y',
197
196
  'eslint-config-airbnb',
198
197
  'eslint-config-airbnb-base',
198
+ 'eslint-config-prettier',
199
199
  'eslint-plugin-babel',
200
200
  'eslint-plugin-flowtype',
201
201
  'eslint-plugin-prefer-class-properties',
@@ -222,23 +222,25 @@ export default class CommonLintGenerator extends Generator {
222
222
  }
223
223
 
224
224
  if (globalEslint && !((inLerna && inLerna.root) || this.options.monorepo)) {
225
- packageUtils.removeDevDependencies(
226
- pkg,
227
- [
228
- 'eslint',
229
- 'prettier',
230
- '@pob/eslint-config',
231
- '@pob/eslint-config-typescript',
232
- '@pob/eslint-config-typescript-react',
233
- '@pob/eslint-config-react',
234
- '@typescript-eslint/eslint-plugin',
235
- '@typescript-eslint/parser',
236
- 'eslint-plugin-node',
237
- 'eslint-plugin-unicorn',
238
- 'eslint-plugin-import',
239
- ],
240
- true,
241
- );
225
+ if (!pkg.name.startsWith('@pob/eslint-config')) {
226
+ packageUtils.removeDevDependencies(
227
+ pkg,
228
+ [
229
+ 'eslint',
230
+ 'prettier',
231
+ '@pob/eslint-config',
232
+ '@pob/eslint-config-typescript',
233
+ '@pob/eslint-config-typescript-react',
234
+ '@pob/eslint-config-react',
235
+ '@typescript-eslint/eslint-plugin',
236
+ '@typescript-eslint/parser',
237
+ 'eslint-plugin-node',
238
+ 'eslint-plugin-unicorn',
239
+ 'eslint-plugin-import',
240
+ ],
241
+ true,
242
+ );
243
+ }
242
244
  } else {
243
245
  if (pkg.name !== 'pob-monorepo') {
244
246
  packageUtils.removeDevDependencies(pkg, ['prettier']);
@@ -419,16 +421,22 @@ export default class CommonLintGenerator extends Generator {
419
421
  }
420
422
 
421
423
  if ((!inLerna || !inLerna.root) && useBabel) {
422
- ignorePatterns.add(`/${this.options.buildDirectory}`, '/test');
424
+ const buildPath = `/${this.options.buildDirectory}`;
425
+ if (
426
+ !this.options.rootIgnorePatterns ||
427
+ !this.options.rootIgnorePatterns.includes(buildPath)
428
+ ) {
429
+ ignorePatterns.add(buildPath);
430
+ }
423
431
  }
424
432
  if (inLerna && inLerna.root && this.options.typescript) {
425
433
  ignorePatterns.add('/rollup.config.mjs');
426
434
  }
427
435
 
428
- if (this.options.ignorePaths) {
429
- this.options.ignorePaths
436
+ if (this.options.rootIgnorePatterns) {
437
+ this.options.rootIgnorePatterns
430
438
  .split('\n')
431
- .filter((path) => path !== `/${this.options.buildDirectory}` && path)
439
+ .filter(Boolean)
432
440
  .forEach((ignorePath) => {
433
441
  if (ignorePath.startsWith('#')) return;
434
442
  ignorePatterns.add(ignorePath);
@@ -20,6 +20,12 @@ export default class CommonTestingGenerator extends Generator {
20
20
  desc: 'enable testing',
21
21
  });
22
22
 
23
+ this.option('runner', {
24
+ type: String,
25
+ defaults: 'jest',
26
+ desc: 'test runner (jest or node)',
27
+ });
28
+
23
29
  this.option('enableReleasePlease', {
24
30
  type: Boolean,
25
31
  defaults: true,
@@ -38,6 +44,12 @@ export default class CommonTestingGenerator extends Generator {
38
44
  desc: 'typescript',
39
45
  });
40
46
 
47
+ this.option('build', {
48
+ type: Boolean,
49
+ required: true,
50
+ desc: 'build (with babel or typescript)',
51
+ });
52
+
41
53
  this.option('codecov', {
42
54
  type: Boolean,
43
55
  required: true,
@@ -81,7 +93,7 @@ export default class CommonTestingGenerator extends Generator {
81
93
  enable: this.options.ci,
82
94
  enableReleasePlease: this.options.enableReleasePlease,
83
95
  testing: this.options.enable,
84
- build: this.options.typescript,
96
+ build: this.options.build,
85
97
  typescript: this.options.typescript,
86
98
  documentation: this.options.documentation,
87
99
  codecov: this.options.codecov,
@@ -122,10 +134,13 @@ export default class CommonTestingGenerator extends Generator {
122
134
  ? yoConfigPobMonorepo.react ?? packageUtils.hasReact(pkg)
123
135
  : packageUtils.hasReact(pkg));
124
136
 
125
- if (!this.options.enable) {
137
+ if (this.options.enable || this.options.runner !== 'jest') {
126
138
  packageUtils.removeDevDependencies(pkg, ['jest', '@types/jest']);
127
139
 
128
140
  delete pkg.jest;
141
+ }
142
+
143
+ if (!this.options.enable) {
129
144
  // if (inLerna) {
130
145
  // if (pkg.scripts.test === 'echo "No tests"') {
131
146
  // delete pkg.scripts.test;
@@ -136,15 +151,18 @@ export default class CommonTestingGenerator extends Generator {
136
151
  delete pkg.scripts.test;
137
152
  delete pkg.scripts['generate:test-coverage'];
138
153
  delete pkg.scripts['test:watch'];
154
+ delete pkg.scripts['test:coverage'];
139
155
  }
140
156
 
141
157
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
142
158
  } else {
143
- packageUtils.addOrRemoveDevDependencies(
144
- pkg,
145
- enableForMonorepo || !globalTesting,
146
- ['jest', '@types/jest'],
147
- );
159
+ if (this.options.runner === 'jest') {
160
+ packageUtils.addOrRemoveDevDependencies(
161
+ pkg,
162
+ enableForMonorepo || !globalTesting,
163
+ ['jest', '@types/jest'],
164
+ );
165
+ }
148
166
 
149
167
  packageUtils.removeScripts(['test:coverage']);
150
168
  if (this.options.monorepo && !globalTesting) {
@@ -155,57 +173,68 @@ export default class CommonTestingGenerator extends Generator {
155
173
  } else if (this.options.monorepo) {
156
174
  const shouldUseExperimentalVmModules = pkg.type === 'module';
157
175
 
158
- const jestCommand = `${
159
- shouldUseExperimentalVmModules
160
- ? 'NODE_OPTIONS=--experimental-vm-modules '
161
- : ''
162
- }jest`;
176
+ const testCommand =
177
+ this.options.runner === 'jest'
178
+ ? `${
179
+ shouldUseExperimentalVmModules
180
+ ? 'NODE_OPTIONS=--experimental-vm-modules '
181
+ : ''
182
+ }jest`
183
+ : 'node --test';
163
184
 
164
185
  packageUtils.addScripts(pkg, {
165
- test: jestCommand,
186
+ test: testCommand,
187
+ 'test:watch': `${testCommand} --watch`,
188
+ 'test:coverage':
189
+ this.options.runner === 'jest'
190
+ ? `${testCommand} --coverage --coverageReporters=json --coverageReporters=text`
191
+ : testCommand, // not yet configured
166
192
  });
167
193
 
168
- const workspacesWithoutStar = pkg.workspaces.map((workspace) => {
169
- if (!workspace.endsWith('/*')) {
170
- throw new Error(`Invalid workspace format: ${workspace}`);
194
+ if (this.options.runner === 'jest') {
195
+ const workspacesWithoutStar = pkg.workspaces.map((workspace) => {
196
+ if (!workspace.endsWith('/*')) {
197
+ throw new Error(`Invalid workspace format: ${workspace}`);
198
+ }
199
+ return workspace.slice(0, -2);
200
+ });
201
+ const workspacesPattern =
202
+ workspacesWithoutStar.length === 1
203
+ ? workspacesWithoutStar[0]
204
+ : `@(${workspacesWithoutStar.join('|')})`;
205
+ hasReact = yoConfigPobMonorepo.packageNames.some((pkgName) =>
206
+ pkgName.startsWith('react-'),
207
+ );
208
+
209
+ if (!pkg.jest) pkg.jest = {};
210
+ Object.assign(pkg.jest, {
211
+ cacheDirectory: './node_modules/.cache/jest',
212
+ testEnvironment: 'node',
213
+ testMatch: [
214
+ `<rootDir>/${workspacesPattern}/*/@(src|lib)/**/__tests__/**/*.${
215
+ transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
216
+ }${hasReact ? '?(x)' : ''}`,
217
+ `<rootDir>/${workspacesPattern}/*/@(src|lib)/**/*.test.${
218
+ transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
219
+ }${hasReact ? '?(x)' : ''}`,
220
+ ],
221
+ });
222
+
223
+ if (shouldUseExperimentalVmModules) {
224
+ pkg.jest.extensionsToTreatAsEsm = [
225
+ transpileWithBabel && '.ts',
226
+ transpileWithBabel && hasReact && '.tsx',
227
+ ].filter(Boolean);
228
+ } else {
229
+ delete pkg.jest.extensionsToTreatAsEsm;
171
230
  }
172
- return workspace.slice(0, -2);
173
- });
174
- const workspacesPattern =
175
- workspacesWithoutStar.length === 1
176
- ? workspacesWithoutStar[0]
177
- : `@(${workspacesWithoutStar.join('|')})`;
178
- hasReact = yoConfigPobMonorepo.packageNames.some((pkgName) =>
179
- pkgName.startsWith('react-'),
180
- );
181
-
182
- if (!pkg.jest) pkg.jest = {};
183
- Object.assign(pkg.jest, {
184
- cacheDirectory: './node_modules/.cache/jest',
185
- testEnvironment: 'node',
186
- testMatch: [
187
- `<rootDir>/${workspacesPattern}/*/@(src|lib)/**/__tests__/**/*.${
188
- transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
189
- }${hasReact ? '?(x)' : ''}`,
190
- `<rootDir>/${workspacesPattern}/*/@(src|lib)/**/*.test.${
191
- transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
192
- }${hasReact ? '?(x)' : ''}`,
193
- ],
194
- });
195
-
196
- if (shouldUseExperimentalVmModules) {
197
- pkg.jest.extensionsToTreatAsEsm = [
198
- transpileWithBabel && '.ts',
199
- transpileWithBabel && hasReact && '.tsx',
200
- ].filter(Boolean);
201
- } else {
202
- delete pkg.jest.extensionsToTreatAsEsm;
203
231
  }
204
232
  } else if (globalTesting) {
205
233
  delete pkg.jest;
206
234
  if (pkg.scripts) {
207
235
  delete pkg.scripts['generate:test-coverage'];
208
236
  delete pkg.scripts['test:watch'];
237
+ delete pkg.scripts['test:coverage'];
209
238
  }
210
239
  packageUtils.addScripts(pkg, {
211
240
  test: `yarn ../../ run test -- ${path
@@ -219,67 +248,78 @@ export default class CommonTestingGenerator extends Generator {
219
248
  const shouldUseExperimentalVmModules =
220
249
  pkg.type === 'module' && !inLerna;
221
250
 
222
- const jestCommand = `${
223
- shouldUseExperimentalVmModules
224
- ? 'NODE_OPTIONS=--experimental-vm-modules '
225
- : ''
226
- }jest`;
251
+ const testCommand =
252
+ this.options.runner === 'jest'
253
+ ? `${
254
+ shouldUseExperimentalVmModules
255
+ ? 'NODE_OPTIONS=--experimental-vm-modules '
256
+ : ''
257
+ }jest`
258
+ : 'node --test';
227
259
 
228
260
  packageUtils.addScripts(pkg, {
229
- test: jestCommand,
230
- 'test:watch': `${jestCommand} --watch`,
261
+ test: testCommand,
262
+ 'test:watch': `${testCommand} --watch`,
263
+ 'test:coverage':
264
+ this.options.runner === 'jest'
265
+ ? `${testCommand} --coverage --coverageReporters=json --coverageReporters=text`
266
+ : testCommand, // not yet configured,
231
267
  });
232
268
 
233
- const srcDirectory = transpileWithBabel ? 'src' : 'lib';
234
-
235
- if (!pkg.jest) pkg.jest = {};
236
- Object.assign(pkg.jest, {
237
- cacheDirectory: './node_modules/.cache/jest',
238
- testMatch: [
239
- `<rootDir>/${srcDirectory}/**/__tests__/**/*.${
240
- transpileWithBabel ? 'ts' : '?(m)js'
241
- }${hasReact ? '?(x)' : ''}`,
242
- `<rootDir>/${srcDirectory}/**/*.test.${
243
- transpileWithBabel ? 'ts' : '?(m)js'
244
- }${hasReact ? '?(x)' : ''}`,
245
- ],
246
- collectCoverageFrom: [
247
- `${srcDirectory}/**/*.${transpileWithBabel ? 'ts' : '?(m)js'}${
248
- hasReact ? '?(x)' : ''
249
- }`,
250
- ],
251
- moduleFileExtensions: [
252
- transpileWithBabel && 'ts',
253
- transpileWithBabel && hasReact && 'tsx',
254
- 'js',
255
- // 'jsx',
256
- 'json',
257
- ].filter(Boolean),
258
- // transform: {
259
- // [`^.+\\.ts${hasReact ? 'x?' : ''}$`]: 'babel-jest',
260
- // },
261
- });
262
- delete pkg.jest.transform;
269
+ if (this.options.runner === 'jest') {
270
+ const srcDirectory = transpileWithBabel ? 'src' : 'lib';
271
+
272
+ if (!pkg.jest) pkg.jest = {};
273
+ Object.assign(pkg.jest, {
274
+ cacheDirectory: './node_modules/.cache/jest',
275
+ testMatch: [
276
+ `<rootDir>/${srcDirectory}/**/__tests__/**/*.${
277
+ transpileWithBabel ? 'ts' : '?(m)js'
278
+ }${hasReact ? '?(x)' : ''}`,
279
+ `<rootDir>/${srcDirectory}/**/*.test.${
280
+ transpileWithBabel ? 'ts' : '?(m)js'
281
+ }${hasReact ? '?(x)' : ''}`,
282
+ ],
283
+ collectCoverageFrom: [
284
+ `${srcDirectory}/**/*.${transpileWithBabel ? 'ts' : '?(m)js'}${
285
+ hasReact ? '?(x)' : ''
286
+ }`,
287
+ ],
288
+ moduleFileExtensions: [
289
+ transpileWithBabel && 'ts',
290
+ transpileWithBabel && hasReact && 'tsx',
291
+ 'js',
292
+ // 'jsx',
293
+ 'json',
294
+ ].filter(Boolean),
295
+ // transform: {
296
+ // [`^.+\\.ts${hasReact ? 'x?' : ''}$`]: 'babel-jest',
297
+ // },
298
+ });
299
+ delete pkg.jest.transform;
300
+
301
+ if (shouldUseExperimentalVmModules) {
302
+ pkg.jest.extensionsToTreatAsEsm = [
303
+ transpileWithBabel && '.ts',
304
+ transpileWithBabel && hasReact && '.tsx',
305
+ ].filter(Boolean);
306
+ } else {
307
+ delete pkg.jest.extensionsToTreatAsEsm;
308
+ }
263
309
 
264
- if (shouldUseExperimentalVmModules) {
265
- pkg.jest.extensionsToTreatAsEsm = [
266
- transpileWithBabel && '.ts',
267
- transpileWithBabel && hasReact && '.tsx',
268
- ].filter(Boolean);
269
- } else {
270
- delete pkg.jest.extensionsToTreatAsEsm;
271
- }
310
+ if (
311
+ babelEnvs.length === 0 ||
312
+ babelEnvs.some((env) => env.target === 'node')
313
+ ) {
314
+ pkg.jest.testEnvironment = 'node';
315
+ } else {
316
+ delete pkg.jest.testEnvironment;
317
+ }
272
318
 
273
- if (
274
- babelEnvs.length === 0 ||
275
- babelEnvs.some((env) => env.target === 'node')
276
- ) {
277
- pkg.jest.testEnvironment = 'node';
319
+ if (!transpileWithBabel) delete pkg.jest.transform;
278
320
  } else {
279
- delete pkg.jest.testEnvironment;
321
+ delete pkg.jest;
280
322
  }
281
-
282
- if (!transpileWithBabel) delete pkg.jest.transform;
283
323
  }
284
324
  }
285
325
 
@@ -20,6 +20,12 @@ export default class CommonTypescriptGenerator extends Generator {
20
20
  desc: 'customize rootDir',
21
21
  });
22
22
 
23
+ this.option('srcDir', {
24
+ type: String,
25
+ defaults: 'src',
26
+ desc: 'customize srcDir, if different than rootDir',
27
+ });
28
+
23
29
  this.option('jsx', {
24
30
  type: Boolean,
25
31
  defaults: true,
@@ -186,6 +192,7 @@ export default class CommonTypescriptGenerator extends Generator {
186
192
  monorepoPackageSrcPaths,
187
193
  monorepoPackageReferences,
188
194
  rootDir: this.options.rootDir,
195
+ srcDir: this.options.srcDir || this.options.rootDir,
189
196
  jsx,
190
197
  jsxPreserve: this.options.jsxPreserve,
191
198
  composite,
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "include": [
3
- "<%= rootDir %>/**/*.ts"<% if (jsx) { -%>,
4
- "<%= rootDir %>/**/*.tsx"<% } %>
3
+ "<%= srcDir %>/**/*.ts"<% if (jsx) { -%>,
4
+ "<%= srcDir %>/**/*.tsx"<% } %><% if (srcDir !== rootDir) { -%>,
5
+ "<%= rootDir %>/*.ts"<% } %>
5
6
  ],
6
- <% if(rootDir === '.' || forceExcludeNodeModules) { -%>
7
+ <% if(srcDir === '.' || forceExcludeNodeModules) { -%>
7
8
  "exclude": [
8
9
  "node_modules"
9
10
  ],
@@ -59,7 +60,7 @@
59
60
  "forceConsistentCasingInFileNames": true,
60
61
 
61
62
  /* Module Resolution Options */
62
- "moduleResolution": "node" /* Specify module resolution strategy. */,
63
+ "moduleResolution": "bundler" /* Specify module resolution strategy. */,
63
64
  <% if (resolveJsonModule) { -%>
64
65
  "resolveJsonModule": <%= resolveJsonModule %>,
65
66
  <% } -%>
@@ -90,7 +90,7 @@ jobs:
90
90
  if: matrix.node-version != 18
91
91
 
92
92
  - name: Generate Test Coverage
93
- run: <%= packageManager %> run test --coverage --coverageReporters=json --coverageReporters=text
93
+ run: <%= packageManager %> run test:coverage
94
94
  if: matrix.node-version == 18
95
95
 
96
96
  - name: Send results to codecov
@@ -54,7 +54,7 @@ jobs:
54
54
  <% if (codecov) { -%>
55
55
 
56
56
  - name: Generate Test Coverage
57
- run: <%= packageManager %> run test --coverage --coverageReporters=json --coverageReporters=text
57
+ run: <%= packageManager %> run test:coverage
58
58
  if: startsWith(matrix.node-version, '18.')
59
59
  env:
60
60
  CI: true
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable camelcase */
2
2
 
3
- import fetch from 'node-fetch';
4
3
  import Generator from 'yeoman-generator';
5
4
  import { ciContexts } from '../../../ci/CoreCIGenerator.js';
6
5
  // const packageUtils = require('../../../../../utils/package');
@@ -102,6 +102,12 @@ export default class CoreYarnGenerator extends Generator {
102
102
  config.defaultSemverRangePrefix = this.options.type === 'app' ? '' : '^';
103
103
  config.enableMessageNames = false;
104
104
  config.nodeLinker = this.options.yarnNodeLinker;
105
+ // https://yarnpkg.dev/releases/3-1/
106
+ // make sure all supported architectures are in yarn cache
107
+ config.supportedArchitectures = {
108
+ os: ['linux', 'darwin'],
109
+ cpu: ['x64', 'arm64'],
110
+ };
105
111
  writeAndFormat(this.fs, '.yarnrc.yml', yml.dump(config, {}));
106
112
  } else {
107
113
  this.fs.delete('.yarn');
@@ -170,9 +170,26 @@ export default class PobLibGenerator extends Generator {
170
170
  ? this.pobjson.documentation
171
171
  : true,
172
172
  },
173
+ {
174
+ type: 'checkbox',
175
+ name: 'runner',
176
+ message: 'Testing runner ?',
177
+ default: 'jest',
178
+ choices: [
179
+ {
180
+ name: 'Jest',
181
+ value: 'jest',
182
+ },
183
+ {
184
+ name: 'node:test',
185
+ value: 'node',
186
+ },
187
+ ],
188
+ },
173
189
  ]);
174
190
 
175
191
  this.pobjson.documentation = !!answers.documentation;
192
+ this.pobjson.runner = !!answers.runner;
176
193
  }
177
194
 
178
195
  // testing
@@ -248,6 +265,10 @@ export default class PobLibGenerator extends Generator {
248
265
  enable: this.pobjson.testing,
249
266
  enableReleasePlease,
250
267
  testing: this.pobjson.testing,
268
+ runner: this.pobjson.testing
269
+ ? this.pobjson.testing.runner || 'jest'
270
+ : undefined,
271
+ build: withBabel,
251
272
  typescript: withBabel,
252
273
  documentation: !!this.pobjson.documentation,
253
274
  codecov: this.pobjson.testing && this.pobjson.testing.codecov,
@@ -16,7 +16,7 @@
16
16
  "module": "esnext",
17
17
  "lib": ["dom", "esnext"],
18
18
  "skipLibCheck": true,
19
- "moduleResolution": "node",
19
+ "moduleResolution": "bundler",
20
20
  "esModuleInterop": true
21
21
  },
22
22
 
@@ -219,6 +219,7 @@ export default class PobMonorepoGenerator extends Generator {
219
219
  enable: this.pobLernaConfig.testing,
220
220
  enableReleasePlease: isReleasePleaseEnabled,
221
221
  testing: this.pobLernaConfig.testing,
222
+ build: this.pobLernaConfig.typescript,
222
223
  typescript: this.pobLernaConfig.typescript,
223
224
  documentation: !!this.pobLernaConfig.documentation,
224
225
  codecov: this.pobLernaConfig.testing && this.pobLernaConfig.codecov,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "11.8.1",
3
+ "version": "12.0.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "type": "module",
20
20
  "engines": {
21
- "node": ">=16.0.0"
21
+ "node": ">=18.0.0"
22
22
  },
23
23
  "main": "./lib/index.js",
24
24
  "exports": {
@@ -38,13 +38,13 @@
38
38
  "dependencies": {
39
39
  "@lerna/package-graph": "5.5.4",
40
40
  "@lerna/project": "5.5.4",
41
- "@pob/eslint-config": "50.0.0",
42
- "@pob/eslint-config-typescript": "50.0.0",
43
- "@pob/eslint-config-typescript-react": "50.0.0",
41
+ "@pob/eslint-config": "50.0.4",
42
+ "@pob/eslint-config-typescript": "50.0.4",
43
+ "@pob/eslint-config-typescript-react": "50.0.4",
44
44
  "@pob/sort-eslint-config": "4.1.1",
45
45
  "@pob/sort-object": "5.1.1",
46
46
  "@pob/sort-pkg": "5.2.0",
47
- "eslint": "8.36.0",
47
+ "eslint": "8.38.0",
48
48
  "findup-sync": "^5.0.0",
49
49
  "git-remote-url": "^1.0.1",
50
50
  "github-username": "^6.0.0",
@@ -56,16 +56,15 @@
56
56
  "mem-fs": "2.3.0",
57
57
  "mem-fs-editor": "9.7.0",
58
58
  "minimist": "1.2.8",
59
- "node-fetch": "3.3.1",
60
59
  "parse-author": "2.0.0",
61
- "pob-dependencies": "7.6.1",
62
- "prettier": "2.8.4",
63
- "semver": "7.3.8",
60
+ "pob-dependencies": "7.8.0",
61
+ "prettier": "2.8.7",
62
+ "semver": "7.5.0",
64
63
  "yeoman-environment": "3.15.1",
65
64
  "yeoman-generator": "5.8.0"
66
65
  },
67
66
  "devDependencies": {
68
- "@pob/root": "7.6.1"
67
+ "@pob/root": "7.8.0"
69
68
  },
70
- "gitHead": "831fbb0a3e31c5f4654f8930df6e5de3d07ac90a"
69
+ "gitHead": "efa1629282be7a06f88a2b2c84b87e56c6ea3d30"
71
70
  }