pnpm-plugin-nice-move 0.2.2 → 0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/pnpmfile.cjs +60 -36
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pnpm-plugin-nice-move",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "A `pnpm` config created by personal preferences",
5
5
  "license": "MIT",
6
6
  "author": {
package/pnpmfile.cjs CHANGED
@@ -2,15 +2,40 @@
2
2
 
3
3
  // @ts-check
4
4
 
5
- const minimumReleaseAgeExclude = [
6
- '@nice-move/*',
7
- '@best-shot/*',
8
- '@all-star/*',
9
- ];
5
+ const isObject = (v) =>
6
+ v !== null && typeof v === 'object' && !Array.isArray(v);
10
7
 
11
- const trustPolicyExclude = ['semver@6.3.1'];
8
+ function deepMerge(target = {}, source = {}) {
9
+ return Object.entries(source).reduce(
10
+ (out, [key, srcVal]) => {
11
+ if (srcVal === undefined) {
12
+ return out;
13
+ }
14
+
15
+ const tgtVal = out[key];
16
+
17
+ if (tgtVal === undefined) {
18
+ out[key] = srcVal;
19
+
20
+ return out;
21
+ }
22
+
23
+ if (Array.isArray(srcVal) && Array.isArray(tgtVal)) {
24
+ const seen = new Set(tgtVal);
25
+ out[key] = [...tgtVal, ...srcVal.filter((i) => !seen.has(i))];
12
26
 
13
- /* eslint-disable no-param-reassign */
27
+ return out;
28
+ }
29
+
30
+ if (isObject(srcVal) && isObject(tgtVal)) {
31
+ out[key] = deepMerge(tgtVal, srcVal);
32
+ }
33
+
34
+ return out;
35
+ },
36
+ { ...target },
37
+ );
38
+ }
14
39
 
15
40
  module.exports = {
16
41
  /**
@@ -18,7 +43,7 @@ module.exports = {
18
43
  */
19
44
  hooks: {
20
45
  updateConfig(/** @type {import('@pnpm/config').Config} */ config) {
21
- Object.assign(config, {
46
+ return deepMerge(config, {
22
47
  blockExoticSubdeps: true,
23
48
  engineStrict: true,
24
49
  ignorePatchFailures: false,
@@ -28,35 +53,34 @@ module.exports = {
28
53
  strictDepBuilds: false,
29
54
  trustPolicy: 'no-downgrade',
30
55
  verifyDepsBeforeRun: 'warn',
56
+ strictPeerDependencies: true,
57
+ trustPolicyExclude: ['semver', 'memfs@4.56.2'],
58
+ minimumReleaseAgeExclude: [
59
+ '@all-star/*',
60
+ '@best-shot/*',
61
+ '@into-mini/*',
62
+ '@nice-move/*',
63
+ ],
64
+ allowBuilds: {
65
+ '@parcel/watcher': false,
66
+ 'core-js': false,
67
+ 'core-js-pure': false,
68
+ esbuild: false,
69
+ less: false,
70
+ ssh2: false,
71
+ 'vue-demi': false,
72
+ 'cpu-features': false,
73
+ },
74
+ updateConfig: {
75
+ ignoreDependencies: [
76
+ 'tailwindcss',
77
+ 'stylelint',
78
+ 'react',
79
+ 'react-dom',
80
+ 'react-router',
81
+ ],
82
+ },
31
83
  });
32
-
33
- config.strictPeerDependencies ??= true;
34
-
35
- config.allowBuilds ??= {};
36
-
37
- config.allowBuilds['@parcel/watcher'] ??= false;
38
- config.allowBuilds['core-js'] ??= false;
39
- config.allowBuilds['core-js-pure'] ??= false;
40
- config.allowBuilds.esbuild ??= false;
41
- config.allowBuilds.less ??= false;
42
-
43
- config.minimumReleaseAgeExclude ??= [];
44
-
45
- for (const item of minimumReleaseAgeExclude) {
46
- if (!config.minimumReleaseAgeExclude.includes(item)) {
47
- config.minimumReleaseAgeExclude.push(item);
48
- }
49
- }
50
-
51
- config.trustPolicyExclude ??= [];
52
-
53
- for (const item of trustPolicyExclude) {
54
- if (!config.trustPolicyExclude.includes(item)) {
55
- config.trustPolicyExclude.push(item);
56
- }
57
- }
58
-
59
- return config;
60
84
  },
61
85
  },
62
86
  };