ic-mops 1.12.0 → 2.0.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.
- package/.DS_Store +0 -0
- package/.eslintrc.json +7 -7
- package/CHANGELOG.md +6 -0
- package/api/actors.ts +41 -37
- package/api/downloadPackageFiles.ts +75 -61
- package/api/getHighestVersion.ts +5 -5
- package/api/index.ts +4 -4
- package/api/network.ts +19 -21
- package/api/resolveVersion.ts +14 -11
- package/bin/mops.js +1 -1
- package/bundle/bench/bench-canister.mo +109 -101
- package/bundle/bench/user-bench.mo +6 -6
- package/bundle/bin/mops.js +1 -1
- package/bundle/cli.js +797 -792
- package/bundle/cli.tgz +0 -0
- package/bundle/package.json +6 -5
- package/bundle/templates/mops-publish.yml +3 -3
- package/bundle/templates/mops-test.yml +3 -3
- package/bundle/templates/src/lib.mo +13 -13
- package/bundle/templates/test/lib.test.mo +2 -2
- package/bundle-package-json.ts +8 -8
- package/cache.ts +80 -65
- package/check-requirements.ts +49 -45
- package/cli.ts +577 -376
- package/commands/add.ts +142 -129
- package/commands/available-updates.ts +55 -41
- package/commands/bench/bench-canister.mo +114 -108
- package/commands/bench/user-bench.mo +6 -6
- package/commands/bench-replica.ts +146 -118
- package/commands/bench.ts +563 -497
- package/commands/build.ts +177 -0
- package/commands/bump.ts +68 -57
- package/commands/check-candid.ts +24 -0
- package/commands/docs-coverage.ts +124 -102
- package/commands/docs.ts +118 -108
- package/commands/format.ts +171 -155
- package/commands/init.ts +301 -275
- package/commands/install/install-all.ts +75 -62
- package/commands/install/install-dep.ts +43 -28
- package/commands/install/install-deps.ts +23 -15
- package/commands/install/install-local-dep.ts +42 -34
- package/commands/install/install-mops-dep.ts +154 -123
- package/commands/install/sync-local-cache.ts +39 -35
- package/commands/maintainer.ts +109 -99
- package/commands/outdated.ts +30 -24
- package/commands/owner.ts +107 -99
- package/commands/publish.ts +534 -443
- package/commands/remove.ts +119 -89
- package/commands/replica.ts +391 -316
- package/commands/search.ts +42 -36
- package/commands/self.ts +63 -56
- package/commands/sources.ts +66 -49
- package/commands/sync.ts +92 -75
- package/commands/template.ts +145 -102
- package/commands/test/mmf1.ts +146 -119
- package/commands/test/reporters/compact-reporter.ts +87 -84
- package/commands/test/reporters/files-reporter.ts +56 -51
- package/commands/test/reporters/reporter.ts +12 -6
- package/commands/test/reporters/silent-reporter.ts +58 -59
- package/commands/test/reporters/verbose-reporter.ts +66 -54
- package/commands/test/test.ts +498 -401
- package/commands/test/utils.ts +72 -67
- package/commands/toolchain/index.ts +363 -322
- package/commands/toolchain/moc.ts +78 -50
- package/commands/toolchain/pocket-ic.ts +41 -34
- package/commands/toolchain/toolchain-utils.ts +92 -72
- package/commands/toolchain/wasmtime.ts +37 -34
- package/commands/update.ts +82 -64
- package/commands/user.ts +90 -81
- package/commands/watch/deployer.ts +188 -152
- package/commands/watch/error-checker.ts +90 -80
- package/commands/watch/formatter.ts +72 -60
- package/commands/watch/generator.ts +116 -96
- package/commands/watch/globMoFiles.ts +13 -13
- package/commands/watch/parseDfxJson.ts +63 -57
- package/commands/watch/tester.ts +83 -65
- package/commands/watch/warning-checker.ts +149 -136
- package/commands/watch/watch.ts +123 -95
- package/dist/api/actors.d.ts +4 -4
- package/dist/api/actors.js +8 -8
- package/dist/api/downloadPackageFiles.d.ts +2 -2
- package/dist/api/downloadPackageFiles.js +10 -10
- package/dist/api/getHighestVersion.js +1 -1
- package/dist/api/index.d.ts +4 -4
- package/dist/api/index.js +4 -4
- package/dist/api/network.js +9 -9
- package/dist/api/resolveVersion.js +3 -3
- package/dist/bin/mops.js +1 -1
- package/dist/bundle-package-json.js +8 -8
- package/dist/cache.js +22 -17
- package/dist/check-requirements.js +11 -11
- package/dist/cli.js +283 -186
- package/dist/commands/add.d.ts +1 -1
- package/dist/commands/add.js +40 -37
- package/dist/commands/available-updates.d.ts +1 -1
- package/dist/commands/available-updates.js +18 -12
- package/dist/commands/bench/bench-canister.mo +114 -108
- package/dist/commands/bench/user-bench.mo +6 -6
- package/dist/commands/bench-replica.d.ts +4 -4
- package/dist/commands/bench-replica.js +45 -34
- package/dist/commands/bench.d.ts +5 -5
- package/dist/commands/bench.js +134 -118
- package/dist/commands/build.d.ts +7 -0
- package/dist/commands/build.js +121 -0
- package/dist/commands/bump.js +27 -18
- package/dist/commands/check-candid.d.ts +4 -0
- package/dist/commands/check-candid.js +15 -0
- package/dist/commands/docs-coverage.d.ts +1 -1
- package/dist/commands/docs-coverage.js +45 -31
- package/dist/commands/docs.d.ts +1 -1
- package/dist/commands/docs.js +39 -38
- package/dist/commands/format.js +31 -27
- package/dist/commands/init.js +102 -92
- package/dist/commands/install/install-all.d.ts +2 -2
- package/dist/commands/install/install-all.js +23 -21
- package/dist/commands/install/install-dep.d.ts +1 -1
- package/dist/commands/install/install-dep.js +21 -8
- package/dist/commands/install/install-deps.d.ts +1 -1
- package/dist/commands/install/install-deps.js +1 -1
- package/dist/commands/install/install-local-dep.js +11 -9
- package/dist/commands/install/install-mops-dep.d.ts +1 -1
- package/dist/commands/install/install-mops-dep.js +32 -27
- package/dist/commands/install/sync-local-cache.js +10 -10
- package/dist/commands/maintainer.js +21 -21
- package/dist/commands/outdated.js +12 -8
- package/dist/commands/owner.js +21 -21
- package/dist/commands/publish.js +148 -128
- package/dist/commands/remove.d.ts +1 -1
- package/dist/commands/remove.js +42 -30
- package/dist/commands/replica.d.ts +7 -7
- package/dist/commands/replica.js +85 -57
- package/dist/commands/search.js +15 -13
- package/dist/commands/self.js +31 -28
- package/dist/commands/sources.d.ts +5 -1
- package/dist/commands/sources.js +23 -17
- package/dist/commands/sync.d.ts +1 -1
- package/dist/commands/sync.js +38 -25
- package/dist/commands/template.js +66 -56
- package/dist/commands/test/mmf1.d.ts +3 -3
- package/dist/commands/test/mmf1.js +33 -31
- package/dist/commands/test/reporters/compact-reporter.d.ts +3 -3
- package/dist/commands/test/reporters/compact-reporter.js +19 -15
- package/dist/commands/test/reporters/files-reporter.d.ts +3 -3
- package/dist/commands/test/reporters/files-reporter.js +18 -14
- package/dist/commands/test/reporters/reporter.d.ts +2 -2
- package/dist/commands/test/reporters/silent-reporter.d.ts +3 -3
- package/dist/commands/test/reporters/silent-reporter.js +4 -4
- package/dist/commands/test/reporters/verbose-reporter.d.ts +3 -3
- package/dist/commands/test/reporters/verbose-reporter.js +17 -13
- package/dist/commands/test/test.d.ts +4 -4
- package/dist/commands/test/test.js +134 -112
- package/dist/commands/test/utils.d.ts +3 -3
- package/dist/commands/test/utils.js +17 -17
- package/dist/commands/toolchain/index.d.ts +1 -1
- package/dist/commands/toolchain/index.js +81 -69
- package/dist/commands/toolchain/moc.d.ts +1 -1
- package/dist/commands/toolchain/moc.js +48 -24
- package/dist/commands/toolchain/pocket-ic.js +12 -12
- package/dist/commands/toolchain/toolchain-utils.d.ts +2 -0
- package/dist/commands/toolchain/toolchain-utils.js +32 -23
- package/dist/commands/toolchain/wasmtime.js +11 -11
- package/dist/commands/update.d.ts +1 -1
- package/dist/commands/update.js +18 -14
- package/dist/commands/user.js +31 -28
- package/dist/commands/watch/deployer.d.ts +4 -4
- package/dist/commands/watch/deployer.js +45 -36
- package/dist/commands/watch/error-checker.d.ts +2 -2
- package/dist/commands/watch/error-checker.js +27 -27
- package/dist/commands/watch/formatter.d.ts +4 -4
- package/dist/commands/watch/formatter.js +17 -17
- package/dist/commands/watch/generator.d.ts +3 -3
- package/dist/commands/watch/generator.js +28 -23
- package/dist/commands/watch/globMoFiles.js +8 -8
- package/dist/commands/watch/parseDfxJson.d.ts +2 -2
- package/dist/commands/watch/parseDfxJson.js +9 -9
- package/dist/commands/watch/tester.d.ts +4 -4
- package/dist/commands/watch/tester.js +23 -21
- package/dist/commands/watch/warning-checker.d.ts +3 -3
- package/dist/commands/watch/warning-checker.js +36 -36
- package/dist/commands/watch/watch.js +45 -32
- package/dist/environments/nodejs/cli.d.ts +1 -0
- package/dist/environments/nodejs/cli.js +4 -0
- package/dist/environments/web/cli.d.ts +1 -0
- package/dist/environments/web/cli.js +4 -0
- package/dist/error.d.ts +1 -0
- package/dist/error.js +5 -0
- package/dist/fix-dist.js +5 -5
- package/dist/helpers/find-changelog-entry.js +8 -5
- package/dist/helpers/get-dep-name.js +2 -2
- package/dist/helpers/get-dfx-version.js +4 -4
- package/dist/helpers/get-moc-path.js +8 -7
- package/dist/helpers/get-moc-version.js +10 -7
- package/dist/helpers/get-package-id.js +2 -2
- package/dist/helpers/is-candid-compatible.d.ts +1 -0
- package/dist/helpers/is-candid-compatible.js +20 -0
- package/dist/integrity.d.ts +1 -1
- package/dist/integrity.js +47 -38
- package/dist/jest.config.d.ts +11 -0
- package/dist/jest.config.js +14 -0
- package/dist/mops.d.ts +6 -6
- package/dist/mops.js +87 -80
- package/dist/notify-installs.js +4 -4
- package/dist/package.json +9 -5
- package/dist/pem.d.ts +3 -3
- package/dist/pem.js +20 -12
- package/dist/release-cli.js +20 -20
- package/dist/resolve-packages.d.ts +1 -1
- package/dist/resolve-packages.js +52 -36
- package/dist/templates/mops-publish.yml +3 -3
- package/dist/templates/mops-test.yml +3 -3
- package/dist/templates/src/lib.mo +13 -13
- package/dist/templates/test/lib.test.mo +2 -2
- package/dist/templates.js +1 -1
- package/dist/tests/cli.test.d.ts +1 -0
- package/dist/tests/cli.test.js +63 -0
- package/dist/types.d.ts +14 -4
- package/dist/vessel.d.ts +2 -2
- package/dist/vessel.js +41 -34
- package/dist/wasm/pkg/bundler/package.json +20 -0
- package/dist/wasm/pkg/bundler/wasm.d.ts +3 -0
- package/dist/wasm/pkg/bundler/wasm.js +5 -0
- package/dist/wasm/pkg/bundler/wasm_bg.js +93 -0
- package/dist/wasm/pkg/bundler/wasm_bg.wasm +0 -0
- package/dist/wasm/pkg/bundler/wasm_bg.wasm.d.ts +8 -0
- package/dist/wasm/pkg/nodejs/package.json +14 -0
- package/dist/wasm/pkg/nodejs/wasm.d.ts +3 -0
- package/dist/wasm/pkg/nodejs/wasm.js +98 -0
- package/dist/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
- package/dist/wasm/pkg/nodejs/wasm_bg.wasm.d.ts +8 -0
- package/dist/wasm/pkg/web/package.json +18 -0
- package/dist/wasm/pkg/web/wasm.d.ts +35 -0
- package/dist/wasm/pkg/web/wasm.js +191 -0
- package/dist/wasm/pkg/web/wasm_bg.wasm +0 -0
- package/dist/wasm/pkg/web/wasm_bg.wasm.d.ts +8 -0
- package/dist/wasm.d.ts +5 -0
- package/dist/wasm.js +10 -0
- package/environments/nodejs/cli.ts +6 -0
- package/environments/web/cli.ts +6 -0
- package/error.ts +6 -0
- package/fix-dist.ts +5 -5
- package/global.d.ts +3 -3
- package/helpers/find-changelog-entry.ts +26 -23
- package/helpers/get-dep-name.ts +5 -5
- package/helpers/get-dfx-version.ts +8 -9
- package/helpers/get-moc-path.ts +25 -26
- package/helpers/get-moc-version.ts +21 -19
- package/helpers/get-package-id.ts +4 -4
- package/helpers/is-candid-compatible.ts +22 -0
- package/integrity.ts +270 -236
- package/jest.config.js +14 -0
- package/mops.ts +238 -215
- package/notify-installs.ts +16 -17
- package/package.json +19 -10
- package/parallel.ts +28 -24
- package/pem.ts +55 -47
- package/release-cli.ts +73 -39
- package/resolve-packages.ts +231 -189
- package/templates/mops-publish.yml +3 -3
- package/templates/mops-test.yml +3 -3
- package/templates/src/lib.mo +13 -13
- package/templates/test/lib.test.mo +2 -2
- package/templates.ts +4 -4
- package/tests/__snapshots__/cli.test.ts.snap +202 -0
- package/tests/build/error/candid/bar.did +3 -0
- package/tests/build/error/dfx.json +12 -0
- package/tests/build/error/mops.toml +9 -0
- package/tests/build/error/src/Bar.mo +5 -0
- package/tests/build/error/src/Foo.mo +5 -0
- package/tests/build/success/.dfx/local/canister_ids.json +17 -0
- package/tests/build/success/.dfx/local/canisters/bar/bar.did +3 -0
- package/tests/build/success/.dfx/local/canisters/bar/bar.most +4 -0
- package/tests/build/success/.dfx/local/canisters/bar/bar.wasm +0 -0
- package/tests/build/success/.dfx/local/canisters/bar/constructor.did +3 -0
- package/tests/build/success/.dfx/local/canisters/bar/index.js +42 -0
- package/tests/build/success/.dfx/local/canisters/bar/init_args.txt +1 -0
- package/tests/build/success/.dfx/local/canisters/bar/service.did +3 -0
- package/tests/build/success/.dfx/local/canisters/bar/service.did.d.ts +7 -0
- package/tests/build/success/.dfx/local/canisters/bar/service.did.js +4 -0
- package/tests/build/success/.dfx/local/canisters/foo/constructor.did +3 -0
- package/tests/build/success/.dfx/local/canisters/foo/foo.did +3 -0
- package/tests/build/success/.dfx/local/canisters/foo/foo.most +4 -0
- package/tests/build/success/.dfx/local/canisters/foo/foo.wasm +0 -0
- package/tests/build/success/.dfx/local/canisters/foo/index.js +42 -0
- package/tests/build/success/.dfx/local/canisters/foo/init_args.txt +1 -0
- package/tests/build/success/.dfx/local/canisters/foo/service.did +3 -0
- package/tests/build/success/.dfx/local/canisters/foo/service.did.d.ts +7 -0
- package/tests/build/success/.dfx/local/canisters/foo/service.did.js +4 -0
- package/tests/build/success/.dfx/local/lsp/ucwa4-rx777-77774-qaada-cai.did +3 -0
- package/tests/build/success/.dfx/local/lsp/ulvla-h7777-77774-qaacq-cai.did +3 -0
- package/tests/build/success/.dfx/local/network-id +4 -0
- package/tests/build/success/candid/bar.did +3 -0
- package/tests/build/success/dfx.json +12 -0
- package/tests/build/success/mops.toml +9 -0
- package/tests/build/success/src/Bar.mo +5 -0
- package/tests/build/success/src/Foo.mo +5 -0
- package/tests/check-candid/a.did +3 -0
- package/tests/check-candid/b.did +5 -0
- package/tests/check-candid/c.did +3 -0
- package/tests/cli.test.ts +82 -0
- package/tsconfig.json +26 -19
- package/types.ts +41 -31
- package/vessel.ts +219 -187
- package/wasm/Cargo.lock +1475 -0
- package/wasm/Cargo.toml +28 -0
- package/wasm/pkg/bundler/package.json +20 -0
- package/wasm/pkg/bundler/wasm.d.ts +3 -0
- package/wasm/pkg/bundler/wasm.js +5 -0
- package/wasm/pkg/bundler/wasm_bg.js +93 -0
- package/wasm/pkg/bundler/wasm_bg.wasm +0 -0
- package/wasm/pkg/bundler/wasm_bg.wasm.d.ts +8 -0
- package/wasm/pkg/nodejs/package.json +14 -0
- package/wasm/pkg/nodejs/wasm.d.ts +3 -0
- package/wasm/pkg/nodejs/wasm.js +98 -0
- package/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
- package/wasm/pkg/nodejs/wasm_bg.wasm.d.ts +8 -0
- package/wasm/pkg/web/package.json +18 -0
- package/wasm/pkg/web/wasm.d.ts +35 -0
- package/wasm/pkg/web/wasm.js +191 -0
- package/wasm/pkg/web/wasm_bg.wasm +0 -0
- package/wasm/pkg/web/wasm_bg.wasm.d.ts +8 -0
- package/wasm/src/lib.rs +17 -0
- package/wasm.ts +16 -0
package/dist/commands/publish.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import fs from
|
|
3
|
-
import path from
|
|
4
|
-
import chalk from
|
|
5
|
-
import logUpdate from
|
|
6
|
-
import { globbySync } from
|
|
7
|
-
import { minimatch } from
|
|
8
|
-
import prompts from
|
|
9
|
-
import { checkConfigFile, getIdentity, getRootDir, progressBar, readConfig } from
|
|
10
|
-
import { mainActor } from
|
|
11
|
-
import { parallel } from
|
|
12
|
-
import { docs } from
|
|
13
|
-
import { testWithReporter } from
|
|
14
|
-
import { SilentReporter } from
|
|
15
|
-
import { findChangelogEntry } from
|
|
16
|
-
import { bench } from
|
|
17
|
-
import { docsCoverage } from
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import logUpdate from "log-update";
|
|
6
|
+
import { globbySync } from "globby";
|
|
7
|
+
import { minimatch } from "minimatch";
|
|
8
|
+
import prompts from "prompts";
|
|
9
|
+
import { checkConfigFile, getIdentity, getRootDir, progressBar, readConfig, } from "../mops.js";
|
|
10
|
+
import { mainActor } from "../api/actors.js";
|
|
11
|
+
import { parallel } from "../parallel.js";
|
|
12
|
+
import { docs } from "./docs.js";
|
|
13
|
+
import { testWithReporter } from "./test/test.js";
|
|
14
|
+
import { SilentReporter } from "./test/reporters/silent-reporter.js";
|
|
15
|
+
import { findChangelogEntry } from "../helpers/find-changelog-entry.js";
|
|
16
|
+
import { bench } from "./bench.js";
|
|
17
|
+
import { docsCoverage } from "./docs-coverage.js";
|
|
18
18
|
export async function publish(options = {}) {
|
|
19
19
|
if (!checkConfigFile()) {
|
|
20
20
|
return;
|
|
@@ -24,30 +24,38 @@ export async function publish(options = {}) {
|
|
|
24
24
|
console.log(`Publishing ${config.package?.name}@${config.package?.version}`);
|
|
25
25
|
// validate
|
|
26
26
|
for (let key of Object.keys(config)) {
|
|
27
|
-
if (![
|
|
28
|
-
|
|
27
|
+
if (![
|
|
28
|
+
"package",
|
|
29
|
+
"dependencies",
|
|
30
|
+
"dev-dependencies",
|
|
31
|
+
"toolchain",
|
|
32
|
+
"requirements",
|
|
33
|
+
].includes(key)) {
|
|
34
|
+
console.log(chalk.red("Error: ") + `Unknown config section [${key}]`);
|
|
29
35
|
process.exit(1);
|
|
30
36
|
}
|
|
31
37
|
}
|
|
32
38
|
// required fields
|
|
33
39
|
if (!config.package) {
|
|
34
|
-
console.log(chalk.red(
|
|
40
|
+
console.log(chalk.red("Error: ") +
|
|
41
|
+
"Please specify [package] section in your mops.toml");
|
|
35
42
|
process.exit(1);
|
|
36
43
|
}
|
|
37
|
-
for (let key of [
|
|
44
|
+
for (let key of ["name", "version"]) {
|
|
38
45
|
// @ts-ignore
|
|
39
46
|
if (!config.package[key]) {
|
|
40
|
-
console.log(chalk.red(
|
|
47
|
+
console.log(chalk.red("Error: ") +
|
|
48
|
+
`Please specify "${key}" in [package] section in your mops.toml`);
|
|
41
49
|
process.exit(1);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
// desired fields
|
|
45
|
-
for (let key of [
|
|
53
|
+
for (let key of ["description", "repository"]) {
|
|
46
54
|
// @ts-ignore
|
|
47
55
|
if (!config.package[key] && !process.env.CI) {
|
|
48
56
|
let res = await prompts({
|
|
49
|
-
type:
|
|
50
|
-
name:
|
|
57
|
+
type: "confirm",
|
|
58
|
+
name: "ok",
|
|
51
59
|
message: `Missing recommended config key "${key}", publish anyway?`,
|
|
52
60
|
});
|
|
53
61
|
if (!res.ok) {
|
|
@@ -56,24 +64,24 @@ export async function publish(options = {}) {
|
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
let packageKeys = [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
"name",
|
|
68
|
+
"version",
|
|
69
|
+
"keywords",
|
|
70
|
+
"description",
|
|
71
|
+
"repository",
|
|
72
|
+
"documentation",
|
|
73
|
+
"homepage",
|
|
74
|
+
"baseDir",
|
|
75
|
+
"readme",
|
|
76
|
+
"license",
|
|
77
|
+
"files",
|
|
78
|
+
"dfx",
|
|
79
|
+
"moc",
|
|
80
|
+
"donation",
|
|
73
81
|
];
|
|
74
82
|
for (let key of Object.keys(config.package)) {
|
|
75
83
|
if (!packageKeys.includes(key)) {
|
|
76
|
-
console.log(chalk.red(
|
|
84
|
+
console.log(chalk.red("Error: ") + `Unknown config key 'package.${key}'`);
|
|
77
85
|
process.exit(1);
|
|
78
86
|
}
|
|
79
87
|
}
|
|
@@ -97,18 +105,19 @@ export async function publish(options = {}) {
|
|
|
97
105
|
for (let [key, max] of Object.entries(keysMax)) {
|
|
98
106
|
// @ts-ignore
|
|
99
107
|
if (config.package[key] && config.package[key].length > max) {
|
|
100
|
-
console.log(chalk.red(
|
|
108
|
+
console.log(chalk.red("Error: ") + `package.${key} value max length is ${max}`);
|
|
101
109
|
process.exit(1);
|
|
102
110
|
}
|
|
103
111
|
}
|
|
104
112
|
if (config.dependencies) {
|
|
105
113
|
if (Object.keys(config.dependencies).length > 100) {
|
|
106
|
-
console.log(chalk.red(
|
|
114
|
+
console.log(chalk.red("Error: ") + "max dependencies is 100");
|
|
107
115
|
process.exit(1);
|
|
108
116
|
}
|
|
109
117
|
for (let dep of Object.values(config.dependencies)) {
|
|
110
118
|
if (dep.path) {
|
|
111
|
-
console.log(chalk.red(
|
|
119
|
+
console.log(chalk.red("Error: ") +
|
|
120
|
+
"you can't publish packages with local dependencies");
|
|
112
121
|
process.exit(1);
|
|
113
122
|
}
|
|
114
123
|
delete dep.path;
|
|
@@ -116,9 +125,9 @@ export async function publish(options = {}) {
|
|
|
116
125
|
for (let dep of Object.values(config.dependencies)) {
|
|
117
126
|
if (dep.repo && !process.env.CI) {
|
|
118
127
|
let res = await prompts({
|
|
119
|
-
type:
|
|
120
|
-
name:
|
|
121
|
-
message: chalk.yellow(
|
|
128
|
+
type: "confirm",
|
|
129
|
+
name: "ok",
|
|
130
|
+
message: chalk.yellow("GitHub dependencies make the registry less reliable and limit its capabilities.\nIf you are the owner of the dependency, please consider publishing it to the Mops registry.") + "\n\nPublish anyway?",
|
|
122
131
|
});
|
|
123
132
|
if (!res.ok) {
|
|
124
133
|
return;
|
|
@@ -126,14 +135,15 @@ export async function publish(options = {}) {
|
|
|
126
135
|
}
|
|
127
136
|
}
|
|
128
137
|
}
|
|
129
|
-
if (config[
|
|
130
|
-
if (Object.keys(config[
|
|
131
|
-
console.log(chalk.red(
|
|
138
|
+
if (config["dev-dependencies"]) {
|
|
139
|
+
if (Object.keys(config["dev-dependencies"]).length > 100) {
|
|
140
|
+
console.log(chalk.red("Error: ") + "max dev-dependencies is 100");
|
|
132
141
|
process.exit(1);
|
|
133
142
|
}
|
|
134
|
-
for (let dep of Object.values(config[
|
|
143
|
+
for (let dep of Object.values(config["dev-dependencies"])) {
|
|
135
144
|
if (dep.path) {
|
|
136
|
-
console.log(chalk.red(
|
|
145
|
+
console.log(chalk.red("Error: ") +
|
|
146
|
+
"you can't publish packages with local dev-dependencies");
|
|
137
147
|
process.exit(1);
|
|
138
148
|
}
|
|
139
149
|
delete dep.path;
|
|
@@ -142,23 +152,23 @@ export async function publish(options = {}) {
|
|
|
142
152
|
if (config.package.keywords) {
|
|
143
153
|
for (let keyword of config.package.keywords) {
|
|
144
154
|
if (keyword.length > 20) {
|
|
145
|
-
console.log(chalk.red(
|
|
155
|
+
console.log(chalk.red("Error: ") + "max keyword length is 20");
|
|
146
156
|
return;
|
|
147
157
|
}
|
|
148
158
|
}
|
|
149
159
|
}
|
|
150
160
|
if (config.package.files) {
|
|
151
161
|
for (let file of config.package.files) {
|
|
152
|
-
if (file.startsWith(
|
|
153
|
-
console.log(chalk.red(
|
|
162
|
+
if (file.startsWith("/") || file.startsWith("../")) {
|
|
163
|
+
console.log(chalk.red("Error: ") + "file path cannot start with '/' or '../'");
|
|
154
164
|
return;
|
|
155
165
|
}
|
|
156
166
|
}
|
|
157
167
|
}
|
|
158
168
|
if (config.requirements) {
|
|
159
169
|
Object.keys(config.requirements).forEach((name) => {
|
|
160
|
-
if (name !==
|
|
161
|
-
console.log(chalk.red(
|
|
170
|
+
if (name !== "moc") {
|
|
171
|
+
console.log(chalk.red("Error: ") + `Unknown requirement "${name}"`);
|
|
162
172
|
return;
|
|
163
173
|
}
|
|
164
174
|
});
|
|
@@ -166,8 +176,8 @@ export async function publish(options = {}) {
|
|
|
166
176
|
let toBackendDep = (dep) => {
|
|
167
177
|
return {
|
|
168
178
|
...dep,
|
|
169
|
-
version: dep.version ||
|
|
170
|
-
repo: dep.repo ||
|
|
179
|
+
version: dep.version || "",
|
|
180
|
+
repo: dep.repo || "",
|
|
171
181
|
};
|
|
172
182
|
};
|
|
173
183
|
let toBackendReq = ([name, value]) => {
|
|
@@ -178,51 +188,53 @@ export async function publish(options = {}) {
|
|
|
178
188
|
name: config.package.name,
|
|
179
189
|
version: config.package.version,
|
|
180
190
|
keywords: config.package.keywords || [],
|
|
181
|
-
description: config.package.description ||
|
|
182
|
-
repository: config.package.repository ||
|
|
183
|
-
homepage: config.package.homepage ||
|
|
184
|
-
documentation: config.package.documentation ||
|
|
185
|
-
baseDir:
|
|
186
|
-
readme:
|
|
187
|
-
license: config.package.license ||
|
|
188
|
-
dfx: config.package.dfx ||
|
|
189
|
-
moc: config.package.moc ||
|
|
190
|
-
donation: config.package.donation ||
|
|
191
|
+
description: config.package.description || "",
|
|
192
|
+
repository: config.package.repository || "",
|
|
193
|
+
homepage: config.package.homepage || "",
|
|
194
|
+
documentation: config.package.documentation || "",
|
|
195
|
+
baseDir: "src",
|
|
196
|
+
readme: "README.md",
|
|
197
|
+
license: config.package.license || "",
|
|
198
|
+
dfx: config.package.dfx || "",
|
|
199
|
+
moc: config.package.moc || "",
|
|
200
|
+
donation: config.package.donation || "",
|
|
191
201
|
dependencies: Object.values(config.dependencies || {}).map(toBackendDep),
|
|
192
|
-
devDependencies: Object.values(config[
|
|
202
|
+
devDependencies: Object.values(config["dev-dependencies"] || {}).map(toBackendDep),
|
|
193
203
|
scripts: [],
|
|
194
|
-
requirements: [
|
|
204
|
+
requirements: [
|
|
205
|
+
Object.entries(config.requirements || {}).map((req) => toBackendReq(req)),
|
|
206
|
+
],
|
|
195
207
|
};
|
|
196
208
|
let defaultFiles = [
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
"mops.toml",
|
|
210
|
+
"README.md",
|
|
211
|
+
"LICENSE",
|
|
212
|
+
"NOTICE",
|
|
213
|
+
"!.mops/**",
|
|
214
|
+
"!test/**",
|
|
215
|
+
"!tests/**",
|
|
216
|
+
"!**/*.test.mo",
|
|
217
|
+
"!**/*.Test.mo",
|
|
218
|
+
"!bench/**",
|
|
219
|
+
"!benchmark/**",
|
|
220
|
+
"!**/*.bench.mo",
|
|
221
|
+
"!**/*.Bench.mo",
|
|
222
|
+
"!**/node_modules/**",
|
|
211
223
|
];
|
|
212
|
-
let files = config.package.files || [
|
|
224
|
+
let files = config.package.files || ["**/*.mo"];
|
|
213
225
|
files = [...files, ...defaultFiles];
|
|
214
226
|
files = globbySync([...files, ...defaultFiles]);
|
|
215
227
|
if (options.verbose) {
|
|
216
|
-
console.log(
|
|
217
|
-
console.log(files.map((file) =>
|
|
228
|
+
console.log("Files:");
|
|
229
|
+
console.log(files.map((file) => " " + file).join("\n"));
|
|
218
230
|
}
|
|
219
231
|
// generate docs
|
|
220
|
-
let docsFile = path.join(rootDir,
|
|
232
|
+
let docsFile = path.join(rootDir, ".mops/.docs/docs.tgz");
|
|
221
233
|
let docsCov = 0;
|
|
222
234
|
if (options.docs) {
|
|
223
|
-
console.log(
|
|
235
|
+
console.log("Generating documentation...");
|
|
224
236
|
docsCov = await docsCoverage({
|
|
225
|
-
reporter:
|
|
237
|
+
reporter: "silent",
|
|
226
238
|
});
|
|
227
239
|
await docs({ silent: true, archive: true });
|
|
228
240
|
if (fs.existsSync(docsFile)) {
|
|
@@ -230,57 +242,61 @@ export async function publish(options = {}) {
|
|
|
230
242
|
}
|
|
231
243
|
}
|
|
232
244
|
// check required files
|
|
233
|
-
if (!files.includes(
|
|
234
|
-
console.log(chalk.red(
|
|
245
|
+
if (!files.includes("mops.toml")) {
|
|
246
|
+
console.log(chalk.red("Error: ") + " please add mops.toml file");
|
|
235
247
|
process.exit(1);
|
|
236
248
|
}
|
|
237
|
-
if (!files.includes(
|
|
238
|
-
console.log(chalk.red(
|
|
249
|
+
if (!files.includes("README.md")) {
|
|
250
|
+
console.log(chalk.red("Error: ") + " please add README.md file");
|
|
239
251
|
process.exit(1);
|
|
240
252
|
}
|
|
241
253
|
// check allowed exts
|
|
242
254
|
for (let file of files) {
|
|
243
|
-
if (!minimatch(file,
|
|
244
|
-
|
|
255
|
+
if (!minimatch(file, "**/*.{mo,did,md,toml}") &&
|
|
256
|
+
!file.toLowerCase().endsWith("license") &&
|
|
257
|
+
!file.toLowerCase().endsWith("notice") &&
|
|
258
|
+
file !== docsFile) {
|
|
259
|
+
console.log(chalk.red("Error: ") +
|
|
260
|
+
`file ${file} has unsupported extension. Allowed: .mo, .did, .md, .toml`);
|
|
245
261
|
process.exit(1);
|
|
246
262
|
}
|
|
247
263
|
}
|
|
248
264
|
// parse changelog
|
|
249
|
-
console.log(
|
|
265
|
+
console.log("Parsing CHANGELOG.md...");
|
|
250
266
|
let changelog = parseChangelog(config.package.version);
|
|
251
267
|
if (!changelog && config.package.repository) {
|
|
252
|
-
console.log(
|
|
268
|
+
console.log("Fetching release notes from GitHub...");
|
|
253
269
|
changelog = await fetchGitHubReleaseNotes(config.package.repository, config.package.version);
|
|
254
270
|
}
|
|
255
271
|
if (changelog) {
|
|
256
|
-
console.log(
|
|
272
|
+
console.log("Changelog:");
|
|
257
273
|
console.log(chalk.gray(changelog));
|
|
258
274
|
}
|
|
259
275
|
// test
|
|
260
|
-
let reporter = new SilentReporter;
|
|
276
|
+
let reporter = new SilentReporter();
|
|
261
277
|
if (options.test) {
|
|
262
|
-
console.log(
|
|
263
|
-
await testWithReporter(reporter,
|
|
278
|
+
console.log("Running tests...");
|
|
279
|
+
await testWithReporter(reporter, "", "interpreter", config.toolchain?.["pocket-ic"] ? "pocket-ic" : "dfx");
|
|
264
280
|
if (reporter.failed > 0) {
|
|
265
|
-
console.log(chalk.red(
|
|
281
|
+
console.log(chalk.red("Error: ") + "tests failed");
|
|
266
282
|
process.exit(1);
|
|
267
283
|
}
|
|
268
284
|
}
|
|
269
285
|
// bench
|
|
270
286
|
let benchmarks = [];
|
|
271
287
|
if (options.bench) {
|
|
272
|
-
console.log(
|
|
288
|
+
console.log("Running benchmarks...");
|
|
273
289
|
try {
|
|
274
|
-
benchmarks = await bench(
|
|
275
|
-
replica: config.toolchain?.[
|
|
276
|
-
gc:
|
|
290
|
+
benchmarks = await bench("", {
|
|
291
|
+
replica: config.toolchain?.["pocket-ic"] ? "pocket-ic" : "dfx",
|
|
292
|
+
gc: "copying",
|
|
277
293
|
forceGc: true,
|
|
278
294
|
silent: true,
|
|
279
295
|
});
|
|
280
296
|
}
|
|
281
297
|
catch (err) {
|
|
282
298
|
console.error(err);
|
|
283
|
-
console.log(chalk.red(
|
|
299
|
+
console.log(chalk.red("Error: ") + "benchmarks failed");
|
|
284
300
|
process.exit(1);
|
|
285
301
|
}
|
|
286
302
|
}
|
|
@@ -296,8 +312,8 @@ export async function publish(options = {}) {
|
|
|
296
312
|
let actor = await mainActor(identity);
|
|
297
313
|
progress();
|
|
298
314
|
let publishing = await actor.startPublish(backendPkgConfig);
|
|
299
|
-
if (
|
|
300
|
-
console.log(chalk.red(
|
|
315
|
+
if ("err" in publishing) {
|
|
316
|
+
console.log(chalk.red("Error: ") + publishing.err);
|
|
301
317
|
process.exit(1);
|
|
302
318
|
}
|
|
303
319
|
let puiblishingId = publishing.ok;
|
|
@@ -332,8 +348,8 @@ export async function publish(options = {}) {
|
|
|
332
348
|
file = path.basename(file);
|
|
333
349
|
}
|
|
334
350
|
let res = await actor.startFileUpload(puiblishingId, file, BigInt(chunkCount), firstChunk);
|
|
335
|
-
if (
|
|
336
|
-
console.log(chalk.red(
|
|
351
|
+
if ("err" in res) {
|
|
352
|
+
console.log(chalk.red("Error: ") + res.err);
|
|
337
353
|
process.exit(1);
|
|
338
354
|
}
|
|
339
355
|
let fileId = res.ok;
|
|
@@ -341,27 +357,31 @@ export async function publish(options = {}) {
|
|
|
341
357
|
let start = i * chunkSize;
|
|
342
358
|
let chunk = Array.from(content.slice(start, start + chunkSize));
|
|
343
359
|
let res = await actor.uploadFileChunk(puiblishingId, fileId, BigInt(i), chunk);
|
|
344
|
-
if (
|
|
345
|
-
console.log(chalk.red(
|
|
360
|
+
if ("err" in res) {
|
|
361
|
+
console.log(chalk.red("Error: ") + res.err);
|
|
346
362
|
process.exit(1);
|
|
347
363
|
}
|
|
348
364
|
}
|
|
349
365
|
});
|
|
350
|
-
fs.rmSync(path.join(rootDir,
|
|
366
|
+
fs.rmSync(path.join(rootDir, ".mops/.docs"), {
|
|
367
|
+
force: true,
|
|
368
|
+
recursive: true,
|
|
369
|
+
});
|
|
351
370
|
// finish
|
|
352
371
|
progress();
|
|
353
372
|
logUpdate.done();
|
|
354
373
|
let res = await actor.finishPublish(puiblishingId);
|
|
355
|
-
if (
|
|
356
|
-
console.log(chalk.red(
|
|
374
|
+
if ("err" in res) {
|
|
375
|
+
console.log(chalk.red("Error: ") + res.err);
|
|
357
376
|
process.exit(1);
|
|
358
377
|
}
|
|
359
|
-
console.log(chalk.green(
|
|
378
|
+
console.log(chalk.green("Published ") +
|
|
379
|
+
`${config.package.name}@${config.package.version}`);
|
|
360
380
|
}
|
|
361
381
|
function parseChangelog(version) {
|
|
362
382
|
let rootDir = getRootDir();
|
|
363
|
-
let changelogFile =
|
|
364
|
-
let files = [
|
|
383
|
+
let changelogFile = "";
|
|
384
|
+
let files = ["CHANGELOG.md", "Changelog.md", "changelog.md"];
|
|
365
385
|
for (let file of files) {
|
|
366
386
|
if (fs.existsSync(path.join(rootDir, file))) {
|
|
367
387
|
changelogFile = path.join(rootDir, file);
|
|
@@ -369,26 +389,26 @@ function parseChangelog(version) {
|
|
|
369
389
|
}
|
|
370
390
|
}
|
|
371
391
|
if (!changelogFile) {
|
|
372
|
-
console.log(chalk.yellow(
|
|
373
|
-
return
|
|
392
|
+
console.log(chalk.yellow("CHANGELOG.md not found"));
|
|
393
|
+
return "";
|
|
374
394
|
}
|
|
375
|
-
let str = fs.readFileSync(changelogFile,
|
|
395
|
+
let str = fs.readFileSync(changelogFile, "utf-8");
|
|
376
396
|
let changelog = findChangelogEntry(str, version);
|
|
377
397
|
if (!changelog) {
|
|
378
|
-
console.log(chalk.yellow(
|
|
398
|
+
console.log(chalk.yellow("No changelog entry found"));
|
|
379
399
|
}
|
|
380
|
-
return changelog ||
|
|
400
|
+
return changelog || "";
|
|
381
401
|
}
|
|
382
402
|
async function fetchGitHubReleaseNotes(repo, version) {
|
|
383
403
|
let repoPath = new URL(repo).pathname;
|
|
384
404
|
let res = await fetch(`https://api.github.com/repos${repoPath}/releases/tags/${version}`);
|
|
385
405
|
let release = await res.json();
|
|
386
|
-
if (release.message ===
|
|
406
|
+
if (release.message === "Not Found") {
|
|
387
407
|
res = await fetch(`https://api.github.com/repos${repoPath}/releases/tags/v${version}`);
|
|
388
408
|
release = await res.json();
|
|
389
|
-
if (release.message ===
|
|
409
|
+
if (release.message === "Not Found") {
|
|
390
410
|
console.log(chalk.yellow(`No GitHub release found with name ${version} or v${version}`));
|
|
391
|
-
return
|
|
411
|
+
return "";
|
|
392
412
|
}
|
|
393
413
|
}
|
|
394
414
|
return release.body;
|
|
@@ -2,7 +2,7 @@ type RemoveOptions = {
|
|
|
2
2
|
verbose?: boolean;
|
|
3
3
|
dev?: boolean;
|
|
4
4
|
dryRun?: boolean;
|
|
5
|
-
lock?:
|
|
5
|
+
lock?: "update" | "ignore";
|
|
6
6
|
};
|
|
7
7
|
export declare function remove(name: string, { dev, verbose, dryRun, lock }?: RemoveOptions): Promise<void>;
|
|
8
8
|
export {};
|
package/dist/commands/remove.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import { deleteSync } from
|
|
3
|
-
import chalk from
|
|
4
|
-
import { checkConfigFile, getRootDir, readConfig, writeConfig } from
|
|
5
|
-
import { checkIntegrity } from
|
|
6
|
-
import { getDepCacheDir, getDepCacheName } from
|
|
7
|
-
import path from
|
|
8
|
-
import { syncLocalCache } from
|
|
9
|
-
import { getPackageId } from
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { deleteSync } from "del";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { checkConfigFile, getRootDir, readConfig, writeConfig, } from "../mops.js";
|
|
5
|
+
import { checkIntegrity } from "../integrity.js";
|
|
6
|
+
import { getDepCacheDir, getDepCacheName } from "../cache.js";
|
|
7
|
+
import path from "node:path";
|
|
8
|
+
import { syncLocalCache } from "./install/sync-local-cache.js";
|
|
9
|
+
import { getPackageId } from "../helpers/get-package-id.js";
|
|
10
10
|
export async function remove(name, { dev = false, verbose = false, dryRun = false, lock } = {}) {
|
|
11
11
|
if (!checkConfigFile()) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
function getTransitiveDependencies(config, exceptPkgId) {
|
|
15
15
|
let deps = Object.values(config.dependencies || {});
|
|
16
|
-
let devDeps = Object.values(config[
|
|
16
|
+
let devDeps = Object.values(config["dev-dependencies"] || {});
|
|
17
17
|
return [...deps, ...devDeps]
|
|
18
18
|
.filter((dep) => {
|
|
19
|
-
let depId = getPackageId(dep.name, dep.version ||
|
|
19
|
+
let depId = getPackageId(dep.name, dep.version || "");
|
|
20
20
|
return depId !== exceptPkgId;
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
})
|
|
22
|
+
.map((dep) => {
|
|
23
|
+
return [
|
|
24
|
+
dep,
|
|
25
|
+
...getTransitiveDependenciesOf(dep.name, dep.version, dep.repo),
|
|
26
|
+
];
|
|
27
|
+
})
|
|
28
|
+
.flat();
|
|
24
29
|
}
|
|
25
30
|
function getTransitiveDependenciesOf(name, version, repo) {
|
|
26
31
|
let value = version || repo;
|
|
@@ -29,42 +34,49 @@ export async function remove(name, { dev = false, verbose = false, dryRun = fals
|
|
|
29
34
|
}
|
|
30
35
|
let cacheName = getDepCacheName(name, value);
|
|
31
36
|
let pkgDir = getDepCacheDir(cacheName);
|
|
32
|
-
let configFile = pkgDir +
|
|
37
|
+
let configFile = pkgDir + "/mops.toml";
|
|
33
38
|
if (!fs.existsSync(configFile)) {
|
|
34
|
-
verbose && console.log(
|
|
39
|
+
verbose && console.log("no config", configFile);
|
|
35
40
|
return [];
|
|
36
41
|
}
|
|
37
42
|
let config = readConfig(configFile);
|
|
38
|
-
let deps = Object.values(config.dependencies || {})
|
|
43
|
+
let deps = Object.values(config.dependencies || {})
|
|
44
|
+
.map((dep) => {
|
|
39
45
|
return [dep, ...getTransitiveDependenciesOf(dep.name, dep.version)];
|
|
40
|
-
})
|
|
46
|
+
})
|
|
47
|
+
.flat();
|
|
41
48
|
return deps;
|
|
42
49
|
}
|
|
43
50
|
let config = readConfig();
|
|
44
|
-
let deps = dev ? config[
|
|
51
|
+
let deps = dev ? config["dev-dependencies"] : config.dependencies;
|
|
45
52
|
deps = deps || {};
|
|
46
53
|
let pkgDetails = deps[name];
|
|
47
54
|
if (!pkgDetails) {
|
|
48
|
-
return console.log(chalk.red(
|
|
55
|
+
return console.log(chalk.red("Error: ") +
|
|
56
|
+
`No ${dev ? "dev " : ""}dependency to remove "${name}"`);
|
|
49
57
|
}
|
|
50
58
|
let version = pkgDetails.version;
|
|
51
|
-
let packageId = getPackageId(name, version ||
|
|
59
|
+
let packageId = getPackageId(name, version || "");
|
|
52
60
|
// transitive deps ignoring deps of this package
|
|
53
61
|
let transitiveDeps = getTransitiveDependencies(config, packageId);
|
|
54
62
|
let transitiveDepIds = new Set(transitiveDeps.map((dep) => {
|
|
55
|
-
return getPackageId(dep.name, dep.version ||
|
|
63
|
+
return getPackageId(dep.name, dep.version || "");
|
|
56
64
|
}));
|
|
57
65
|
// transitive deps of this package (including itself)
|
|
58
|
-
let transitiveDepsOfPackage = [
|
|
66
|
+
let transitiveDepsOfPackage = [
|
|
67
|
+
pkgDetails,
|
|
68
|
+
...getTransitiveDependenciesOf(name, version),
|
|
69
|
+
];
|
|
59
70
|
// remove local cache
|
|
60
71
|
for (let dep of transitiveDepsOfPackage) {
|
|
61
|
-
let depId = getPackageId(dep.name, dep.version ||
|
|
72
|
+
let depId = getPackageId(dep.name, dep.version || "");
|
|
62
73
|
if (transitiveDepIds.has(depId)) {
|
|
63
|
-
verbose &&
|
|
74
|
+
verbose &&
|
|
75
|
+
console.log(`Ignored transitive dependency ${depId} (other deps depend on it)`);
|
|
64
76
|
continue;
|
|
65
77
|
}
|
|
66
|
-
let cacheName = getDepCacheName(dep.name, dep.version || dep.repo ||
|
|
67
|
-
let localCacheDir = path.join(getRootDir(),
|
|
78
|
+
let cacheName = getDepCacheName(dep.name, dep.version || dep.repo || "");
|
|
79
|
+
let localCacheDir = path.join(getRootDir(), ".mops", cacheName);
|
|
68
80
|
if (localCacheDir && fs.existsSync(localCacheDir)) {
|
|
69
81
|
dryRun || deleteSync([localCacheDir], { force: true });
|
|
70
82
|
verbose && console.log(`Removed local cache ${localCacheDir}`);
|
|
@@ -74,11 +86,11 @@ export async function remove(name, { dev = false, verbose = false, dryRun = fals
|
|
|
74
86
|
if (!dev && config.dependencies) {
|
|
75
87
|
delete config.dependencies[name];
|
|
76
88
|
}
|
|
77
|
-
if (dev && config[
|
|
78
|
-
delete config[
|
|
89
|
+
if (dev && config["dev-dependencies"]) {
|
|
90
|
+
delete config["dev-dependencies"][name];
|
|
79
91
|
}
|
|
80
92
|
dryRun || writeConfig(config);
|
|
81
93
|
await syncLocalCache();
|
|
82
94
|
await checkIntegrity(lock);
|
|
83
|
-
console.log(chalk.green(
|
|
95
|
+
console.log(chalk.green("Package removed ") + `${name} = "${version}"`);
|
|
84
96
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { ChildProcessWithoutNullStreams } from
|
|
2
|
-
import { PassThrough } from
|
|
3
|
-
import { IDL } from
|
|
4
|
-
import { PocketIc, PocketIcServer } from
|
|
5
|
-
import { PocketIc as PocketIcMops, PocketIcServer as PocketIcServerMops } from
|
|
1
|
+
import { ChildProcessWithoutNullStreams } from "node:child_process";
|
|
2
|
+
import { PassThrough } from "node:stream";
|
|
3
|
+
import { IDL } from "@icp-sdk/core/candid";
|
|
4
|
+
import { PocketIc, PocketIcServer } from "pic-ic";
|
|
5
|
+
import { PocketIc as PocketIcMops, PocketIcServer as PocketIcServerMops } from "pic-js-mops";
|
|
6
6
|
type StartOptions = {
|
|
7
|
-
type?:
|
|
7
|
+
type?: "dfx" | "pocket-ic" | "dfx-pocket-ic";
|
|
8
8
|
dir?: string;
|
|
9
9
|
verbose?: boolean;
|
|
10
10
|
silent?: boolean;
|
|
11
11
|
};
|
|
12
12
|
export declare class Replica {
|
|
13
|
-
type:
|
|
13
|
+
type: "dfx" | "pocket-ic" | "dfx-pocket-ic";
|
|
14
14
|
verbose: boolean;
|
|
15
15
|
canisters: Record<string, {
|
|
16
16
|
cwd: string;
|