npm-package-json-loader 2.0.6 → 2.0.9

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,45 @@
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
+ ## [2.0.9](https://github.com/bluelovers/ws-yarn-workspaces/compare/npm-package-json-loader@2.0.8...npm-package-json-loader@2.0.9) (2022-08-18)
7
+
8
+ **Note:** Version bump only for package npm-package-json-loader
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.0.8](https://github.com/bluelovers/ws-yarn-workspaces/compare/npm-package-json-loader@2.0.7...npm-package-json-loader@2.0.8) (2022-08-13)
15
+
16
+ **Note:** Version bump only for package npm-package-json-loader
17
+
18
+
19
+
20
+
21
+
22
+ ## [2.0.7](https://github.com/bluelovers/ws-yarn-workspaces/compare/npm-package-json-loader@2.0.6...npm-package-json-loader@2.0.7) (2022-08-13)
23
+
24
+
25
+ ### 🚨 Tests
26
+
27
+ * update jest.config.js and deps ([d1d501b](https://github.com/bluelovers/ws-yarn-workspaces/commit/d1d501ba059130bd8f90e6eaa266084110698011))
28
+
29
+
30
+ ### 🛠 Build System
31
+
32
+ * update typescript ([b69b593](https://github.com/bluelovers/ws-yarn-workspaces/commit/b69b593d511d9d4e246513dc1d69721150b9cfe8))
33
+
34
+
35
+ ### 📌 Dependencies
36
+
37
+ * update deps ([58501f9](https://github.com/bluelovers/ws-yarn-workspaces/commit/58501f97494eb624779dffea7ac9d68e45e5e978))
38
+ * update deps ([c968045](https://github.com/bluelovers/ws-yarn-workspaces/commit/c96804598f63a5cd06507e3eaaa2e8b569b14b65))
39
+ * update deps ([a0b8755](https://github.com/bluelovers/ws-yarn-workspaces/commit/a0b875582efdc9829b0cdb6c9c819cace8b76e90))
40
+
41
+
42
+
43
+
44
+
6
45
  ## [2.0.6](https://github.com/bluelovers/ws-yarn-workspaces/compare/npm-package-json-loader@2.0.5...npm-package-json-loader@2.0.6) (2022-07-31)
7
46
 
8
47
 
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import { IPackageJson } from '@ts-type/package-dts';
3
- declare type IFileOrJson = Buffer | string | object | IPackageJson;
4
- declare type IPackageJsonLike<T> = Partial<T> | Record<string, any>;
5
- declare type IItemOrItemArray<T> = T | T[];
3
+ type IFileOrJson = Buffer | string | object | IPackageJson;
4
+ type IPackageJsonLike<T> = Partial<T> | Record<string, any>;
5
+ type IItemOrItemArray<T> = T | T[];
6
6
  export declare class PackageJsonLoader<T extends IPackageJsonLike<IPackageJson> = IPackageJson> {
7
7
  readonly file: string;
8
8
  protected json: T;
package/jest.config.js CHANGED
@@ -1,5 +1,116 @@
1
- const { mixinJestConfig } = require('@bluelovers/jest-config');
1
+ // @ts-check
2
2
 
3
- module.exports = mixinJestConfig({}, true, {
4
- file: __filename,
5
- })
3
+ const { basename, extname, dirname } = require('path');
4
+
5
+ /**
6
+ * // @type { import('@jest/types').Config.InitialOptions }
7
+ * @type { import('ts-jest').InitialOptionsTsJest }
8
+ */
9
+ let jestConfig = {
10
+
11
+ }
12
+
13
+ /**
14
+ * @param {string} name
15
+ * @returns {string}
16
+ * @private
17
+ */
18
+ function _requireResolve(name)
19
+ {
20
+ let result;
21
+
22
+ try
23
+ {
24
+ // @ts-ignore
25
+ const { requireResolveExtra, requireResolveCore } = require('@yarn-tool/require-resolve');
26
+
27
+ const paths = [
28
+ requireResolveExtra('@bluelovers/tsdx').result,
29
+ requireResolveExtra('tsdx').result,
30
+ ].filter(Boolean);
31
+
32
+ result = requireResolveCore(name, {
33
+ includeGlobal: true,
34
+ includeCurrentDirectory: true,
35
+ paths,
36
+ })
37
+ }
38
+ catch (e)
39
+ {
40
+
41
+ }
42
+
43
+ result = result || require.resolve(name);
44
+
45
+ console.info('[require.resolve]', name, '=>', result)
46
+
47
+ return result
48
+ }
49
+
50
+ let _ok = true;
51
+
52
+ try
53
+ {
54
+ if (!jestConfig.preset)
55
+ {
56
+
57
+ let result = require('@yarn-tool/ws-find-up-paths').findUpPathsWorkspaces([
58
+ 'jest-preset.js',
59
+ 'jest.config.js',
60
+ ], {
61
+ ignoreCurrentPackage: true,
62
+ onlyFiles: true,
63
+ }).result;
64
+
65
+ if (result)
66
+ {
67
+ let name = basename(result, extname(result))
68
+
69
+ switch (name)
70
+ {
71
+ case 'jest-preset':
72
+ jestConfig.preset = dirname(result);
73
+ break;
74
+ default:
75
+ jestConfig = {
76
+ ...require(result),
77
+ jestConfig,
78
+ };
79
+ break;
80
+ }
81
+
82
+ _ok = false;
83
+ }
84
+ }
85
+ }
86
+ catch (e)
87
+ {
88
+
89
+ }
90
+
91
+ try
92
+ {
93
+ if (_ok && !jestConfig.preset)
94
+ {
95
+ let result = _requireResolve('@bluelovers/jest-config/package.json');
96
+ if (result)
97
+ {
98
+ jestConfig.preset = dirname(result);
99
+ _ok = false;
100
+ }
101
+ }
102
+ }
103
+ catch (e)
104
+ {
105
+
106
+ }
107
+
108
+ if (_ok && !jestConfig.preset)
109
+ {
110
+ jestConfig.preset = '@bluelovers/jest-config';
111
+ _ok = false;
112
+ }
113
+
114
+ console.info(`jest.config.preset: ${jestConfig.preset}`);
115
+
116
+ module.exports = jestConfig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-package-json-loader",
3
- "version": "2.0.6",
3
+ "version": "2.0.9",
4
4
  "private": false,
5
5
  "description": "Find and load configuration from a package.json",
6
6
  "keywords": [
@@ -44,20 +44,20 @@
44
44
  "config": {},
45
45
  "resolutions": {},
46
46
  "dependencies": {
47
- "@bluelovers/fs-json": "^1.0.7",
48
- "@ts-type/package-dts": "^2.0.2",
49
- "@yarn-tool/pkg-entry-util": "^2.0.6",
50
- "@yarn-tool/resolve-package": "^2.0.0",
47
+ "@bluelovers/fs-json": "^1.0.9",
48
+ "@ts-type/package-dts": "^2.0.5",
49
+ "@yarn-tool/pkg-entry-util": "^2.0.9",
50
+ "@yarn-tool/resolve-package": "^2.0.2",
51
51
  "bind-decorator": "^1.0.11",
52
52
  "fs-extra": "^10.1.0",
53
53
  "sort-package-json": "^1.57.0",
54
- "sort-package-json3": "^2.0.1",
55
- "ts-type": "^2.1.8",
54
+ "sort-package-json3": "^2.0.3",
55
+ "ts-type": "^2.1.10",
56
56
  "tslib": "^2"
57
57
  },
58
58
  "bundleDependencies": [],
59
59
  "preferGlobal": true,
60
60
  "publishConfig": {},
61
- "gitHead": "ff2ab47cbd966bfa7f8eca7378e29571c1b53c1c",
61
+ "gitHead": "43e4e36c013c2f68c7f4a485651276495da5039c",
62
62
  "licenses": []
63
63
  }