pob 17.2.0 → 17.3.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,33 @@
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
+ ## [17.3.0](https://github.com/christophehurpeau/pob/compare/pob@17.2.1...pob@17.3.0) (2023-12-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * configure declarationDir ([338a4dc](https://github.com/christophehurpeau/pob/commit/338a4dc7a642e9f8c24f953d5368745467578a38))
12
+ * use ts-node if needed with rollup-typescript ([9aefca2](https://github.com/christophehurpeau/pob/commit/9aefca2f69ba7bf2ff6f142e5156937d1c9e47fe))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * add srcdirectory for glob tests ([3902bbd](https://github.com/christophehurpeau/pob/commit/3902bbdc088293df17a328687661a3dcb0a0c2a3))
18
+ * add TS_NODE_PROJECT ([f67673b](https://github.com/christophehurpeau/pob/commit/f67673bd35a4ee84965de229266d5b944f8c49ef))
19
+
20
+ Version bump for dependency: root
21
+
22
+
23
+ ## [17.2.1](https://github.com/christophehurpeau/pob/compare/pob@17.2.0...pob@17.2.1) (2023-12-27)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * add tsimp cache in gitignore ([d598fa4](https://github.com/christophehurpeau/pob/commit/d598fa4dfc20556319f204ee43dbefaa5f96f026))
29
+
30
+ Version bump for dependency: root
31
+
32
+
6
33
  ## [17.2.0](https://github.com/christophehurpeau/pob/compare/pob@17.1.0...pob@17.2.0) (2023-12-27)
7
34
 
8
35
 
@@ -186,14 +186,59 @@ export default class CommonTestingGenerator extends Generator {
186
186
  this.fs.delete(this.destinationPath('jest.config.json'));
187
187
  }
188
188
 
189
+ const tsTestUtil = 'ts-node'; // : 'tsimp' | 'ts-node' | 'swc
190
+ const tsTestLoaderOption = (() => {
191
+ switch (tsTestUtil) {
192
+ case 'tsimp':
193
+ return '--import=tsimp/import';
194
+ case 'ts-node':
195
+ return '--loader=ts-node/esm';
196
+ case '@swc-node/register':
197
+ return '--import=@swc-node/register/esm';
198
+ }
199
+ })();
189
200
  packageUtils.addOrRemoveDevDependencies(
190
201
  pkg,
191
202
  this.options.enable &&
192
203
  this.options.runner === 'node' &&
193
204
  this.options.typescript,
194
- ['tsimp'],
205
+ [tsTestUtil],
195
206
  );
196
207
 
208
+ const createTestCommand = ({
209
+ coverage,
210
+ watch,
211
+ shouldUseExperimentalVmModules,
212
+ }) => {
213
+ switch (this.options.runner) {
214
+ case 'jest': {
215
+ return `${
216
+ shouldUseExperimentalVmModules
217
+ ? 'NODE_OPTIONS=--experimental-vm-modules '
218
+ : ''
219
+ }jest${watch ? ' --watch' : ''}${
220
+ coverage
221
+ ? ' --coverage --coverageReporters=json --coverageReporters=text'
222
+ : ''
223
+ }`;
224
+ }
225
+ case 'node': {
226
+ return `${tsTestUtil === 'tsimp' ? 'TSIMP_DIAG=ignore ' : ''}${
227
+ tsTestUtil === 'ts-node'
228
+ ? 'TS_NODE_PROJECT=tsconfig.test.json '
229
+ : ''
230
+ }node ${this.options.typescript ? `${tsTestLoaderOption} ` : ''}${
231
+ coverage ? ' --experimental-test-coverage' : ''
232
+ }--test ${this.options.srcDirectory}/${
233
+ this.options.typescript ? '**/*.test.ts' : '**/*.test.js'
234
+ }`;
235
+ }
236
+ default: {
237
+ throw new Error('Invalid runner');
238
+ }
239
+ }
240
+ };
241
+
197
242
  if (!this.options.enable) {
198
243
  // if (inMonorepo) {
199
244
  // if (pkg.scripts.test === 'echo "No tests"') {
@@ -227,26 +272,16 @@ export default class CommonTestingGenerator extends Generator {
227
272
  } else if (this.options.monorepo) {
228
273
  const shouldUseExperimentalVmModules = pkg.type === 'module';
229
274
 
230
- const testCommand =
231
- this.options.runner === 'jest'
232
- ? `${
233
- shouldUseExperimentalVmModules
234
- ? 'NODE_OPTIONS=--experimental-vm-modules '
235
- : ''
236
- }jest`
237
- : `node ${
238
- this.options.typescript ? '--import=tsimp/import ' : ''
239
- }--test ${
240
- this.options.typescript ? '**/*.test.ts' : '**/*.test.js'
241
- }`;
242
-
243
275
  packageUtils.addScripts(pkg, {
244
- test: testCommand,
245
- 'test:watch': `${testCommand} --watch`,
246
- 'test:coverage':
247
- this.options.runner === 'jest'
248
- ? `${testCommand} --coverage --coverageReporters=json --coverageReporters=text`
249
- : testCommand, // not yet configured
276
+ test: createTestCommand({ shouldUseExperimentalVmModules }),
277
+ 'test:watch': createTestCommand({
278
+ shouldUseExperimentalVmModules,
279
+ watch: true,
280
+ }),
281
+ 'test:coverage': createTestCommand({
282
+ shouldUseExperimentalVmModules,
283
+ coverage: true,
284
+ }),
250
285
  });
251
286
 
252
287
  if (isJestRunner) {
@@ -310,26 +345,16 @@ export default class CommonTestingGenerator extends Generator {
310
345
  const shouldUseExperimentalVmModules =
311
346
  pkg.type === 'module' && !inMonorepo;
312
347
 
313
- const testCommand =
314
- this.options.runner === 'jest'
315
- ? `${
316
- shouldUseExperimentalVmModules
317
- ? 'NODE_OPTIONS=--experimental-vm-modules '
318
- : ''
319
- }jest`
320
- : `node ${
321
- this.options.typescript ? '--import=tsimp/import ' : ''
322
- }--test ${
323
- this.options.typescript ? '**/*.test.ts' : '**/*.test.js'
324
- }`;
325
-
326
348
  packageUtils.addScripts(pkg, {
327
- test: testCommand,
328
- 'test:watch': `${testCommand} --watch`,
329
- 'test:coverage':
330
- this.options.runner === 'jest'
331
- ? `${testCommand} --coverage --coverageReporters=json --coverageReporters=text`
332
- : testCommand, // not yet configured,
349
+ test: createTestCommand({ shouldUseExperimentalVmModules }),
350
+ 'test:watch': createTestCommand({
351
+ shouldUseExperimentalVmModules,
352
+ watch: true,
353
+ }),
354
+ 'test:coverage': createTestCommand({
355
+ shouldUseExperimentalVmModules,
356
+ coverage: true,
357
+ }),
333
358
  });
334
359
 
335
360
  if (this.options.runner === 'jest') {
@@ -232,9 +232,9 @@ export default class CommonTranspilerGenerator extends Generator {
232
232
  // see pkg.exports instead.
233
233
  delete pkg.main;
234
234
  if (!this.options.isApp) {
235
- pkg.types = `./${this.options.buildDirectory}/${
236
- withTypescript && !useRollup ? '' : 'definitions/'
237
- }index.d.ts`;
235
+ pkg.types = `./${
236
+ this.options.buildDirectory
237
+ }/${'definitions/'}index.d.ts`;
238
238
  }
239
239
  } else {
240
240
  if (!pkg.main) {
@@ -21,6 +21,9 @@
21
21
  <% } -%>
22
22
  <% if (emitDefinitions || build) { -%>
23
23
  "outDir": "<%= build ? 'dist' : 'dist/definitions' %>",
24
+ <% if (build) { -%>
25
+ "declarationDir": "dist/definitions",
26
+ <% } -%>
24
27
  <% if (composite) {
25
28
  // dont emit in dist/definitions to avoid publish to npm
26
29
  -%>
@@ -65,6 +65,7 @@ jobs:
65
65
  if: startsWith(matrix.node-version, '20.')
66
66
  env:
67
67
  CI: true
68
+ NODE_V8_COVERAGE: coverage/
68
69
 
69
70
  - name: Send results to codecov
70
71
  uses: codecov/codecov-action@v3
@@ -75,6 +75,7 @@ export default class CoreGitignoreGenerator extends Generator {
75
75
  documentation: this.options.documentation,
76
76
  testing: this.options.testing,
77
77
  withBabel,
78
+ tsTestUtil: 'ts-node',
78
79
  typescript: withBabel || this.options.typescript,
79
80
  paths: this.options.paths,
80
81
  buildInGit: this.options.buildInGit,
@@ -27,7 +27,11 @@ yarn-error.log*
27
27
  <% } -%>
28
28
  <% if (testing) { -%>
29
29
 
30
- # jest default coverage directory
30
+ <% if (typescript && !withBabel && tsTestUtil === 'tsimp') { -%>
31
+ # tsimp cache
32
+ /.tsimp
33
+ <% } -%>
34
+ # default coverage directory
31
35
  /coverage
32
36
  <% } -%>
33
37
  <% if (typescript && buildInGit) { -%>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "17.2.0",
3
+ "version": "17.3.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -62,7 +62,7 @@
62
62
  "mem-fs-editor": "11.0.0",
63
63
  "minimist": "1.2.8",
64
64
  "parse-author": "2.0.0",
65
- "pob-dependencies": "10.2.0",
65
+ "pob-dependencies": "10.3.0",
66
66
  "prettier": "2.8.8",
67
67
  "semver": "7.5.4",
68
68
  "validate-npm-package-name": "^5.0.0",
@@ -71,6 +71,6 @@
71
71
  "yeoman-generator": "7.1.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@pob/root": "8.11.0"
74
+ "@pob/root": "8.12.0"
75
75
  }
76
76
  }