ic-mops 2.5.0 → 2.6.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 (80) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/api/network.ts +1 -1
  3. package/bun.lock +1082 -78
  4. package/bundle/cli.tgz +0 -0
  5. package/cli.ts +1 -1
  6. package/commands/add.ts +4 -1
  7. package/commands/build.ts +7 -12
  8. package/commands/check.ts +20 -2
  9. package/commands/docs-coverage.ts +26 -21
  10. package/commands/install/install-dep.ts +5 -3
  11. package/commands/lint.ts +107 -10
  12. package/commands/publish.ts +24 -11
  13. package/commands/remove.ts +5 -2
  14. package/commands/self.ts +1 -1
  15. package/commands/sources.ts +3 -2
  16. package/commands/sync.ts +13 -16
  17. package/commands/test/test.ts +3 -3
  18. package/commands/update.ts +13 -7
  19. package/commands/watch/error-checker.ts +3 -8
  20. package/commands/watch/warning-checker.ts +3 -8
  21. package/dist/api/network.js +1 -1
  22. package/dist/cli.js +1 -1
  23. package/dist/commands/add.js +4 -1
  24. package/dist/commands/build.js +5 -10
  25. package/dist/commands/check.js +14 -2
  26. package/dist/commands/docs-coverage.js +22 -22
  27. package/dist/commands/install/install-dep.js +3 -3
  28. package/dist/commands/lint.d.ts +3 -0
  29. package/dist/commands/lint.js +75 -10
  30. package/dist/commands/publish.js +19 -11
  31. package/dist/commands/remove.js +5 -2
  32. package/dist/commands/self.js +1 -1
  33. package/dist/commands/sources.js +3 -2
  34. package/dist/commands/sync.js +9 -14
  35. package/dist/commands/test/test.js +3 -3
  36. package/dist/commands/update.js +9 -4
  37. package/dist/commands/watch/error-checker.js +3 -8
  38. package/dist/commands/watch/warning-checker.js +3 -8
  39. package/dist/helpers/find-changelog-entry.js +1 -1
  40. package/dist/integrity.js +9 -3
  41. package/dist/mops.js +3 -0
  42. package/dist/package.json +3 -5
  43. package/dist/release-cli.js +2 -2
  44. package/dist/resolve-packages.js +4 -4
  45. package/dist/tests/build.test.js +1 -1
  46. package/dist/tests/check.test.js +24 -0
  47. package/dist/tests/helpers.js +8 -1
  48. package/dist/tests/lint.test.js +28 -2
  49. package/dist/types.d.ts +2 -0
  50. package/dist/vessel.d.ts +1 -1
  51. package/dist/vessel.js +3 -2
  52. package/helpers/find-changelog-entry.ts +3 -1
  53. package/integrity.ts +12 -3
  54. package/mops.ts +7 -0
  55. package/package.json +3 -5
  56. package/release-cli.ts +2 -2
  57. package/resolve-packages.ts +6 -4
  58. package/tests/build.test.ts +1 -1
  59. package/tests/check/with-lint-fail/NoBoolSwitch.mo +8 -0
  60. package/tests/check/with-lint-fail/lints/no-bool-switch.toml +9 -0
  61. package/tests/check/with-lint-fail/mops.toml +9 -0
  62. package/tests/check/with-lint-pass/Ok.mo +5 -0
  63. package/tests/check/with-lint-pass/lints/no-bool-switch.toml +9 -0
  64. package/tests/check/with-lint-pass/mops.toml +9 -0
  65. package/tests/check.test.ts +28 -0
  66. package/tests/helpers.ts +9 -1
  67. package/tests/lint-config-rules/extra-rules/no-bool-switch.toml +9 -0
  68. package/tests/lint-config-rules/mops.toml +5 -0
  69. package/tests/lint-config-rules/src/NoBoolSwitch.mo +8 -0
  70. package/tests/lint-extends/mops.toml +8 -0
  71. package/tests/lint-extends/my-pkg/mops.toml +3 -0
  72. package/tests/lint-extends/my-pkg/rules/no-bool-switch.toml +9 -0
  73. package/tests/lint-extends/src/NoBoolSwitch.mo +8 -0
  74. package/tests/lint-extends-all/mops.toml +8 -0
  75. package/tests/lint-extends-all/src/NoBoolSwitch.mo +8 -0
  76. package/tests/lint-extends-ignored/mops.toml +8 -0
  77. package/tests/lint-extends-ignored/src/NoBoolSwitch.mo +8 -0
  78. package/tests/lint.test.ts +32 -2
  79. package/types.ts +2 -0
  80. package/vessel.ts +5 -3
@@ -0,0 +1,8 @@
1
+ module {
2
+ public func boolSwitch(b : Bool) : Bool {
3
+ switch (b) {
4
+ case false { false };
5
+ case true { true };
6
+ };
7
+ };
8
+ };
@@ -0,0 +1,8 @@
1
+ [dependencies]
2
+ my-pkg = "../lint-extends/my-pkg"
3
+
4
+ [toolchain]
5
+ lintoko = "0.7.0"
6
+
7
+ [lint]
8
+ extends = true
@@ -0,0 +1,8 @@
1
+ module {
2
+ public func boolSwitch(b : Bool) : Bool {
3
+ switch (b) {
4
+ case false { false };
5
+ case true { true };
6
+ };
7
+ };
8
+ };
@@ -0,0 +1,8 @@
1
+ [dependencies]
2
+ my-pkg = "../lint-extends/my-pkg"
3
+
4
+ [toolchain]
5
+ lintoko = "0.7.0"
6
+
7
+ [lint]
8
+ extends = ["other-pkg"]
@@ -0,0 +1,8 @@
1
+ module {
2
+ public func boolSwitch(b : Bool) : Bool {
3
+ switch (b) {
4
+ case false { false };
5
+ case true { true };
6
+ };
7
+ };
8
+ };
@@ -1,6 +1,6 @@
1
- import { describe, test } from "@jest/globals";
1
+ import { describe, expect, test } from "@jest/globals";
2
2
  import path from "path";
3
- import { cliSnapshot } from "./helpers";
3
+ import { cli, cliSnapshot } from "./helpers";
4
4
 
5
5
  describe("lint", () => {
6
6
  test("ok", async () => {
@@ -14,4 +14,34 @@ describe("lint", () => {
14
14
  await cliSnapshot(["lint", "NoBoolSwitch", "--verbose"], { cwd }, 1);
15
15
  await cliSnapshot(["lint", "DoesNotExist"], { cwd }, 1);
16
16
  });
17
+
18
+ test("[lint] rules - additional config rules directory is used", async () => {
19
+ const cwd = path.join(import.meta.dirname, "lint-config-rules");
20
+ const result = await cli(["lint"], { cwd });
21
+ expect(result.exitCode).toBe(1);
22
+ expect(result.stderr).toMatch(/no-bool-switch/);
23
+ });
24
+
25
+ test("[lint] extends - picks up rules/ from named dependency", async () => {
26
+ const cwd = path.join(import.meta.dirname, "lint-extends");
27
+ const result = await cli(["lint"], { cwd });
28
+ expect(result.exitCode).toBe(1);
29
+ expect(result.stderr).toMatch(/no-bool-switch/);
30
+ });
31
+
32
+ test("[lint] extends true - picks up rules/ from all dependencies", async () => {
33
+ const cwd = path.join(import.meta.dirname, "lint-extends-all");
34
+ const result = await cli(["lint"], { cwd });
35
+ expect(result.exitCode).toBe(1);
36
+ expect(result.stderr).toMatch(/no-bool-switch/);
37
+ });
38
+
39
+ test("[lint] extends - dep not in extends list is ignored", async () => {
40
+ // my-pkg has rules/ but extends only lists "other-pkg" (which doesn't exist),
41
+ // so no dep rules are loaded and NoBoolSwitch.mo passes with exit 0.
42
+ const cwd = path.join(import.meta.dirname, "lint-extends-ignored");
43
+ const result = await cli(["lint"], { cwd });
44
+ expect(result.exitCode).toBe(0);
45
+ expect(result.stderr).toMatch(/not found in dependencies/);
46
+ });
17
47
  });
package/types.ts CHANGED
@@ -29,6 +29,8 @@ export type Config = {
29
29
  };
30
30
  lint?: {
31
31
  args?: string[];
32
+ rules?: string[];
33
+ extends?: string[] | true;
32
34
  };
33
35
  };
34
36
 
package/vessel.ts CHANGED
@@ -181,7 +181,7 @@ export const installFromGithub = async (
181
181
  silent = false,
182
182
  ignoreTransitive = false,
183
183
  } = {},
184
- ) => {
184
+ ): Promise<boolean> => {
185
185
  let cacheName = getGithubDepCacheName(name, repo);
186
186
  let cacheDir = getDepCacheDir(cacheName);
187
187
 
@@ -205,7 +205,7 @@ export const installFromGithub = async (
205
205
  await downloadFromGithub(repo, cacheDir, progress);
206
206
  } catch (err) {
207
207
  deleteSync([cacheDir], { force: true });
208
- process.exit(1);
208
+ return false;
209
209
  }
210
210
  }
211
211
 
@@ -216,7 +216,7 @@ export const installFromGithub = async (
216
216
  }
217
217
 
218
218
  if (ignoreTransitive) {
219
- return;
219
+ return true;
220
220
  }
221
221
 
222
222
  const config = await readVesselConfig(cacheDir, { silent });
@@ -228,4 +228,6 @@ export const installFromGithub = async (
228
228
  }
229
229
  }
230
230
  }
231
+
232
+ return true;
231
233
  };