pob 18.2.0 → 18.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,29 @@
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
+ ## [18.3.0](https://github.com/christophehurpeau/pob/compare/pob@18.2.0...pob@18.3.0) (2024-02-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * add directory in extraEntries for usage in files ([17839e6](https://github.com/christophehurpeau/pob/commit/17839e65d6a4f5c50e8f7e4e9da635fc3e0b7382))
12
+ * custom test folder ([f3214b9](https://github.com/christophehurpeau/pob/commit/f3214b9554dd2ce057786dad762a9eef07a25c41))
13
+ * **deps:** update dependency semver to v7.6.0 ([#1930](https://github.com/christophehurpeau/pob/issues/1930)) ([dfc8761](https://github.com/christophehurpeau/pob/commit/dfc8761b8123fbb5a9bdf25ba296a20043e25aae))
14
+ * **deps:** update dependency yeoman-environment to v4.2.1 ([#1901](https://github.com/christophehurpeau/pob/issues/1901)) ([e8bb372](https://github.com/christophehurpeau/pob/commit/e8bb372cd141cedc2736913b84e861768636f26e))
15
+ * **deps:** update dependency yeoman-environment to v4.3.0 ([#1917](https://github.com/christophehurpeau/pob/issues/1917)) ([453fdd9](https://github.com/christophehurpeau/pob/commit/453fdd96725e740306c9341595f1b9e1af15f3fc))
16
+ * **deps:** update yarn monorepo ([#1918](https://github.com/christophehurpeau/pob/issues/1918)) ([288ed84](https://github.com/christophehurpeau/pob/commit/288ed84945daa7813dcfb692ee459676a119b9bf))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * fix export when omitVersionInFileName is set ([501367f](https://github.com/christophehurpeau/pob/commit/501367f0072f9ac41ace22312c0576afd7b1645a))
22
+ * fix jest enabled condition ([c10f8b1](https://github.com/christophehurpeau/pob/commit/c10f8b19139d41ef1565a5e7314dbdee5d67cdba))
23
+ * fix srcDirectory for app library ([7df6ba1](https://github.com/christophehurpeau/pob/commit/7df6ba14228326ee9b00b3fa2ec7af1204398860))
24
+
25
+ Version bump for dependency: yarn-workspace-utils
26
+ Version bump for dependency: root
27
+
28
+
6
29
  ## [18.2.0](https://github.com/christophehurpeau/pob/compare/pob@18.1.1...pob@18.2.0) (2023-12-31)
7
30
 
8
31
 
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs';
1
2
  import path from 'node:path';
2
3
  import Generator from 'yeoman-generator';
3
4
  import inMonorepo from '../../../utils/inMonorepo.js';
@@ -211,6 +212,9 @@ export default class CommonTestingGenerator extends Generator {
211
212
  }
212
213
  })();
213
214
 
215
+ const hasTestFolder =
216
+ !this.options.monorepo && fs.existsSync(this.destinationPath('test'));
217
+
214
218
  const createTestCommand = ({
215
219
  coverage,
216
220
  coverageLcov,
@@ -256,11 +260,9 @@ export default class CommonTestingGenerator extends Generator {
256
260
  : ''
257
261
  }node ${
258
262
  this.options.typescript ? `${tsTestLoaderOption} ` : ''
259
- }--test ${
260
- this.options.monorepo
261
- ? workspacesPattern
262
- : this.options.srcDirectory
263
- }/${this.options.typescript ? '**/*.test.ts' : '**/*.test.js'}`;
263
+ }--test ${this.options.monorepo ? `${workspacesPattern}/` : ''}${`${
264
+ hasTestFolder ? 'test/*' : `${this.options.srcDirectory}/**/*.test`
265
+ }.${this.options.typescript ? 'ts' : 'js'}`}`;
264
266
  }
265
267
  default: {
266
268
  throw new Error(`Invalid runner: "${testRunner}"`);
@@ -271,7 +273,9 @@ export default class CommonTestingGenerator extends Generator {
271
273
  const jestConfigPath = this.destinationPath('jest.config.json');
272
274
  packageUtils.addOrRemoveDevDependencies(
273
275
  pkg,
274
- (enableForMonorepo || !globalTesting) && testRunner === 'jest',
276
+ this.options.enable &&
277
+ (enableForMonorepo || !globalTesting) &&
278
+ testRunner === 'jest',
275
279
  ['jest', '@types/jest'],
276
280
  );
277
281
 
@@ -335,21 +335,24 @@ export default class CommonTranspilerGenerator extends Generator {
335
335
 
336
336
  const defaultNodeEnvVersion = defaultNodeEnv && defaultNodeEnv.version;
337
337
 
338
- envs.forEach(({ target, version, formats }) => {
338
+ envs.forEach(({ target, version, formats, omitVersionInFileName }) => {
339
339
  if (target === 'node' && entry === 'browser') return;
340
340
 
341
341
  const exportTarget = {};
342
342
 
343
343
  if (target === 'node') {
344
344
  const cjsExt = pkg.type === 'module' ? 'cjs' : 'cjs.js';
345
+ const filenameWithoutExt = `${entryDistName}-${target}${
346
+ omitVersionInFileName ? '' : version
347
+ }`;
345
348
  if (!formats || formats.includes('es')) {
346
- exportTarget.import = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.mjs`;
349
+ exportTarget.import = `./${this.options.buildDirectory}/${filenameWithoutExt}.mjs`;
347
350
 
348
351
  if (formats && formats.includes('cjs')) {
349
- exportTarget.require = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
352
+ exportTarget.require = `./${this.options.buildDirectory}/${filenameWithoutExt}.${cjsExt}`;
350
353
  }
351
354
  } else if (formats && formats.includes('cjs')) {
352
- exportTarget.default = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
355
+ exportTarget.default = `./${this.options.buildDirectory}/${filenameWithoutExt}.${cjsExt}`;
353
356
  }
354
357
  // eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
355
358
  // jest: https://github.com/facebook/jest/issues/9771
@@ -60,6 +60,13 @@ export default class CoreNpmGenerator extends Generator {
60
60
  }
61
61
  });
62
62
  }
63
+ if (pkg.pob?.extraEntries) {
64
+ pkg.pob?.extraEntries.forEach((extraEntry) => {
65
+ if (extraEntry.directory) {
66
+ files.add(extraEntry.directory);
67
+ }
68
+ });
69
+ }
63
70
 
64
71
  pkg.files = [...files].filter(Boolean);
65
72
  } else {
@@ -292,6 +292,7 @@ export default class PobLibGenerator extends Generator {
292
292
  packageManager: this.options.packageManager,
293
293
  isApp: false,
294
294
  splitCIJobs: false,
295
+ srcDirectory: withBabel || withTypescript ? 'src' : 'lib',
295
296
  });
296
297
 
297
298
  // must be after testing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "18.2.0",
3
+ "version": "18.3.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -39,16 +39,16 @@
39
39
  "pob": {},
40
40
  "prettier": "@pob/root/prettier-config",
41
41
  "dependencies": {
42
- "@pob/eslint-config": "53.0.0",
43
- "@pob/eslint-config-typescript": "53.1.0",
44
- "@pob/eslint-config-typescript-react": "53.0.0",
42
+ "@pob/eslint-config": "54.0.0",
43
+ "@pob/eslint-config-typescript": "54.0.0",
44
+ "@pob/eslint-config-typescript-react": "54.0.0",
45
45
  "@pob/sort-eslint-config": "5.2.1",
46
46
  "@pob/sort-object": "6.2.1",
47
47
  "@pob/sort-pkg": "7.0.0",
48
48
  "@types/inquirer": "9.0.7",
49
- "@yarnpkg/cli": "4.0.2",
50
- "@yarnpkg/core": "4.0.2",
51
- "@yarnpkg/fslib": "3.0.1",
49
+ "@yarnpkg/cli": "4.1.0",
50
+ "@yarnpkg/core": "4.0.3",
51
+ "@yarnpkg/fslib": "3.0.2",
52
52
  "@yeoman/types": "1.1.2",
53
53
  "eslint": "8.56.0",
54
54
  "findup-sync": "^5.0.0",
@@ -62,15 +62,15 @@
62
62
  "mem-fs-editor": "11.0.0",
63
63
  "minimist": "1.2.8",
64
64
  "parse-author": "2.0.0",
65
- "pob-dependencies": "11.0.1",
65
+ "pob-dependencies": "11.1.0",
66
66
  "prettier": "2.8.8",
67
- "semver": "7.5.4",
67
+ "semver": "7.6.0",
68
68
  "validate-npm-package-name": "^5.0.0",
69
- "yarn-workspace-utils": "3.1.2",
70
- "yeoman-environment": "4.1.3",
69
+ "yarn-workspace-utils": "3.2.0",
70
+ "yeoman-environment": "4.3.0",
71
71
  "yeoman-generator": "7.1.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@pob/root": "9.1.0"
74
+ "@pob/root": "9.2.0"
75
75
  }
76
76
  }