ic-mops 0.39.2 → 0.41.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 +0 -0
- package/.gitignore +1 -0
- package/.npmrc +2 -1
- package/CHANGELOG.md +8 -0
- package/DEVELOPMENT.md +25 -0
- package/README.md +0 -0
- package/api/actors.ts +2 -2
- package/api/downloadPackageFiles.ts +9 -6
- package/api/getHighestVersion.ts +1 -1
- package/api/index.ts +0 -0
- package/api/network.ts +1 -1
- package/api/resolveVersion.ts +1 -1
- package/bundle/bench/bench-canister.mo +87 -0
- package/bundle/bench/user-bench.mo +14 -0
- package/bundle/bin/moc-wrapper.sh +3 -0
- package/bundle/bin/mops.js +3 -0
- package/bundle/cli.js +88 -0
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +26 -0
- package/bundle/declarations/bench/bench.did.d.ts +29 -0
- package/bundle/declarations/bench/bench.did.js +26 -0
- package/bundle/declarations/bench/index.d.ts +50 -0
- package/bundle/declarations/bench/index.js +41 -0
- package/bundle/declarations/main/index.d.ts +50 -0
- package/bundle/declarations/main/index.js +41 -0
- package/bundle/declarations/main/main.did +426 -0
- package/bundle/declarations/main/main.did.d.ts +352 -0
- package/bundle/declarations/main/main.did.js +404 -0
- package/bundle/declarations/storage/index.d.ts +50 -0
- package/bundle/declarations/storage/index.js +30 -0
- package/bundle/declarations/storage/storage.did +46 -0
- package/bundle/declarations/storage/storage.did.d.ts +37 -0
- package/bundle/declarations/storage/storage.did.js +38 -0
- package/bundle/package.json +31 -0
- package/bundle/templates/README.md +13 -0
- package/bundle/templates/licenses/Apache-2.0 +202 -0
- package/bundle/templates/licenses/Apache-2.0-NOTICE +13 -0
- package/bundle/templates/licenses/MIT +21 -0
- package/bundle/templates/mops-publish.yml +17 -0
- package/bundle/templates/mops-test.yml +22 -0
- package/bundle/templates/src/lib.mo +15 -0
- package/bundle/templates/test/lib.test.mo +4 -0
- package/bundle-package-json.ts +14 -0
- package/cache.ts +3 -3
- package/cli.ts +25 -21
- package/commands/add.ts +6 -6
- package/commands/available-updates.ts +2 -2
- package/commands/bench/bench-canister.mo +0 -0
- package/commands/bench/user-bench.mo +0 -0
- package/commands/bench-replica.ts +10 -10
- package/commands/bench.ts +96 -56
- package/commands/bump.ts +2 -2
- package/commands/docs.ts +1 -1
- package/commands/import-identity.ts +2 -2
- package/commands/init.ts +9 -9
- package/commands/install-all.ts +4 -4
- package/commands/install-local.ts +1 -1
- package/commands/install.ts +2 -2
- package/commands/outdated.ts +0 -0
- package/commands/publish.ts +34 -35
- package/commands/remove.ts +8 -8
- package/commands/search.ts +2 -2
- package/commands/self.ts +75 -0
- package/commands/sources.ts +0 -0
- package/commands/sync.ts +8 -8
- package/commands/template.ts +11 -12
- package/commands/test/mmf1.ts +18 -18
- package/commands/test/reporters/compact-reporter.ts +5 -5
- package/commands/test/reporters/files-reporter.ts +3 -3
- package/commands/test/reporters/reporter.ts +3 -3
- package/commands/test/reporters/silent-reporter.ts +4 -4
- package/commands/test/reporters/verbose-reporter.ts +3 -3
- package/commands/test/test.ts +10 -10
- package/commands/test/utils.ts +1 -1
- package/commands/toolchain/index.ts +9 -9
- package/commands/toolchain/moc.ts +2 -2
- package/commands/toolchain/pocket-ic.ts +6 -31
- package/commands/toolchain/toolchain-utils.ts +11 -11
- package/commands/toolchain/wasmtime.ts +2 -2
- package/commands/transfer-ownership.ts +2 -2
- package/commands/update.ts +4 -4
- package/commands/user.ts +2 -2
- package/commands/whoami.ts +0 -0
- package/declarations/bench/bench.did.d.ts +3 -0
- package/declarations/main/main.did +27 -1
- package/declarations/main/main.did.d.ts +26 -1
- package/declarations/main/main.did.js +27 -1
- package/declarations/storage/index.d.ts +0 -0
- package/declarations/storage/index.js +0 -0
- package/declarations/storage/storage.did +0 -0
- package/declarations/storage/storage.did.d.ts +0 -0
- package/declarations/storage/storage.did.js +0 -0
- package/dist/api/downloadPackageFiles.d.ts +1 -1
- package/dist/api/downloadPackageFiles.js +4 -0
- package/dist/bin/moc-wrapper.sh +3 -0
- package/dist/bin/mops.d.ts +1 -1
- package/dist/bin/mops.js +2 -1
- package/dist/bundle-package-json.d.ts +1 -0
- package/dist/bundle-package-json.js +11 -0
- package/dist/check-requirements.d.ts +3 -0
- package/dist/check-requirements.js +39 -0
- package/dist/cli.js +19 -18
- package/dist/commands/bench/bench-canister.mo +0 -0
- package/dist/commands/bench/user-bench.mo +0 -0
- package/dist/commands/bench-replica.d.ts +3 -1
- package/dist/commands/bench-replica.js +2 -2
- package/dist/commands/bench.d.ts +5 -2
- package/dist/commands/bench.js +66 -29
- package/dist/commands/init.js +1 -1
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +25 -25
- package/dist/commands/self.d.ts +3 -0
- package/dist/commands/self.js +62 -0
- package/dist/commands/template.js +9 -10
- package/dist/commands/test/mmf1.js +1 -1
- package/dist/commands/test/test.js +2 -2
- package/dist/commands/toolchain/pocket-ic.d.ts +1 -5
- package/dist/commands/toolchain/pocket-ic.js +4 -27
- package/dist/commands/toolchain/toolchain-utils.d.ts +1 -1
- package/dist/commands/toolchain/toolchain-utils.js +7 -7
- package/dist/commands/transfer-ownership.js +1 -1
- package/dist/declarations/bench/bench.did.d.ts +3 -0
- package/dist/declarations/main/main.did +27 -1
- package/dist/declarations/main/main.did.d.ts +26 -1
- package/dist/declarations/main/main.did.js +27 -1
- package/dist/declarations/storage/index.d.ts +0 -0
- package/dist/declarations/storage/index.js +0 -0
- package/dist/declarations/storage/storage.did +0 -0
- package/dist/declarations/storage/storage.did.d.ts +0 -0
- package/dist/declarations/storage/storage.did.js +0 -0
- package/dist/helpers/find-changelog-entry.d.ts +1 -0
- package/dist/helpers/find-changelog-entry.js +24 -0
- package/dist/mops.d.ts +1 -0
- package/dist/mops.js +5 -1
- package/dist/package.json +20 -26
- package/dist/release-cli.d.ts +1 -0
- package/dist/release-cli.js +37 -0
- package/dist/remove-scripts.d.ts +1 -0
- package/dist/remove-scripts.js +5 -0
- package/dist/templates/README.md +0 -0
- package/dist/templates/licenses/Apache-2.0 +0 -0
- package/dist/templates/licenses/Apache-2.0-NOTICE +0 -0
- package/dist/templates/licenses/MIT +0 -0
- package/dist/templates/mops-publish.yml +0 -0
- package/dist/templates/mops-test.yml +0 -0
- package/dist/templates/src/lib.mo +0 -0
- package/dist/templates/test/lib.test.mo +0 -0
- package/dist/templates.d.ts +1 -0
- package/dist/templates.js +4 -0
- package/dist/vessel.js +1 -1
- package/global.d.ts +0 -0
- package/helpers/find-changelog-entry.ts +27 -0
- package/helpers/get-dfx-version.ts +1 -1
- package/helpers/get-moc-path.ts +1 -1
- package/helpers/get-moc-version.ts +1 -1
- package/integrity.ts +16 -16
- package/mops.ts +22 -17
- package/notify-installs.ts +2 -2
- package/package.json +28 -19
- package/parallel.ts +1 -1
- package/pem.ts +5 -5
- package/release-cli.ts +62 -0
- package/remove-scripts.ts +6 -0
- package/resolve-packages.ts +9 -9
- package/templates/README.md +0 -0
- package/templates/licenses/Apache-2.0 +0 -0
- package/templates/licenses/Apache-2.0-NOTICE +0 -0
- package/templates/licenses/MIT +0 -0
- package/templates/mops-publish.yml +0 -0
- package/templates/mops-test.yml +0 -0
- package/templates/src/lib.mo +0 -0
- package/templates/test/lib.test.mo +0 -0
- package/templates.ts +5 -0
- package/tsconfig.json +1 -1
- package/types.ts +25 -25
- package/vessel.ts +16 -16
- package/commands/self-update.ts +0 -6
- package/dist/commands/replica.d.ts +0 -36
- package/dist/commands/replica.js +0 -103
- package/dist/commands/self-update.d.ts +0 -3
- package/dist/commands/self-update.js +0 -5
- /package/bin/{mops.ts → mops.js} +0 -0
package/dist/commands/replica.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { execSync, spawn } from 'node:child_process';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import fs from 'node:fs';
|
|
4
|
-
import { execaCommand } from 'execa';
|
|
5
|
-
import { PocketIc } from 'pic-ic';
|
|
6
|
-
import { readConfig } from '../mops.js';
|
|
7
|
-
import { createActor, idlFactory } from '../declarations/bench/index.js';
|
|
8
|
-
import { toolchain } from './toolchain/index.js';
|
|
9
|
-
export class Replica {
|
|
10
|
-
constructor(type, cwd, verbose = false) {
|
|
11
|
-
this.verbose = false;
|
|
12
|
-
this.canisters = {};
|
|
13
|
-
this.type = type;
|
|
14
|
-
this.verbose = verbose;
|
|
15
|
-
this.cwd = cwd;
|
|
16
|
-
}
|
|
17
|
-
async start() {
|
|
18
|
-
console.log(`Starting ${this.type} replica...`);
|
|
19
|
-
if (this.type == 'dfx') {
|
|
20
|
-
await this.stop();
|
|
21
|
-
fs.writeFileSync(path.join(this.cwd, 'dfx.json'), JSON.stringify(this.dfxJson(''), null, 2));
|
|
22
|
-
// this.process = spawn('dfx start --background --clean --artificial-delay 0' + (this.verbose ? '' : ' -qqqq'), {cwd: this.cwd, stdio: ['inherit', this.verbose ? 'inherit' : 'ignore', 'inherit']});
|
|
23
|
-
this.process = spawn('dfx', ['start', '--background', '--clean', '--artificial-delay=0', this.verbose ? '' : ' -qqqq'].filter(x => x), { cwd: this.cwd });
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
let pocketIcBin = await toolchain.bin('pocket-ic');
|
|
27
|
-
let config = readConfig();
|
|
28
|
-
if (config.toolchain?.['pocket-ic'] !== '1.0.0') {
|
|
29
|
-
console.error('Currently only pocket-ic 1.0.0 is supported');
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
this.pocketIc = await PocketIc.create(pocketIcBin);
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
this.process = this.pocketIc.server.serverProcess;
|
|
35
|
-
}
|
|
36
|
-
await new Promise((resolve, reject) => {
|
|
37
|
-
console.log(1);
|
|
38
|
-
this.process?.on('data', (data) => {
|
|
39
|
-
console.log(111, data);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
return this.process;
|
|
43
|
-
}
|
|
44
|
-
async stop() {
|
|
45
|
-
if (this.type == 'dfx') {
|
|
46
|
-
execSync('dfx stop' + (this.verbose ? '' : ' -qqqq'), { cwd: this.cwd, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe'] });
|
|
47
|
-
}
|
|
48
|
-
else if (this.pocketIc) {
|
|
49
|
-
await this.pocketIc.tearDown();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async deploy(name, wasm, cwd = process.cwd()) {
|
|
53
|
-
if (this.type === 'dfx') {
|
|
54
|
-
await execaCommand(`dfx deploy ${name} --mode reinstall --yes --identity anonymous`, { cwd, stdio: this.verbose ? 'pipe' : ['pipe', 'ignore', 'pipe'] });
|
|
55
|
-
let canisterId = execSync(`dfx canister id ${name}`, { cwd }).toString().trim();
|
|
56
|
-
let actor = await createActor(canisterId, {
|
|
57
|
-
agentOptions: {
|
|
58
|
-
host: 'http://127.0.0.1:4944',
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
this.canisters[name] = { cwd, canisterId, actor };
|
|
62
|
-
}
|
|
63
|
-
else if (this.pocketIc) {
|
|
64
|
-
let { canisterId, actor } = await this.pocketIc.setupCanister(idlFactory, wasm);
|
|
65
|
-
this.canisters[name] = {
|
|
66
|
-
cwd,
|
|
67
|
-
canisterId: canisterId.toText(),
|
|
68
|
-
actor,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
getActor(name) {
|
|
73
|
-
return this.canisters[name]?.actor;
|
|
74
|
-
}
|
|
75
|
-
getCanisterId(name) {
|
|
76
|
-
return this.canisters[name]?.canisterId || '';
|
|
77
|
-
}
|
|
78
|
-
dfxJson(canisterName) {
|
|
79
|
-
let canisters = {};
|
|
80
|
-
if (canisterName) {
|
|
81
|
-
canisters[canisterName] = {
|
|
82
|
-
type: 'custom',
|
|
83
|
-
wasm: 'canister.wasm',
|
|
84
|
-
candid: 'canister.did',
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
version: 1,
|
|
89
|
-
canisters,
|
|
90
|
-
defaults: {
|
|
91
|
-
build: {
|
|
92
|
-
packtool: 'mops sources',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
networks: {
|
|
96
|
-
local: {
|
|
97
|
-
type: 'ephemeral',
|
|
98
|
-
bind: '127.0.0.1:4944',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
}
|
/package/bin/{mops.ts → mops.js}
RENAMED
|
File without changes
|