declapract-typescript-ehmpathy 0.49.14 → 0.49.15

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 (53) hide show
  1. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/.test/assets/repo-with-hand-patch/declapract.use.yml +4 -0
  2. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/.test/assets/repo-with-hand-patch/package.json +17 -0
  3. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/.test/assets/repo-with-hand-patch/patches/left-pad@1.3.0.patch +6 -0
  4. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/.test/assets/repo-with-hand-patch/patches/pg-pool@3.14.0.patch +12 -0
  5. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/__snapshots__/pg-pool-patch.declapract.integration.test.ts.snap +147 -0
  6. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/best-practice/.declapract.readme.md +22 -0
  7. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/best-practice/package.json +5 -0
  8. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/best-practice/patches/pg-pool.patch +21 -0
  9. package/dist/.test/assets/cicd-service/declarations/practices/persist-with-rds/pg-pool-patch.declapract.integration.test.ts +884 -0
  10. package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/declapract.use.yml +4 -0
  11. package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/package.json +15 -0
  12. package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy.patch +6 -0
  13. package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy@1.39.1.patch +6 -0
  14. package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/type-fns@1.21.3.patch +6 -0
  15. package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/pnpm-lock.yaml +19 -0
  16. package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/__snapshots__/stale-patched-dependency.declapract.integration.test.ts.snap +39 -0
  17. package/dist/.test/assets/expo-fullusecase/declarations/practices/pnpm/stale-patched-dependency.declapract.integration.test.ts +53 -0
  18. package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/declapract.use.yml +4 -0
  19. package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/package.json +15 -0
  20. package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy.patch +6 -0
  21. package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy@1.39.1.patch +6 -0
  22. package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/type-fns@1.21.3.patch +6 -0
  23. package/dist/.test/assets/expo-migration/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/pnpm-lock.yaml +19 -0
  24. package/dist/.test/assets/expo-migration/declarations/practices/pnpm/__snapshots__/stale-patched-dependency.declapract.integration.test.ts.snap +39 -0
  25. package/dist/.test/assets/expo-migration/declarations/practices/pnpm/stale-patched-dependency.declapract.integration.test.ts +53 -0
  26. package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/declapract.use.yml +4 -0
  27. package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/package.json +15 -0
  28. package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy.patch +6 -0
  29. package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy@1.39.1.patch +6 -0
  30. package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/type-fns@1.21.3.patch +6 -0
  31. package/dist/.test/assets/pnpm/declarations/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/pnpm-lock.yaml +19 -0
  32. package/dist/.test/assets/pnpm/declarations/practices/pnpm/__snapshots__/stale-patched-dependency.declapract.integration.test.ts.snap +39 -0
  33. package/dist/.test/assets/pnpm/declarations/practices/pnpm/stale-patched-dependency.declapract.integration.test.ts +53 -0
  34. package/dist/__snapshots__/typecheckBestPracticeTemplates.declapract.integration.test.ts.snap +80 -0
  35. package/dist/practices/persist-with-rds/.test/assets/repo-with-hand-patch/declapract.use.yml +4 -0
  36. package/dist/practices/persist-with-rds/.test/assets/repo-with-hand-patch/package.json +17 -0
  37. package/dist/practices/persist-with-rds/.test/assets/repo-with-hand-patch/patches/left-pad@1.3.0.patch +6 -0
  38. package/dist/practices/persist-with-rds/.test/assets/repo-with-hand-patch/patches/pg-pool@3.14.0.patch +12 -0
  39. package/dist/practices/persist-with-rds/__snapshots__/pg-pool-patch.declapract.integration.test.ts.snap +147 -0
  40. package/dist/practices/persist-with-rds/best-practice/.declapract.readme.md +22 -0
  41. package/dist/practices/persist-with-rds/best-practice/package.json +5 -0
  42. package/dist/practices/persist-with-rds/best-practice/patches/pg-pool.patch +21 -0
  43. package/dist/practices/persist-with-rds/pg-pool-patch.declapract.integration.test.ts +884 -0
  44. package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/declapract.use.yml +4 -0
  45. package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/package.json +15 -0
  46. package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy.patch +6 -0
  47. package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/rhachet-roles-ehmpathy@1.39.1.patch +6 -0
  48. package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/patches/type-fns@1.21.3.patch +6 -0
  49. package/dist/practices/pnpm/.test/assets/repo-stale-patch-beside-bare/pnpm-lock.yaml +19 -0
  50. package/dist/practices/pnpm/__snapshots__/stale-patched-dependency.declapract.integration.test.ts.snap +39 -0
  51. package/dist/practices/pnpm/stale-patched-dependency.declapract.integration.test.ts +53 -0
  52. package/dist/typecheckBestPracticeTemplates.declapract.integration.test.ts +181 -19
  53. package/package.json +6 -6
@@ -0,0 +1,4 @@
1
+ # .note = declarations dir is symlinked by the test to src/.test/assets/pnpm/declarations
2
+ # .why = a repo with one patch the lockfile moved past and one it still resolves (#680)
3
+ declarations: 'declarations/declapract.declare.yml'
4
+ useCase: pnpm-repo
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "repo-stale-patch-beside-bare",
3
+ "version": "1.0.0",
4
+ "packageManager": "pnpm@10.34.5",
5
+ "pnpm": {
6
+ "overrides": {
7
+ "react-refresh": "0.14.2"
8
+ },
9
+ "patchedDependencies": {
10
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
11
+ "rhachet-roles-ehmpathy@1.39.1": "patches/rhachet-roles-ehmpathy@1.39.1.patch",
12
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,19 @@
1
+ lockfileVersion: '9.0'
2
+
3
+ settings:
4
+ autoInstallPeers: true
5
+ excludeLinksFromLockfile: false
6
+
7
+ packages:
8
+
9
+ rhachet-roles-ehmpathy@1.40.0:
10
+ resolution: {integrity: sha512-a}
11
+
12
+ type-fns@1.21.3:
13
+ resolution: {integrity: sha512-b}
14
+
15
+ snapshots:
16
+
17
+ rhachet-roles-ehmpathy@1.40.0: {}
18
+
19
+ type-fns@1.21.3: {}
@@ -36,3 +36,42 @@ exports[`pnpm — a stale patch never blocks an install given: [case1] a repo wi
36
36
  }
37
37
  "
38
38
  `;
39
+
40
+ exports[`pnpm — a stale patch never blocks an install given: [case2] a repo with a bare-name patch key beside a stale exact key of the same package when: [t0] the pnpm practice is applied then: the before + after contents match snapshot: package.json — after 1`] = `
41
+ "{
42
+ "name": "repo-stale-patch-beside-bare",
43
+ "version": "1.0.0",
44
+ "packageManager": "pnpm@10.34.5",
45
+ "pnpm": {
46
+ "overrides": {
47
+ "react-refresh": "0.14.2"
48
+ },
49
+ "patchedDependencies": {
50
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
51
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
52
+ },
53
+ "allowUnusedPatches": true,
54
+ "ignorePatchFailures": true
55
+ }
56
+ }
57
+ "
58
+ `;
59
+
60
+ exports[`pnpm — a stale patch never blocks an install given: [case2] a repo with a bare-name patch key beside a stale exact key of the same package when: [t0] the pnpm practice is applied then: the before + after contents match snapshot: package.json — before 1`] = `
61
+ "{
62
+ "name": "repo-stale-patch-beside-bare",
63
+ "version": "1.0.0",
64
+ "packageManager": "pnpm@10.34.5",
65
+ "pnpm": {
66
+ "overrides": {
67
+ "react-refresh": "0.14.2"
68
+ },
69
+ "patchedDependencies": {
70
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
71
+ "rhachet-roles-ehmpathy@1.39.1": "patches/rhachet-roles-ehmpathy@1.39.1.patch",
72
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
73
+ }
74
+ }
75
+ }
76
+ "
77
+ `;
@@ -79,4 +79,57 @@ describe('pnpm — a stale patch never blocks an install', () => {
79
79
  });
80
80
  });
81
81
  });
82
+
83
+ given('[case2] a repo with a bare-name patch key beside a stale exact key of the same package', () => {
84
+ // the shape persist-with-rds ships for pg-pool: a bare key, which no lockfile can move past
85
+ const tempDir = genTempRepoWithDeclarationsOutside({
86
+ slug: 'pnpm-stale-patch-beside-bare',
87
+ clone: './src/practices/pnpm/.test/assets/repo-stale-patch-beside-bare',
88
+ declarations: './src/.test/assets/pnpm/declarations',
89
+ symlink: [{ at: 'node_modules', to: 'node_modules' }],
90
+ });
91
+ const stalePatch = 'patches/rhachet-roles-ehmpathy@1.39.1.patch';
92
+ const barePatch = 'patches/rhachet-roles-ehmpathy.patch';
93
+
94
+ const state = useBeforeAll(async () => {
95
+ const config = path.join(tempDir, 'declapract.use.yml');
96
+ const read = () =>
97
+ fs.readFile(path.join(tempDir, 'package.json'), 'utf-8');
98
+ const before = await read();
99
+ await executeApply({ config });
100
+ const after1 = await read();
101
+ const exists1 = {
102
+ stale: existsSync(path.join(tempDir, stalePatch)),
103
+ bare: existsSync(path.join(tempDir, barePatch)),
104
+ };
105
+ await executeApply({ config });
106
+ const after2 = await read();
107
+ return { before, after1, after2, exists1 };
108
+ }, 170_000);
109
+
110
+ when('[t0] the pnpm practice is applied', () => {
111
+ then('the stale exact key is retired; the bare-name key is kept', () => {
112
+ const patched = JSON.parse(state.after1).pnpm.patchedDependencies;
113
+ expect(patched).toEqual({
114
+ 'rhachet-roles-ehmpathy': barePatch,
115
+ 'type-fns@1.21.3': 'patches/type-fns@1.21.3.patch',
116
+ });
117
+ });
118
+
119
+ then('the stale patch file is deleted; the bare-name file is kept', () => {
120
+ expect(state.exists1).toEqual({ stale: false, bare: true });
121
+ });
122
+
123
+ then('the before + after contents match snapshot', () => {
124
+ expect(state.before).toMatchSnapshot('package.json — before');
125
+ expect(state.after1).toMatchSnapshot('package.json — after');
126
+ });
127
+ });
128
+
129
+ when('[t1] the practice is applied a second time', () => {
130
+ then('the second apply is a no-op', () => {
131
+ expect(state.after2).toEqual(state.after1);
132
+ });
133
+ });
134
+ });
82
135
  });
@@ -0,0 +1,4 @@
1
+ # .note = declarations dir is symlinked by the test to src/.test/assets/pnpm/declarations
2
+ # .why = a repo with one patch the lockfile moved past and one it still resolves (#680)
3
+ declarations: 'declarations/declapract.declare.yml'
4
+ useCase: pnpm-repo
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "repo-stale-patch-beside-bare",
3
+ "version": "1.0.0",
4
+ "packageManager": "pnpm@10.34.5",
5
+ "pnpm": {
6
+ "overrides": {
7
+ "react-refresh": "0.14.2"
8
+ },
9
+ "patchedDependencies": {
10
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
11
+ "rhachet-roles-ehmpathy@1.39.1": "patches/rhachet-roles-ehmpathy@1.39.1.patch",
12
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,19 @@
1
+ lockfileVersion: '9.0'
2
+
3
+ settings:
4
+ autoInstallPeers: true
5
+ excludeLinksFromLockfile: false
6
+
7
+ packages:
8
+
9
+ rhachet-roles-ehmpathy@1.40.0:
10
+ resolution: {integrity: sha512-a}
11
+
12
+ type-fns@1.21.3:
13
+ resolution: {integrity: sha512-b}
14
+
15
+ snapshots:
16
+
17
+ rhachet-roles-ehmpathy@1.40.0: {}
18
+
19
+ type-fns@1.21.3: {}
@@ -36,3 +36,42 @@ exports[`pnpm — a stale patch never blocks an install given: [case1] a repo wi
36
36
  }
37
37
  "
38
38
  `;
39
+
40
+ exports[`pnpm — a stale patch never blocks an install given: [case2] a repo with a bare-name patch key beside a stale exact key of the same package when: [t0] the pnpm practice is applied then: the before + after contents match snapshot: package.json — after 1`] = `
41
+ "{
42
+ "name": "repo-stale-patch-beside-bare",
43
+ "version": "1.0.0",
44
+ "packageManager": "pnpm@10.34.5",
45
+ "pnpm": {
46
+ "overrides": {
47
+ "react-refresh": "0.14.2"
48
+ },
49
+ "patchedDependencies": {
50
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
51
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
52
+ },
53
+ "allowUnusedPatches": true,
54
+ "ignorePatchFailures": true
55
+ }
56
+ }
57
+ "
58
+ `;
59
+
60
+ exports[`pnpm — a stale patch never blocks an install given: [case2] a repo with a bare-name patch key beside a stale exact key of the same package when: [t0] the pnpm practice is applied then: the before + after contents match snapshot: package.json — before 1`] = `
61
+ "{
62
+ "name": "repo-stale-patch-beside-bare",
63
+ "version": "1.0.0",
64
+ "packageManager": "pnpm@10.34.5",
65
+ "pnpm": {
66
+ "overrides": {
67
+ "react-refresh": "0.14.2"
68
+ },
69
+ "patchedDependencies": {
70
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
71
+ "rhachet-roles-ehmpathy@1.39.1": "patches/rhachet-roles-ehmpathy@1.39.1.patch",
72
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
73
+ }
74
+ }
75
+ }
76
+ "
77
+ `;
@@ -79,4 +79,57 @@ describe('pnpm — a stale patch never blocks an install', () => {
79
79
  });
80
80
  });
81
81
  });
82
+
83
+ given('[case2] a repo with a bare-name patch key beside a stale exact key of the same package', () => {
84
+ // the shape persist-with-rds ships for pg-pool: a bare key, which no lockfile can move past
85
+ const tempDir = genTempRepoWithDeclarationsOutside({
86
+ slug: 'pnpm-stale-patch-beside-bare',
87
+ clone: './src/practices/pnpm/.test/assets/repo-stale-patch-beside-bare',
88
+ declarations: './src/.test/assets/pnpm/declarations',
89
+ symlink: [{ at: 'node_modules', to: 'node_modules' }],
90
+ });
91
+ const stalePatch = 'patches/rhachet-roles-ehmpathy@1.39.1.patch';
92
+ const barePatch = 'patches/rhachet-roles-ehmpathy.patch';
93
+
94
+ const state = useBeforeAll(async () => {
95
+ const config = path.join(tempDir, 'declapract.use.yml');
96
+ const read = () =>
97
+ fs.readFile(path.join(tempDir, 'package.json'), 'utf-8');
98
+ const before = await read();
99
+ await executeApply({ config });
100
+ const after1 = await read();
101
+ const exists1 = {
102
+ stale: existsSync(path.join(tempDir, stalePatch)),
103
+ bare: existsSync(path.join(tempDir, barePatch)),
104
+ };
105
+ await executeApply({ config });
106
+ const after2 = await read();
107
+ return { before, after1, after2, exists1 };
108
+ }, 170_000);
109
+
110
+ when('[t0] the pnpm practice is applied', () => {
111
+ then('the stale exact key is retired; the bare-name key is kept', () => {
112
+ const patched = JSON.parse(state.after1).pnpm.patchedDependencies;
113
+ expect(patched).toEqual({
114
+ 'rhachet-roles-ehmpathy': barePatch,
115
+ 'type-fns@1.21.3': 'patches/type-fns@1.21.3.patch',
116
+ });
117
+ });
118
+
119
+ then('the stale patch file is deleted; the bare-name file is kept', () => {
120
+ expect(state.exists1).toEqual({ stale: false, bare: true });
121
+ });
122
+
123
+ then('the before + after contents match snapshot', () => {
124
+ expect(state.before).toMatchSnapshot('package.json — before');
125
+ expect(state.after1).toMatchSnapshot('package.json — after');
126
+ });
127
+ });
128
+
129
+ when('[t1] the practice is applied a second time', () => {
130
+ then('the second apply is a no-op', () => {
131
+ expect(state.after2).toEqual(state.after1);
132
+ });
133
+ });
134
+ });
82
135
  });
@@ -0,0 +1,4 @@
1
+ # .note = declarations dir is symlinked by the test to src/.test/assets/pnpm/declarations
2
+ # .why = a repo with one patch the lockfile moved past and one it still resolves (#680)
3
+ declarations: 'declarations/declapract.declare.yml'
4
+ useCase: pnpm-repo
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "repo-stale-patch-beside-bare",
3
+ "version": "1.0.0",
4
+ "packageManager": "pnpm@10.34.5",
5
+ "pnpm": {
6
+ "overrides": {
7
+ "react-refresh": "0.14.2"
8
+ },
9
+ "patchedDependencies": {
10
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
11
+ "rhachet-roles-ehmpathy@1.39.1": "patches/rhachet-roles-ehmpathy@1.39.1.patch",
12
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
13
+ }
14
+ }
15
+ }
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,6 @@
1
+ diff --git a/dist/index.js b/dist/index.js
2
+ --- a/dist/index.js
3
+ +++ b/dist/index.js
4
+ @@ -1 +1 @@
5
+ -module.exports = {};
6
+ +module.exports = { patched: true };
@@ -0,0 +1,19 @@
1
+ lockfileVersion: '9.0'
2
+
3
+ settings:
4
+ autoInstallPeers: true
5
+ excludeLinksFromLockfile: false
6
+
7
+ packages:
8
+
9
+ rhachet-roles-ehmpathy@1.40.0:
10
+ resolution: {integrity: sha512-a}
11
+
12
+ type-fns@1.21.3:
13
+ resolution: {integrity: sha512-b}
14
+
15
+ snapshots:
16
+
17
+ rhachet-roles-ehmpathy@1.40.0: {}
18
+
19
+ type-fns@1.21.3: {}
@@ -36,3 +36,42 @@ exports[`pnpm — a stale patch never blocks an install given: [case1] a repo wi
36
36
  }
37
37
  "
38
38
  `;
39
+
40
+ exports[`pnpm — a stale patch never blocks an install given: [case2] a repo with a bare-name patch key beside a stale exact key of the same package when: [t0] the pnpm practice is applied then: the before + after contents match snapshot: package.json — after 1`] = `
41
+ "{
42
+ "name": "repo-stale-patch-beside-bare",
43
+ "version": "1.0.0",
44
+ "packageManager": "pnpm@10.34.5",
45
+ "pnpm": {
46
+ "overrides": {
47
+ "react-refresh": "0.14.2"
48
+ },
49
+ "patchedDependencies": {
50
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
51
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
52
+ },
53
+ "allowUnusedPatches": true,
54
+ "ignorePatchFailures": true
55
+ }
56
+ }
57
+ "
58
+ `;
59
+
60
+ exports[`pnpm — a stale patch never blocks an install given: [case2] a repo with a bare-name patch key beside a stale exact key of the same package when: [t0] the pnpm practice is applied then: the before + after contents match snapshot: package.json — before 1`] = `
61
+ "{
62
+ "name": "repo-stale-patch-beside-bare",
63
+ "version": "1.0.0",
64
+ "packageManager": "pnpm@10.34.5",
65
+ "pnpm": {
66
+ "overrides": {
67
+ "react-refresh": "0.14.2"
68
+ },
69
+ "patchedDependencies": {
70
+ "rhachet-roles-ehmpathy": "patches/rhachet-roles-ehmpathy.patch",
71
+ "rhachet-roles-ehmpathy@1.39.1": "patches/rhachet-roles-ehmpathy@1.39.1.patch",
72
+ "type-fns@1.21.3": "patches/type-fns@1.21.3.patch"
73
+ }
74
+ }
75
+ }
76
+ "
77
+ `;
@@ -79,4 +79,57 @@ describe('pnpm — a stale patch never blocks an install', () => {
79
79
  });
80
80
  });
81
81
  });
82
+
83
+ given('[case2] a repo with a bare-name patch key beside a stale exact key of the same package', () => {
84
+ // the shape persist-with-rds ships for pg-pool: a bare key, which no lockfile can move past
85
+ const tempDir = genTempRepoWithDeclarationsOutside({
86
+ slug: 'pnpm-stale-patch-beside-bare',
87
+ clone: './src/practices/pnpm/.test/assets/repo-stale-patch-beside-bare',
88
+ declarations: './src/.test/assets/pnpm/declarations',
89
+ symlink: [{ at: 'node_modules', to: 'node_modules' }],
90
+ });
91
+ const stalePatch = 'patches/rhachet-roles-ehmpathy@1.39.1.patch';
92
+ const barePatch = 'patches/rhachet-roles-ehmpathy.patch';
93
+
94
+ const state = useBeforeAll(async () => {
95
+ const config = path.join(tempDir, 'declapract.use.yml');
96
+ const read = () =>
97
+ fs.readFile(path.join(tempDir, 'package.json'), 'utf-8');
98
+ const before = await read();
99
+ await executeApply({ config });
100
+ const after1 = await read();
101
+ const exists1 = {
102
+ stale: existsSync(path.join(tempDir, stalePatch)),
103
+ bare: existsSync(path.join(tempDir, barePatch)),
104
+ };
105
+ await executeApply({ config });
106
+ const after2 = await read();
107
+ return { before, after1, after2, exists1 };
108
+ }, 170_000);
109
+
110
+ when('[t0] the pnpm practice is applied', () => {
111
+ then('the stale exact key is retired; the bare-name key is kept', () => {
112
+ const patched = JSON.parse(state.after1).pnpm.patchedDependencies;
113
+ expect(patched).toEqual({
114
+ 'rhachet-roles-ehmpathy': barePatch,
115
+ 'type-fns@1.21.3': 'patches/type-fns@1.21.3.patch',
116
+ });
117
+ });
118
+
119
+ then('the stale patch file is deleted; the bare-name file is kept', () => {
120
+ expect(state.exists1).toEqual({ stale: false, bare: true });
121
+ });
122
+
123
+ then('the before + after contents match snapshot', () => {
124
+ expect(state.before).toMatchSnapshot('package.json — before');
125
+ expect(state.after1).toMatchSnapshot('package.json — after');
126
+ });
127
+ });
128
+
129
+ when('[t1] the practice is applied a second time', () => {
130
+ then('the second apply is a no-op', () => {
131
+ expect(state.after2).toEqual(state.after1);
132
+ });
133
+ });
134
+ });
82
135
  });
@@ -14,6 +14,14 @@ exports[`typecheck best-practice templates given: [usecase] app-react-native-exp
14
14
  ]
15
15
  `;
16
16
 
17
+ exports[`typecheck best-practice templates given: [usecase] app-react-native-expo applied to a bare repo when: [t3] the emitted cycle check runs, as \`npm run test:lint\` does then: the exit status and the cycles it finds match snapshot: app-react-native-expo — test:lint:cycles summary 1`] = `
18
+ {
19
+ "analyzed": false,
20
+ "cycles": [],
21
+ "status": 1,
22
+ }
23
+ `;
24
+
17
25
  exports[`typecheck best-practice templates given: [usecase] lambda-service applied to a bare repo when: [t1] the emitted tree is compiled with the emitted tsconfig then: the tsc diagnostics match snapshot: lambda-service — tsc --noEmit diagnostics 1`] = `""`;
18
26
 
19
27
  exports[`typecheck best-practice templates given: [usecase] lambda-service applied to a bare repo when: [t2] the twice-applied repo is planned again then: the files left for a human to author match snapshot: lambda-service — files flagged for a human 1`] = `
@@ -28,6 +36,22 @@ exports[`typecheck best-practice templates given: [usecase] lambda-service appli
28
36
  ]
29
37
  `;
30
38
 
39
+ exports[`typecheck best-practice templates given: [usecase] lambda-service applied to a bare repo when: [t3] the emitted cycle check runs, as \`npm run test:lint\` does then: the exit status and the cycles it finds match snapshot: lambda-service — test:lint:cycles summary 1`] = `
40
+ {
41
+ "analyzed": true,
42
+ "cycles": [
43
+ "bottleneck -> bottleneck",
44
+ "domain-objects -> domain-objects",
45
+ "domain-objects -> domain-objects -> domain-objects",
46
+ "helpful-errors -> helpful-errors",
47
+ "util -> inherits",
48
+ "with-simple-cache -> with-simple-cache",
49
+ "with-simple-cache -> with-simple-cache -> with-simple-cache -> with-simple-cache",
50
+ ],
51
+ "status": 1,
52
+ }
53
+ `;
54
+
31
55
  exports[`typecheck best-practice templates given: [usecase] lambda-service-with-dynamodb applied to a bare repo when: [t1] the emitted tree is compiled with the emitted tsconfig then: the tsc diagnostics match snapshot: lambda-service-with-dynamodb — tsc --noEmit diagnostics 1`] = `""`;
32
56
 
33
57
  exports[`typecheck best-practice templates given: [usecase] lambda-service-with-dynamodb applied to a bare repo when: [t2] the twice-applied repo is planned again then: the files left for a human to author match snapshot: lambda-service-with-dynamodb — files flagged for a human 1`] = `
@@ -42,6 +66,22 @@ exports[`typecheck best-practice templates given: [usecase] lambda-service-with-
42
66
  ]
43
67
  `;
44
68
 
69
+ exports[`typecheck best-practice templates given: [usecase] lambda-service-with-dynamodb applied to a bare repo when: [t3] the emitted cycle check runs, as \`npm run test:lint\` does then: the exit status and the cycles it finds match snapshot: lambda-service-with-dynamodb — test:lint:cycles summary 1`] = `
70
+ {
71
+ "analyzed": true,
72
+ "cycles": [
73
+ "bottleneck -> bottleneck",
74
+ "domain-objects -> domain-objects",
75
+ "domain-objects -> domain-objects -> domain-objects",
76
+ "helpful-errors -> helpful-errors",
77
+ "util -> inherits",
78
+ "with-simple-cache -> with-simple-cache",
79
+ "with-simple-cache -> with-simple-cache -> with-simple-cache -> with-simple-cache",
80
+ ],
81
+ "status": 1,
82
+ }
83
+ `;
84
+
45
85
  exports[`typecheck best-practice templates given: [usecase] lambda-service-with-rds applied to a bare repo when: [t1] the emitted tree is compiled with the emitted tsconfig then: the tsc diagnostics match snapshot: lambda-service-with-rds — tsc --noEmit diagnostics 1`] = `""`;
46
86
 
47
87
  exports[`typecheck best-practice templates given: [usecase] lambda-service-with-rds applied to a bare repo when: [t2] the twice-applied repo is planned again then: the files left for a human to author match snapshot: lambda-service-with-rds — files flagged for a human 1`] = `
@@ -56,6 +96,22 @@ exports[`typecheck best-practice templates given: [usecase] lambda-service-with-
56
96
  ]
57
97
  `;
58
98
 
99
+ exports[`typecheck best-practice templates given: [usecase] lambda-service-with-rds applied to a bare repo when: [t3] the emitted cycle check runs, as \`npm run test:lint\` does then: the exit status and the cycles it finds match snapshot: lambda-service-with-rds — test:lint:cycles summary 1`] = `
100
+ {
101
+ "analyzed": true,
102
+ "cycles": [
103
+ "bottleneck -> bottleneck",
104
+ "domain-objects -> domain-objects",
105
+ "domain-objects -> domain-objects -> domain-objects",
106
+ "helpful-errors -> helpful-errors",
107
+ "util -> inherits",
108
+ "with-simple-cache -> with-simple-cache",
109
+ "with-simple-cache -> with-simple-cache -> with-simple-cache -> with-simple-cache",
110
+ ],
111
+ "status": 1,
112
+ }
113
+ `;
114
+
59
115
  exports[`typecheck best-practice templates given: [usecase] npm-package applied to a bare repo when: [t1] the emitted tree is compiled with the emitted tsconfig then: the tsc diagnostics match snapshot: npm-package — tsc --noEmit diagnostics 1`] = `""`;
60
116
 
61
117
  exports[`typecheck best-practice templates given: [usecase] npm-package applied to a bare repo when: [t2] the twice-applied repo is planned again then: the files left for a human to author match snapshot: npm-package — files flagged for a human 1`] = `
@@ -69,6 +125,14 @@ exports[`typecheck best-practice templates given: [usecase] npm-package applied
69
125
  ]
70
126
  `;
71
127
 
128
+ exports[`typecheck best-practice templates given: [usecase] npm-package applied to a bare repo when: [t3] the emitted cycle check runs, as \`npm run test:lint\` does then: the exit status and the cycles it finds match snapshot: npm-package — test:lint:cycles summary 1`] = `
129
+ {
130
+ "analyzed": false,
131
+ "cycles": [],
132
+ "status": 1,
133
+ }
134
+ `;
135
+
72
136
  exports[`typecheck best-practice templates given: [usecase] rhachet-roles-package applied to a bare repo when: [t1] the emitted tree is compiled with the emitted tsconfig then: the tsc diagnostics match snapshot: rhachet-roles-package — tsc --noEmit diagnostics 1`] = `""`;
73
137
 
74
138
  exports[`typecheck best-practice templates given: [usecase] rhachet-roles-package applied to a bare repo when: [t2] the twice-applied repo is planned again then: the files left for a human to author match snapshot: rhachet-roles-package — files flagged for a human 1`] = `
@@ -82,6 +146,14 @@ exports[`typecheck best-practice templates given: [usecase] rhachet-roles-packag
82
146
  ]
83
147
  `;
84
148
 
149
+ exports[`typecheck best-practice templates given: [usecase] rhachet-roles-package applied to a bare repo when: [t3] the emitted cycle check runs, as \`npm run test:lint\` does then: the exit status and the cycles it finds match snapshot: rhachet-roles-package — test:lint:cycles summary 1`] = `
150
+ {
151
+ "analyzed": false,
152
+ "cycles": [],
153
+ "status": 1,
154
+ }
155
+ `;
156
+
85
157
  exports[`typecheck best-practice templates given: [usecase] typescript-project applied to a bare repo when: [t1] the emitted tree is compiled with the emitted tsconfig then: the tsc diagnostics match snapshot: typescript-project — tsc --noEmit diagnostics 1`] = `""`;
86
158
 
87
159
  exports[`typecheck best-practice templates given: [usecase] typescript-project applied to a bare repo when: [t2] the twice-applied repo is planned again then: the files left for a human to author match snapshot: typescript-project — files flagged for a human 1`] = `
@@ -94,3 +166,11 @@ exports[`typecheck best-practice templates given: [usecase] typescript-project a
94
166
  "src/domain.operations/**/*.ts",
95
167
  ]
96
168
  `;
169
+
170
+ exports[`typecheck best-practice templates given: [usecase] typescript-project applied to a bare repo when: [t3] the emitted cycle check runs, as \`npm run test:lint\` does then: the exit status and the cycles it finds match snapshot: typescript-project — test:lint:cycles summary 1`] = `
171
+ {
172
+ "analyzed": false,
173
+ "cycles": [],
174
+ "status": 1,
175
+ }
176
+ `;
@@ -0,0 +1,4 @@
1
+ # .note = the test writes declarations/ into the temp clone (genDeclarationsOfPackageJsonOnly)
2
+ # .why = an rds repo that already holds its own exact-version pg-pool hand patch (vision case=2)
3
+ declarations: 'declarations/declapract.declare.yml'
4
+ useCase: lambda-service
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "repo-with-hand-patch",
3
+ "version": "1.0.0",
4
+ "dependencies": {
5
+ "pg": "8.3.0",
6
+ "pg-pool": "3.14.0"
7
+ },
8
+ "pnpm": {
9
+ "overrides": {
10
+ "react-refresh": "0.14.2"
11
+ },
12
+ "patchedDependencies": {
13
+ "pg-pool@3.14.0": "patches/pg-pool@3.14.0.patch",
14
+ "left-pad@1.3.0": "patches/left-pad@1.3.0.patch"
15
+ }
16
+ }
17
+ }