ic-mops 2.12.1 → 2.12.2

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
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## Next
4
4
 
5
+ ## 2.12.2
6
+ - Fix `mops install` (and any `--lock check` flow) failing with "Mismatched number of resolved packages" when a project's resolved dependencies include multiple aliases (e.g. `base`, `base@0`, `base@0.16`) that pin to the same `name@version`
7
+
5
8
  ## 2.12.1
6
9
  - `mops check`/`build`/`check-stable` skip migration staging when only the pending `next` migration is needed, so `moc` diagnostics reference the real `next-migration/<file>` path.
7
10
 
package/bundle/cli.tgz CHANGED
Binary file
package/dist/integrity.js CHANGED
@@ -31,7 +31,8 @@ async function getResolvedMopsPackageIds() {
31
31
  let packageIds = Object.entries(resolvedPackages)
32
32
  .filter(([_, version]) => getDependencyType(version) === "mops")
33
33
  .map(([name, version]) => getPackageId(name, version));
34
- return packageIds;
34
+ // dedupe: aliases like `base@0`, `base@0.16` collapse to the same packageId
35
+ return [...new Set(packageIds)];
35
36
  }
36
37
  // get hash of local file from '.mops' dir by fileId
37
38
  export function getLocalFileHash(fileId) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "2.12.1",
3
+ "version": "2.12.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "bin/mops.js",
@@ -67,4 +67,23 @@ describe("install", () => {
67
67
  });
68
68
  // mops add/remove/update/sync are not separately tested here because they
69
69
  // all route through the same checkIntegrity code path tested above.
70
+ // Regression: aliases pinning the same package@version (e.g. `core` and
71
+ // `core@1` both at "1.0.0") inflated the resolved-packageIds count and
72
+ // tripped the lockfile integrity check with a spurious
73
+ // "Mismatched number of resolved packages" error. See issue #506.
74
+ test("integrity check passes when aliases resolve to the same package@version", async () => {
75
+ const cwd = path.join(import.meta.dirname, "install/aliases");
76
+ const lockFile = path.join(cwd, "mops.lock");
77
+ rmSync(lockFile, { force: true });
78
+ try {
79
+ const result = await cli(["install"], { cwd, env: { CI: undefined } });
80
+ expect(result.stderr).not.toMatch(/Mismatched number of resolved packages/);
81
+ expect(result.exitCode).toBe(0);
82
+ expect(existsSync(lockFile)).toBe(true);
83
+ }
84
+ finally {
85
+ rmSync(lockFile, { force: true });
86
+ rmSync(path.join(cwd, ".mops"), { recursive: true, force: true });
87
+ }
88
+ });
70
89
  });
package/integrity.ts CHANGED
@@ -63,7 +63,8 @@ async function getResolvedMopsPackageIds(): Promise<string[]> {
63
63
  let packageIds = Object.entries(resolvedPackages)
64
64
  .filter(([_, version]) => getDependencyType(version) === "mops")
65
65
  .map(([name, version]) => getPackageId(name, version));
66
- return packageIds;
66
+ // dedupe: aliases like `base@0`, `base@0.16` collapse to the same packageId
67
+ return [...new Set(packageIds)];
67
68
  }
68
69
 
69
70
  // get hash of local file from '.mops' dir by fileId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "2.12.1",
3
+ "version": "2.12.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",
package/tests/cli.test.ts CHANGED
@@ -71,4 +71,25 @@ describe("install", () => {
71
71
 
72
72
  // mops add/remove/update/sync are not separately tested here because they
73
73
  // all route through the same checkIntegrity code path tested above.
74
+
75
+ // Regression: aliases pinning the same package@version (e.g. `core` and
76
+ // `core@1` both at "1.0.0") inflated the resolved-packageIds count and
77
+ // tripped the lockfile integrity check with a spurious
78
+ // "Mismatched number of resolved packages" error. See issue #506.
79
+ test("integrity check passes when aliases resolve to the same package@version", async () => {
80
+ const cwd = path.join(import.meta.dirname, "install/aliases");
81
+ const lockFile = path.join(cwd, "mops.lock");
82
+ rmSync(lockFile, { force: true });
83
+ try {
84
+ const result = await cli(["install"], { cwd, env: { CI: undefined } });
85
+ expect(result.stderr).not.toMatch(
86
+ /Mismatched number of resolved packages/,
87
+ );
88
+ expect(result.exitCode).toBe(0);
89
+ expect(existsSync(lockFile)).toBe(true);
90
+ } finally {
91
+ rmSync(lockFile, { force: true });
92
+ rmSync(path.join(cwd, ".mops"), { recursive: true, force: true });
93
+ }
94
+ });
74
95
  });
@@ -0,0 +1,3 @@
1
+ [dependencies]
2
+ core = "1.0.0"
3
+ "core@1" = "1.0.0"