ic-mops 0.36.1 → 0.37.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/bin/moc-wrapper.sh +3 -0
- package/bin/mops.ts +3 -0
- package/cache.ts +2 -2
- package/cli.ts +61 -4
- package/commands/add.ts +3 -1
- package/commands/bench-replica.ts +5 -3
- package/commands/docs.ts +9 -6
- package/commands/install-all.ts +7 -2
- package/commands/install.ts +5 -1
- package/commands/publish.ts +2 -0
- package/commands/test/test.ts +42 -19
- package/commands/toolchain/index.ts +325 -0
- package/commands/toolchain/moc.ts +58 -0
- package/commands/toolchain/pocket-ic.ts +74 -0
- package/commands/toolchain/toolchain-utils.ts +83 -0
- package/commands/toolchain/wasmtime.ts +45 -0
- package/dist/bin/mops.d.ts +1 -1
- package/dist/cache.js +2 -2
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +52 -3
- package/dist/commands/add.js +2 -1
- package/dist/commands/bench-replica.d.ts +1 -1
- package/dist/commands/bench-replica.js +5 -3
- package/dist/commands/docs.js +9 -6
- package/dist/commands/install-all.js +5 -2
- package/dist/commands/install.js +5 -1
- package/dist/commands/publish.js +1 -0
- package/dist/commands/test/test.js +41 -19
- package/dist/commands/toolchain/index.d.ts +26 -0
- package/dist/commands/toolchain/index.js +274 -0
- package/dist/commands/toolchain/moc.d.ts +5 -1
- package/dist/commands/toolchain/moc.js +18 -6
- package/dist/commands/toolchain/mocv.js +0 -1
- package/dist/commands/toolchain/pocket-ic.d.ts +12 -0
- package/dist/commands/toolchain/pocket-ic.js +62 -0
- package/dist/commands/toolchain/toolchain-utils.d.ts +2 -2
- package/dist/commands/toolchain/toolchain-utils.js +22 -6
- package/dist/commands/toolchain/wasmtime.d.ts +5 -1
- package/dist/commands/toolchain/wasmtime.js +16 -4
- package/dist/integrity.js +40 -15
- package/dist/mops.js +2 -2
- package/dist/package.json +9 -4
- package/dist/pic-js/examples/clock/tests/clock/index.d.ts +1 -0
- package/dist/pic-js/examples/clock/tests/clock/index.js +5 -0
- package/dist/pic-js/examples/clock/tests/jest.config.d.ts +3 -0
- package/dist/pic-js/examples/clock/tests/jest.config.js +8 -0
- package/dist/pic-js/examples/clock/tests/src/clock.spec.d.ts +1 -0
- package/dist/pic-js/examples/clock/tests/src/clock.spec.js +48 -0
- package/dist/pic-js/examples/counter/tests/counter/index.d.ts +1 -0
- package/dist/pic-js/examples/counter/tests/counter/index.js +5 -0
- package/dist/pic-js/examples/counter/tests/jest.config.d.ts +3 -0
- package/dist/pic-js/examples/counter/tests/jest.config.js +8 -0
- package/dist/pic-js/examples/counter/tests/src/counter.spec.d.ts +1 -0
- package/dist/pic-js/examples/counter/tests/src/counter.spec.js +80 -0
- package/dist/pic-js/examples/todo/tests/jest.config.d.ts +3 -0
- package/dist/pic-js/examples/todo/tests/jest.config.js +8 -0
- package/dist/pic-js/examples/todo/tests/src/todo.spec.d.ts +1 -0
- package/dist/pic-js/examples/todo/tests/src/todo.spec.js +211 -0
- package/dist/pic-js/examples/todo/tests/todo/index.d.ts +1 -0
- package/dist/pic-js/examples/todo/tests/todo/index.js +5 -0
- package/dist/pic-js/packages/pic/src/error.d.ts +12 -0
- package/dist/pic-js/packages/pic/src/error.js +36 -0
- package/dist/pic-js/packages/pic/src/http-client.d.ts +15 -0
- package/dist/pic-js/packages/pic/src/http-client.js +37 -0
- package/dist/pic-js/packages/pic/src/identity.d.ts +66 -0
- package/dist/pic-js/packages/pic/src/identity.js +86 -0
- package/dist/pic-js/packages/pic/src/index.d.ts +4 -0
- package/dist/pic-js/packages/pic/src/index.js +8 -0
- package/dist/pic-js/packages/pic/src/management-canister.d.ts +30 -0
- package/dist/pic-js/packages/pic/src/management-canister.js +43 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-actor.d.ts +83 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-actor.js +58 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-client-types.d.ts +61 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-client-types.js +2 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-client.d.ts +24 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-client.js +123 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-server.d.ts +10 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-server.js +55 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-types.d.ts +40 -0
- package/dist/pic-js/packages/pic/src/pocket-ic-types.js +2 -0
- package/dist/pic-js/packages/pic/src/pocket-ic.d.ts +447 -0
- package/dist/pic-js/packages/pic/src/pocket-ic.js +551 -0
- package/dist/pic-js/packages/pic/src/util/candid.d.ts +1 -0
- package/dist/pic-js/packages/pic/src/util/candid.js +7 -0
- package/dist/pic-js/packages/pic/src/util/encoding.d.ts +5 -0
- package/dist/pic-js/packages/pic/src/util/encoding.js +19 -0
- package/dist/pic-js/packages/pic/src/util/fs.d.ts +4 -0
- package/dist/pic-js/packages/pic/src/util/fs.js +29 -0
- package/dist/pic-js/packages/pic/src/util/index.d.ts +5 -0
- package/dist/pic-js/packages/pic/src/util/index.js +21 -0
- package/dist/pic-js/packages/pic/src/util/os.d.ts +4 -0
- package/dist/pic-js/packages/pic/src/util/os.js +19 -0
- package/dist/pic-js/packages/pic/src/util/poll.d.ts +5 -0
- package/dist/pic-js/packages/pic/src/util/poll.js +28 -0
- package/dist/templates/mops-test.yml +4 -4
- package/dist/types.d.ts +7 -0
- package/dist/vessel.js +5 -1
- package/global.d.ts +2 -1
- package/integrity.ts +57 -17
- package/mops.ts +3 -3
- package/package.json +9 -4
- package/templates/mops-test.yml +4 -4
- package/types.ts +10 -1
- package/vessel.ts +6 -1
- package/bun.lockb +0 -0
- package/cli-local.ts +0 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.poll = void 0;
|
|
4
|
+
const DEFAULT_POLL_INTERVAL_MS = 20;
|
|
5
|
+
const DEFAULT_POLL_TIMEOUT_MS = 5000;
|
|
6
|
+
async function poll(cb, options) {
|
|
7
|
+
const intervalMs = options?.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
8
|
+
const timeoutMs = options?.timeoutMs ?? DEFAULT_POLL_TIMEOUT_MS;
|
|
9
|
+
const startTimeMs = Date.now();
|
|
10
|
+
return new Promise((resolve, reject) => {
|
|
11
|
+
async function runPoll() {
|
|
12
|
+
const currentTimeMs = Date.now();
|
|
13
|
+
try {
|
|
14
|
+
const result = await cb();
|
|
15
|
+
clearInterval(interval);
|
|
16
|
+
return resolve(result);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
if (currentTimeMs - startTimeMs >= timeoutMs) {
|
|
20
|
+
clearInterval(interval);
|
|
21
|
+
return reject(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const interval = setInterval(runPoll, intervalMs);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.poll = poll;
|
|
@@ -15,10 +15,7 @@ jobs:
|
|
|
15
15
|
- uses: actions/checkout@v3
|
|
16
16
|
- uses: actions/setup-node@v3
|
|
17
17
|
with:
|
|
18
|
-
node-version:
|
|
19
|
-
|
|
20
|
-
- name: install moc
|
|
21
|
-
run: npx mocv use latest
|
|
18
|
+
node-version: 20
|
|
22
19
|
|
|
23
20
|
- name: install mops
|
|
24
21
|
run: npm i ic-mops -g
|
|
@@ -26,5 +23,8 @@ jobs:
|
|
|
26
23
|
- name: install mops packages
|
|
27
24
|
run: mops install
|
|
28
25
|
|
|
26
|
+
- name: install moc
|
|
27
|
+
run: mops toolchain use moc latest
|
|
28
|
+
|
|
29
29
|
- name: run tests
|
|
30
30
|
run: mops test
|
package/dist/types.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type Config = {
|
|
|
17
17
|
};
|
|
18
18
|
dependencies?: Dependencies;
|
|
19
19
|
'dev-dependencies'?: Dependencies;
|
|
20
|
+
toolchain?: Toolchain;
|
|
20
21
|
};
|
|
21
22
|
export type Dependencies = Record<string, Dependency>;
|
|
22
23
|
export type Dependency = {
|
|
@@ -25,3 +26,9 @@ export type Dependency = {
|
|
|
25
26
|
repo?: string;
|
|
26
27
|
path?: string;
|
|
27
28
|
};
|
|
29
|
+
export type Toolchain = {
|
|
30
|
+
moc?: string;
|
|
31
|
+
wasmtime?: string;
|
|
32
|
+
'pocket-ic'?: string;
|
|
33
|
+
};
|
|
34
|
+
export type Tool = 'moc' | 'wasmtime' | 'pocket-ic';
|
package/dist/vessel.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { deleteSync } from 'del';
|
|
4
4
|
import { execaCommand } from 'execa';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
|
-
import
|
|
6
|
+
import { createLogUpdate } from 'log-update';
|
|
7
7
|
import got from 'got';
|
|
8
8
|
import decompress from 'decompress';
|
|
9
9
|
import { pipeline } from 'stream';
|
|
@@ -119,6 +119,7 @@ export const installFromGithub = async (name, repo, { verbose = false, dep = fal
|
|
|
119
119
|
let { branch, commitHash } = parseGithubURL(repo);
|
|
120
120
|
let dir = formatGithubDir(name, repo);
|
|
121
121
|
let cacheName = `_github/${name}#${branch}` + (commitHash ? `@${commitHash}` : '');
|
|
122
|
+
let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
|
|
122
123
|
if (existsSync(dir)) {
|
|
123
124
|
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${repo} (local cache)`);
|
|
124
125
|
}
|
|
@@ -145,6 +146,9 @@ export const installFromGithub = async (name, repo, { verbose = false, dep = fal
|
|
|
145
146
|
if (verbose) {
|
|
146
147
|
silent || logUpdate.done();
|
|
147
148
|
}
|
|
149
|
+
else {
|
|
150
|
+
logUpdate.clear();
|
|
151
|
+
}
|
|
148
152
|
const config = await readVesselConfig(dir, { silent });
|
|
149
153
|
if (config) {
|
|
150
154
|
for (const { name, repo } of config.dependencies) {
|
package/global.d.ts
CHANGED
package/integrity.ts
CHANGED
|
@@ -2,16 +2,28 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import {sha256} from '@noble/hashes/sha256';
|
|
4
4
|
import {bytesToHex} from '@noble/hashes/utils';
|
|
5
|
-
import {getDependencyType, getRootDir} from './mops.js';
|
|
5
|
+
import {getDependencyType, getRootDir, readConfig} from './mops.js';
|
|
6
6
|
import {mainActor} from './api/actors.js';
|
|
7
7
|
import {resolvePackages} from './resolve-packages.js';
|
|
8
8
|
|
|
9
|
+
type LockFileGeneric = {
|
|
10
|
+
version: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
9
13
|
type LockFileV1 = {
|
|
10
14
|
version: 1;
|
|
11
15
|
mopsTomlHash: string;
|
|
12
16
|
hashes: Record<string, Record<string, string>>;
|
|
13
17
|
};
|
|
14
18
|
|
|
19
|
+
type LockFileV2 = {
|
|
20
|
+
version: 2;
|
|
21
|
+
mopsTomlDepsHash: string;
|
|
22
|
+
hashes: Record<string, Record<string, string>>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type LockFile = LockFileV1 | LockFileV2;
|
|
26
|
+
|
|
15
27
|
export async function checkIntegrity(lock?: 'check' | 'update' | 'ignore') {
|
|
16
28
|
let force = !!lock;
|
|
17
29
|
|
|
@@ -63,6 +75,19 @@ function getMopsTomlHash(): string {
|
|
|
63
75
|
return bytesToHex(sha256(fs.readFileSync(getRootDir() + '/mops.toml')));
|
|
64
76
|
}
|
|
65
77
|
|
|
78
|
+
function getMopsTomlDepsHash(): string {
|
|
79
|
+
let config = readConfig();
|
|
80
|
+
let deps = config.dependencies || {};
|
|
81
|
+
let devDeps = config['dev-dependencies'] || {};
|
|
82
|
+
let allDeps = {...deps, ...devDeps};
|
|
83
|
+
// sort allDeps by key
|
|
84
|
+
let sortedDeps = Object.keys(allDeps).sort().reduce((acc, key) => {
|
|
85
|
+
acc[key] = allDeps[key]?.version || allDeps[key]?.repo || allDeps[key]?.path || '';
|
|
86
|
+
return acc;
|
|
87
|
+
}, {} as Record<string, string>);
|
|
88
|
+
return bytesToHex(sha256(JSON.stringify(sortedDeps)));
|
|
89
|
+
}
|
|
90
|
+
|
|
66
91
|
// compare hashes of local files with hashes from the registry
|
|
67
92
|
export async function checkRemote() {
|
|
68
93
|
let fileHashesFromRegistry = await getFileHashesFromRegistry();
|
|
@@ -88,18 +113,18 @@ export async function updateLockFile() {
|
|
|
88
113
|
|
|
89
114
|
// if lock file exists and mops.toml hasn't changed, don't update it
|
|
90
115
|
if (fs.existsSync(lockFile)) {
|
|
91
|
-
let lockFileJson:
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
116
|
+
let lockFileJson: LockFileV2 = JSON.parse(fs.readFileSync(lockFile).toString());
|
|
117
|
+
let mopsTomlDepsHash = getMopsTomlDepsHash();
|
|
118
|
+
if (mopsTomlDepsHash === lockFileJson.mopsTomlDepsHash) {
|
|
94
119
|
return;
|
|
95
120
|
}
|
|
96
121
|
}
|
|
97
122
|
|
|
98
123
|
let fileHashes = await getFileHashesFromRegistry();
|
|
99
124
|
|
|
100
|
-
let lockFileJson:
|
|
101
|
-
version:
|
|
102
|
-
|
|
125
|
+
let lockFileJson: LockFileV2 = {
|
|
126
|
+
version: 2,
|
|
127
|
+
mopsTomlDepsHash: getMopsTomlDepsHash(),
|
|
103
128
|
hashes: fileHashes.reduce((acc, [packageId, fileHashes]) => {
|
|
104
129
|
acc[packageId] = fileHashes.reduce((acc, [fileId, hash]) => {
|
|
105
130
|
acc[fileId] = bytesToHex(new Uint8Array(hash));
|
|
@@ -126,23 +151,38 @@ export async function checkLockFile(force = false) {
|
|
|
126
151
|
return;
|
|
127
152
|
}
|
|
128
153
|
|
|
129
|
-
let
|
|
154
|
+
let lockFileJsonGeneric: LockFileGeneric = JSON.parse(fs.readFileSync(lockFile).toString());
|
|
130
155
|
let packageIds = await getResolvedMopsPackageIds();
|
|
131
156
|
|
|
132
157
|
// check lock file version
|
|
133
|
-
if (
|
|
158
|
+
if (lockFileJsonGeneric.version !== 1 && lockFileJsonGeneric.version !== 2) {
|
|
134
159
|
console.error('Integrity check failed');
|
|
135
|
-
console.error(`Invalid lock file version: ${
|
|
160
|
+
console.error(`Invalid lock file version: ${lockFileJsonGeneric.version}. Supported versions: 1`);
|
|
136
161
|
process.exit(1);
|
|
137
162
|
}
|
|
138
163
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
164
|
+
let lockFileJson = lockFileJsonGeneric as LockFile;
|
|
165
|
+
|
|
166
|
+
// V1: check mops.toml hash
|
|
167
|
+
if (lockFileJson.version === 1) {
|
|
168
|
+
if (lockFileJson.mopsTomlHash !== getMopsTomlHash()) {
|
|
169
|
+
console.error('Integrity check failed');
|
|
170
|
+
console.error('Mismatched mops.toml hash');
|
|
171
|
+
console.error(`Locked hash: ${lockFileJson.mopsTomlHash}`);
|
|
172
|
+
console.error(`Actual hash: ${getMopsTomlHash()}`);
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// V2: check mops.toml deps hash
|
|
178
|
+
if (lockFileJson.version === 2) {
|
|
179
|
+
if (lockFileJson.mopsTomlDepsHash !== getMopsTomlDepsHash()) {
|
|
180
|
+
console.error('Integrity check failed');
|
|
181
|
+
console.error('Mismatched mops.toml dependencies hash');
|
|
182
|
+
console.error(`Locked hash: ${lockFileJson.mopsTomlDepsHash}`);
|
|
183
|
+
console.error(`Actual hash: ${getMopsTomlDepsHash()}`);
|
|
184
|
+
process.exit(1);
|
|
185
|
+
}
|
|
146
186
|
}
|
|
147
187
|
|
|
148
188
|
// check number of packages
|
package/mops.ts
CHANGED
|
@@ -106,9 +106,9 @@ export let getIdentity = async (): Promise<Identity | undefined> => {
|
|
|
106
106
|
return undefined;
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
export function getClosestConfigFile(dir = process.cwd()) {
|
|
109
|
+
export function getClosestConfigFile(dir = process.cwd()) : string {
|
|
110
110
|
if (!path.basename(dir)) {
|
|
111
|
-
|
|
111
|
+
return '';
|
|
112
112
|
}
|
|
113
113
|
let configFile = path.join(dir, 'mops.toml');
|
|
114
114
|
if (fs.existsSync(configFile)) {
|
|
@@ -210,7 +210,7 @@ export function readConfig(configFile = getClosestConfigFile()): Config {
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
export function writeConfig(config: Config, configFile = getClosestConfigFile()) {
|
|
213
|
-
let resConfig: any =
|
|
213
|
+
let resConfig: any = JSON.parse(JSON.stringify(config));
|
|
214
214
|
|
|
215
215
|
let deps = resConfig.dependencies || {};
|
|
216
216
|
Object.entries(config.dependencies || {}).forEach(([name, {repo, path, version}]) => {
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.37.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
|
-
"mops": "dist/
|
|
6
|
+
"mops": "dist/bin/mops.js",
|
|
7
|
+
"moc-wrapper": "bin/moc-wrapper.sh"
|
|
7
8
|
},
|
|
8
9
|
"files": [
|
|
9
10
|
"*",
|
|
@@ -37,7 +38,6 @@
|
|
|
37
38
|
"@dfinity/identity": "^0.19.3",
|
|
38
39
|
"@dfinity/identity-secp256k1": "^0.19.3",
|
|
39
40
|
"@dfinity/principal": "^0.19.3",
|
|
40
|
-
"@hadronous/pic": "0.2.0",
|
|
41
41
|
"@iarna/toml": "^2.2.5",
|
|
42
42
|
"@noble/hashes": "1.3.2",
|
|
43
43
|
"as-table": "^1.0.55",
|
|
@@ -45,13 +45,15 @@
|
|
|
45
45
|
"camelcase": "^7.0.1",
|
|
46
46
|
"chalk": "^5.3.0",
|
|
47
47
|
"chokidar": "^3.5.3",
|
|
48
|
-
"commander": "
|
|
48
|
+
"commander": "11.1.0",
|
|
49
49
|
"debounce": "^1.2.1",
|
|
50
|
+
"decomp-tarxz": "0.1.1",
|
|
50
51
|
"decompress": "^4.2.1",
|
|
51
52
|
"del": "^7.0.0",
|
|
52
53
|
"dhall-to-json-cli": "^1.7.6",
|
|
53
54
|
"eslint": "^8.45.0",
|
|
54
55
|
"execa": "7.1.1",
|
|
56
|
+
"fs-extra": "11.2.0",
|
|
55
57
|
"get-folder-size": "^4.0.0",
|
|
56
58
|
"glob": "^10.3.3",
|
|
57
59
|
"globby": "^13.2.2",
|
|
@@ -63,7 +65,9 @@
|
|
|
63
65
|
"minimatch": "^9.0.3",
|
|
64
66
|
"ncp": "^2.0.0",
|
|
65
67
|
"node-fetch": "^3.3.2",
|
|
68
|
+
"octokit": "3.1.2",
|
|
66
69
|
"pem-file": "^1.0.1",
|
|
70
|
+
"pic-ic": "0.3.2",
|
|
67
71
|
"prompts": "^2.4.2",
|
|
68
72
|
"stream-to-promise": "^3.0.0",
|
|
69
73
|
"string-width": "7.0.0",
|
|
@@ -73,6 +77,7 @@
|
|
|
73
77
|
"@tsconfig/strictest": "^2.0.1",
|
|
74
78
|
"@types/debounce": "^1.2.1",
|
|
75
79
|
"@types/decompress": "^4.2.4",
|
|
80
|
+
"@types/fs-extra": "11.0.4",
|
|
76
81
|
"@types/glob": "^8.1.0",
|
|
77
82
|
"@types/ncp": "^2.0.5",
|
|
78
83
|
"@types/node": "^20.4.4",
|
package/templates/mops-test.yml
CHANGED
|
@@ -15,10 +15,7 @@ jobs:
|
|
|
15
15
|
- uses: actions/checkout@v3
|
|
16
16
|
- uses: actions/setup-node@v3
|
|
17
17
|
with:
|
|
18
|
-
node-version:
|
|
19
|
-
|
|
20
|
-
- name: install moc
|
|
21
|
-
run: npx mocv use latest
|
|
18
|
+
node-version: 20
|
|
22
19
|
|
|
23
20
|
- name: install mops
|
|
24
21
|
run: npm i ic-mops -g
|
|
@@ -26,5 +23,8 @@ jobs:
|
|
|
26
23
|
- name: install mops packages
|
|
27
24
|
run: mops install
|
|
28
25
|
|
|
26
|
+
- name: install moc
|
|
27
|
+
run: mops toolchain use moc latest
|
|
28
|
+
|
|
29
29
|
- name: run tests
|
|
30
30
|
run: mops test
|
package/types.ts
CHANGED
|
@@ -17,6 +17,7 @@ export type Config = {
|
|
|
17
17
|
};
|
|
18
18
|
dependencies?: Dependencies;
|
|
19
19
|
'dev-dependencies'?: Dependencies;
|
|
20
|
+
toolchain?: Toolchain;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export type Dependencies = Record<string, Dependency>;
|
|
@@ -26,4 +27,12 @@ export type Dependency = {
|
|
|
26
27
|
version?: string; // mops package
|
|
27
28
|
repo?: string; // github package
|
|
28
29
|
path?: string; // local package
|
|
29
|
-
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type Toolchain = {
|
|
33
|
+
moc?: string;
|
|
34
|
+
wasmtime?: string;
|
|
35
|
+
'pocket-ic'?: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type Tool = 'moc' | 'wasmtime' | 'pocket-ic';
|
package/vessel.ts
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import {deleteSync} from 'del';
|
|
4
4
|
import {execaCommand} from 'execa';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
|
-
import
|
|
6
|
+
import {createLogUpdate} from 'log-update';
|
|
7
7
|
import got from 'got';
|
|
8
8
|
import decompress from 'decompress';
|
|
9
9
|
import {pipeline} from 'stream';
|
|
@@ -153,6 +153,8 @@ export const installFromGithub = async (name: string, repo: string, {verbose = f
|
|
|
153
153
|
let dir = formatGithubDir(name, repo);
|
|
154
154
|
let cacheName = `_github/${name}#${branch}` + (commitHash ? `@${commitHash}` : '');
|
|
155
155
|
|
|
156
|
+
let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
|
|
157
|
+
|
|
156
158
|
if (existsSync(dir)) {
|
|
157
159
|
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${repo} (local cache)`);
|
|
158
160
|
}
|
|
@@ -184,6 +186,9 @@ export const installFromGithub = async (name: string, repo: string, {verbose = f
|
|
|
184
186
|
if (verbose) {
|
|
185
187
|
silent || logUpdate.done();
|
|
186
188
|
}
|
|
189
|
+
else {
|
|
190
|
+
logUpdate.clear();
|
|
191
|
+
}
|
|
187
192
|
|
|
188
193
|
const config = await readVesselConfig(dir, {silent});
|
|
189
194
|
|
package/bun.lockb
DELETED
|
Binary file
|
package/cli-local.ts
DELETED