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
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
3
|
-
import { copyCache, getDepCacheName } from
|
|
4
|
-
import { getDependencyType, getRootDir } from
|
|
5
|
-
import { resolvePackages } from
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { copyCache, getDepCacheName } from "../../cache.js";
|
|
4
|
+
import { getDependencyType, getRootDir } from "../../mops.js";
|
|
5
|
+
import { resolvePackages } from "../../resolve-packages.js";
|
|
6
6
|
export async function syncLocalCache({ verbose = false } = {}) {
|
|
7
7
|
let resolvedPackages = await resolvePackages();
|
|
8
8
|
let rootDir = getRootDir();
|
|
9
|
-
verbose && console.log(
|
|
9
|
+
verbose && console.log("Syncing local cache...");
|
|
10
10
|
let installedDeps = {};
|
|
11
11
|
await Promise.all(Object.entries(resolvedPackages).map(([name, value]) => {
|
|
12
12
|
let depType = getDependencyType(value);
|
|
13
|
-
if (depType ===
|
|
13
|
+
if (depType === "mops" || depType === "github") {
|
|
14
14
|
let cacheName = getDepCacheName(name, value);
|
|
15
|
-
let dest = path.join(rootDir,
|
|
15
|
+
let dest = path.join(rootDir, ".mops", cacheName);
|
|
16
16
|
if (!fs.existsSync(dest)) {
|
|
17
|
-
if (depType ===
|
|
17
|
+
if (depType === "mops") {
|
|
18
18
|
installedDeps[name] = value;
|
|
19
19
|
}
|
|
20
|
-
return copyCache(cacheName, path.join(rootDir,
|
|
20
|
+
return copyCache(cacheName, path.join(rootDir, ".mops", cacheName));
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
return Promise.resolve();
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import chalk from
|
|
3
|
-
import { checkConfigFile, getIdentity, readConfig } from
|
|
4
|
-
import { mainActor } from
|
|
5
|
-
import { Principal } from
|
|
6
|
-
import prompts from
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { checkConfigFile, getIdentity, readConfig } from "../mops.js";
|
|
4
|
+
import { mainActor } from "../api/actors.js";
|
|
5
|
+
import { Principal } from "@icp-sdk/core/principal";
|
|
6
|
+
import prompts from "prompts";
|
|
7
7
|
export async function printMaintainers() {
|
|
8
8
|
if (!checkConfigFile()) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
let config = readConfig();
|
|
12
12
|
let actor = await mainActor();
|
|
13
|
-
let maintainers = await actor.getPackageMaintainers(config.package?.name ||
|
|
13
|
+
let maintainers = await actor.getPackageMaintainers(config.package?.name || "");
|
|
14
14
|
console.log(`Maintainers of package ${chalk.bold(config.package?.name)}:`);
|
|
15
15
|
for (let maintainer of maintainers) {
|
|
16
16
|
console.log(maintainer.toText());
|
|
@@ -25,13 +25,13 @@ export async function addMaintainer(maintainer, yes = false) {
|
|
|
25
25
|
if (!yes) {
|
|
26
26
|
let promptsConfig = {
|
|
27
27
|
onCancel() {
|
|
28
|
-
console.log(
|
|
28
|
+
console.log("aborted");
|
|
29
29
|
process.exit(0);
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
let { confirm } = await prompts({
|
|
33
|
-
type:
|
|
34
|
-
name:
|
|
33
|
+
type: "confirm",
|
|
34
|
+
name: "confirm",
|
|
35
35
|
message: `Are you sure you want to add maintainer ${chalk.yellow(maintainer)} to ${chalk.yellow(config.package?.name)} package?`,
|
|
36
36
|
initial: true,
|
|
37
37
|
}, promptsConfig);
|
|
@@ -41,13 +41,13 @@ export async function addMaintainer(maintainer, yes = false) {
|
|
|
41
41
|
}
|
|
42
42
|
let identity = await getIdentity();
|
|
43
43
|
let actor = await mainActor(identity);
|
|
44
|
-
let res = await actor.addMaintainer(config.package?.name ||
|
|
45
|
-
if (
|
|
46
|
-
console.log(chalk.green(
|
|
44
|
+
let res = await actor.addMaintainer(config.package?.name || "", principal);
|
|
45
|
+
if ("ok" in res) {
|
|
46
|
+
console.log(chalk.green("Success!"));
|
|
47
47
|
console.log(`Added maintainer ${chalk.bold(maintainer)} to package ${chalk.bold(config.package?.name)}`);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
console.error(chalk.red(
|
|
50
|
+
console.error(chalk.red("Error: ") + res.err);
|
|
51
51
|
process.exit(1);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -60,13 +60,13 @@ export async function removeMaintainer(maintainer, yes = false) {
|
|
|
60
60
|
if (!yes) {
|
|
61
61
|
let promptsConfig = {
|
|
62
62
|
onCancel() {
|
|
63
|
-
console.log(
|
|
63
|
+
console.log("aborted");
|
|
64
64
|
process.exit(0);
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
let { confirm } = await prompts({
|
|
68
|
-
type:
|
|
69
|
-
name:
|
|
68
|
+
type: "confirm",
|
|
69
|
+
name: "confirm",
|
|
70
70
|
message: `Are you sure you want to remove maintainer ${chalk.red(maintainer)} from ${chalk.red(config.package?.name)} package?`,
|
|
71
71
|
initial: true,
|
|
72
72
|
}, promptsConfig);
|
|
@@ -76,13 +76,13 @@ export async function removeMaintainer(maintainer, yes = false) {
|
|
|
76
76
|
}
|
|
77
77
|
let identity = await getIdentity();
|
|
78
78
|
let actor = await mainActor(identity);
|
|
79
|
-
let res = await actor.removeMaintainer(config.package?.name ||
|
|
80
|
-
if (
|
|
81
|
-
console.log(chalk.green(
|
|
79
|
+
let res = await actor.removeMaintainer(config.package?.name || "", principal);
|
|
80
|
+
if ("ok" in res) {
|
|
81
|
+
console.log(chalk.green("Success!"));
|
|
82
82
|
console.log(`Removed maintainer ${chalk.bold(maintainer)} from package ${chalk.bold(config.package?.name)}`);
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
85
|
-
console.error(chalk.red(
|
|
85
|
+
console.error(chalk.red("Error: ") + res.err);
|
|
86
86
|
process.exit(1);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import chalk from
|
|
2
|
-
import { checkConfigFile, readConfig } from
|
|
3
|
-
import { getAvailableUpdates } from
|
|
4
|
-
import { getDepName, getDepPinnedVersion } from
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { checkConfigFile, readConfig } from "../mops.js";
|
|
3
|
+
import { getAvailableUpdates } from "./available-updates.js";
|
|
4
|
+
import { getDepName, getDepPinnedVersion } from "../helpers/get-dep-name.js";
|
|
5
5
|
export async function outdated() {
|
|
6
6
|
if (!checkConfigFile()) {
|
|
7
7
|
return;
|
|
@@ -9,15 +9,19 @@ export async function outdated() {
|
|
|
9
9
|
let config = readConfig();
|
|
10
10
|
let available = await getAvailableUpdates(config);
|
|
11
11
|
if (available.length === 0) {
|
|
12
|
-
console.log(chalk.green(
|
|
12
|
+
console.log(chalk.green("All dependencies are up to date!"));
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
|
-
console.log(
|
|
16
|
-
let allDeps = [
|
|
15
|
+
console.log("Available updates:");
|
|
16
|
+
let allDeps = [
|
|
17
|
+
...Object.keys(config.dependencies || {}),
|
|
18
|
+
...Object.keys(config["dev-dependencies"] || {}),
|
|
19
|
+
];
|
|
17
20
|
for (let dep of available) {
|
|
18
21
|
let name = allDeps.find((d) => {
|
|
19
22
|
let pinnedVersion = getDepPinnedVersion(d);
|
|
20
|
-
return getDepName(d) === dep[0] &&
|
|
23
|
+
return (getDepName(d) === dep[0] &&
|
|
24
|
+
(!pinnedVersion || dep[1].startsWith(pinnedVersion)));
|
|
21
25
|
}) || dep[0];
|
|
22
26
|
console.log(`${name} ${chalk.yellow(dep[1])} -> ${chalk.green(dep[2])}`);
|
|
23
27
|
}
|
package/dist/commands/owner.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import process from
|
|
2
|
-
import chalk from
|
|
3
|
-
import { checkConfigFile, getIdentity, readConfig } from
|
|
4
|
-
import { mainActor } from
|
|
5
|
-
import { Principal } from
|
|
6
|
-
import prompts from
|
|
1
|
+
import process from "node:process";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { checkConfigFile, getIdentity, readConfig } from "../mops.js";
|
|
4
|
+
import { mainActor } from "../api/actors.js";
|
|
5
|
+
import { Principal } from "@icp-sdk/core/principal";
|
|
6
|
+
import prompts from "prompts";
|
|
7
7
|
export async function printOwners() {
|
|
8
8
|
if (!checkConfigFile()) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
let config = readConfig();
|
|
12
12
|
let actor = await mainActor();
|
|
13
|
-
let owners = await actor.getPackageOwners(config.package?.name ||
|
|
13
|
+
let owners = await actor.getPackageOwners(config.package?.name || "");
|
|
14
14
|
console.log(`Owners of package ${chalk.bold(config.package?.name)}:`);
|
|
15
15
|
for (let owner of owners) {
|
|
16
16
|
console.log(owner.toText());
|
|
@@ -25,13 +25,13 @@ export async function addOwner(owner, yes = false) {
|
|
|
25
25
|
if (!yes) {
|
|
26
26
|
let promptsConfig = {
|
|
27
27
|
onCancel() {
|
|
28
|
-
console.log(
|
|
28
|
+
console.log("aborted");
|
|
29
29
|
process.exit(0);
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
let { confirm } = await prompts({
|
|
33
|
-
type:
|
|
34
|
-
name:
|
|
33
|
+
type: "confirm",
|
|
34
|
+
name: "confirm",
|
|
35
35
|
message: `Are you sure you want to add owner ${chalk.yellow(owner)} to ${chalk.yellow(config.package?.name)} package?`,
|
|
36
36
|
initial: true,
|
|
37
37
|
}, promptsConfig);
|
|
@@ -41,13 +41,13 @@ export async function addOwner(owner, yes = false) {
|
|
|
41
41
|
}
|
|
42
42
|
let identity = await getIdentity();
|
|
43
43
|
let actor = await mainActor(identity);
|
|
44
|
-
let res = await actor.addOwner(config.package?.name ||
|
|
45
|
-
if (
|
|
46
|
-
console.log(chalk.green(
|
|
44
|
+
let res = await actor.addOwner(config.package?.name || "", principal);
|
|
45
|
+
if ("ok" in res) {
|
|
46
|
+
console.log(chalk.green("Success!"));
|
|
47
47
|
console.log(`Added owner ${chalk.bold(owner)} to package ${chalk.bold(config.package?.name)}`);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
console.error(chalk.red(
|
|
50
|
+
console.error(chalk.red("Error: ") + res.err);
|
|
51
51
|
process.exit(1);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -60,13 +60,13 @@ export async function removeOwner(owner, yes = false) {
|
|
|
60
60
|
if (!yes) {
|
|
61
61
|
let promptsConfig = {
|
|
62
62
|
onCancel() {
|
|
63
|
-
console.log(
|
|
63
|
+
console.log("aborted");
|
|
64
64
|
process.exit(0);
|
|
65
65
|
},
|
|
66
66
|
};
|
|
67
67
|
let { confirm } = await prompts({
|
|
68
|
-
type:
|
|
69
|
-
name:
|
|
68
|
+
type: "confirm",
|
|
69
|
+
name: "confirm",
|
|
70
70
|
message: `Are you sure you want to remove owner ${chalk.red(owner)} from ${chalk.red(config.package?.name)} package?`,
|
|
71
71
|
initial: true,
|
|
72
72
|
}, promptsConfig);
|
|
@@ -76,13 +76,13 @@ export async function removeOwner(owner, yes = false) {
|
|
|
76
76
|
}
|
|
77
77
|
let identity = await getIdentity();
|
|
78
78
|
let actor = await mainActor(identity);
|
|
79
|
-
let res = await actor.removeOwner(config.package?.name ||
|
|
80
|
-
if (
|
|
81
|
-
console.log(chalk.green(
|
|
79
|
+
let res = await actor.removeOwner(config.package?.name || "", principal);
|
|
80
|
+
if ("ok" in res) {
|
|
81
|
+
console.log(chalk.green("Success!"));
|
|
82
82
|
console.log(`Removed owner ${chalk.bold(owner)} from package ${chalk.bold(config.package?.name)}`);
|
|
83
83
|
}
|
|
84
84
|
else {
|
|
85
|
-
console.error(chalk.red(
|
|
85
|
+
console.error(chalk.red("Error: ") + res.err);
|
|
86
86
|
process.exit(1);
|
|
87
87
|
}
|
|
88
88
|
}
|