ic-mops 0.39.2 → 0.40.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/.eslintrc.json +0 -0
- package/.gitignore +1 -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/cache.ts +3 -3
- package/cli.ts +3 -2
- 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 -9
- package/commands/remove.ts +8 -8
- package/commands/search.ts +2 -2
- package/commands/sources.ts +0 -0
- package/commands/sync.ts +8 -8
- package/commands/template.ts +2 -2
- 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/actors.d.ts +0 -0
- package/dist/api/actors.js +0 -0
- package/dist/api/downloadPackageFiles.d.ts +1 -1
- package/dist/api/downloadPackageFiles.js +4 -0
- package/dist/api/getHighestVersion.d.ts +0 -0
- package/dist/api/getHighestVersion.js +0 -0
- package/dist/api/index.d.ts +0 -0
- package/dist/api/index.js +0 -0
- package/dist/api/network.d.ts +0 -0
- package/dist/api/network.js +0 -0
- package/dist/api/resolveVersion.d.ts +0 -0
- package/dist/api/resolveVersion.js +0 -0
- package/dist/bin/moc-wrapper.sh +3 -0
- package/dist/bin/mops.d.ts +0 -0
- package/dist/bin/mops.js +0 -0
- package/dist/bundle-package-json.d.ts +1 -0
- package/dist/bundle-package-json.js +11 -0
- package/dist/cache.d.ts +0 -0
- package/dist/cache.js +0 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +1 -0
- package/dist/commands/add.d.ts +0 -0
- package/dist/commands/add.js +0 -0
- package/dist/commands/available-updates.d.ts +0 -0
- package/dist/commands/available-updates.js +0 -0
- 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/bump.d.ts +0 -0
- package/dist/commands/bump.js +0 -0
- package/dist/commands/docs.d.ts +0 -0
- package/dist/commands/docs.js +0 -0
- package/dist/commands/import-identity.d.ts +0 -0
- package/dist/commands/import-identity.js +0 -0
- package/dist/commands/init.d.ts +0 -0
- package/dist/commands/init.js +1 -1
- package/dist/commands/install-all.d.ts +0 -0
- package/dist/commands/install-all.js +0 -0
- package/dist/commands/install-local.d.ts +0 -0
- package/dist/commands/install-local.js +0 -0
- package/dist/commands/install.d.ts +0 -0
- package/dist/commands/install.js +0 -0
- package/dist/commands/outdated.d.ts +0 -0
- package/dist/commands/outdated.js +0 -0
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +24 -1
- package/dist/commands/remove.d.ts +0 -0
- package/dist/commands/remove.js +0 -0
- package/dist/commands/search.d.ts +0 -0
- package/dist/commands/search.js +0 -0
- package/dist/commands/self-update.d.ts +0 -0
- package/dist/commands/self-update.js +0 -0
- package/dist/commands/self.d.ts +3 -0
- package/dist/commands/self.js +62 -0
- package/dist/commands/sources.d.ts +0 -0
- package/dist/commands/sources.js +0 -0
- package/dist/commands/sync.d.ts +0 -0
- package/dist/commands/sync.js +0 -0
- package/dist/commands/template.d.ts +0 -0
- package/dist/commands/template.js +0 -0
- package/dist/commands/test/mmf1.d.ts +0 -0
- package/dist/commands/test/mmf1.js +1 -1
- package/dist/commands/test/reporters/compact-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/compact-reporter.js +0 -0
- package/dist/commands/test/reporters/files-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/files-reporter.js +0 -0
- package/dist/commands/test/reporters/reporter.d.ts +0 -0
- package/dist/commands/test/reporters/reporter.js +0 -0
- package/dist/commands/test/reporters/silent-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/silent-reporter.js +0 -0
- package/dist/commands/test/reporters/verbose-reporter.d.ts +0 -0
- package/dist/commands/test/reporters/verbose-reporter.js +0 -0
- package/dist/commands/test/test.d.ts +0 -0
- package/dist/commands/test/test.js +2 -2
- package/dist/commands/test/utils.d.ts +0 -0
- package/dist/commands/test/utils.js +0 -0
- package/dist/commands/toolchain/index.d.ts +0 -0
- package/dist/commands/toolchain/index.js +0 -0
- package/dist/commands/toolchain/moc.d.ts +0 -0
- package/dist/commands/toolchain/moc.js +0 -0
- 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/toolchain/wasmtime.d.ts +0 -0
- package/dist/commands/toolchain/wasmtime.js +0 -0
- package/dist/commands/transfer-ownership.d.ts +0 -0
- package/dist/commands/transfer-ownership.js +1 -1
- package/dist/commands/update.d.ts +0 -0
- package/dist/commands/update.js +0 -0
- package/dist/commands/user.d.ts +0 -0
- package/dist/commands/user.js +0 -0
- package/dist/commands/whoami.d.ts +0 -0
- package/dist/commands/whoami.js +0 -0
- package/dist/declarations/bench/bench.did +0 -0
- package/dist/declarations/bench/bench.did.d.ts +3 -0
- package/dist/declarations/bench/bench.did.js +0 -0
- package/dist/declarations/bench/index.d.ts +0 -0
- package/dist/declarations/bench/index.js +0 -0
- package/dist/declarations/main/index.d.ts +0 -0
- package/dist/declarations/main/index.js +0 -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/helpers/get-dfx-version.d.ts +0 -0
- package/dist/helpers/get-dfx-version.js +0 -0
- package/dist/helpers/get-moc-path.d.ts +0 -0
- package/dist/helpers/get-moc-path.js +0 -0
- package/dist/helpers/get-moc-version.d.ts +0 -0
- package/dist/helpers/get-moc-version.js +0 -0
- package/dist/integrity.d.ts +0 -0
- package/dist/integrity.js +0 -0
- package/dist/mops.d.ts +0 -0
- package/dist/mops.js +1 -1
- package/dist/notify-installs.d.ts +0 -0
- package/dist/notify-installs.js +0 -0
- package/dist/package.json +1 -1
- package/dist/parallel.d.ts +0 -0
- package/dist/parallel.js +0 -0
- package/dist/pem.d.ts +0 -0
- package/dist/pem.js +0 -0
- package/dist/release-cli.d.ts +1 -0
- package/dist/release-cli.js +35 -0
- package/dist/remove-scripts.d.ts +1 -0
- package/dist/remove-scripts.js +5 -0
- package/dist/resolve-packages.d.ts +0 -0
- package/dist/resolve-packages.js +0 -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/types.d.ts +0 -0
- package/dist/types.js +0 -0
- package/dist/vessel.d.ts +0 -0
- package/dist/vessel.js +1 -1
- package/global.d.ts +0 -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 +17 -17
- package/notify-installs.ts +2 -2
- package/package.json +1 -1
- package/parallel.ts +1 -1
- package/pem.ts +5 -5
- 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/types.ts +25 -25
- package/vessel.ts +16 -16
- package/dist/commands/replica.d.ts +0 -36
- package/dist/commands/replica.js +0 -103
|
@@ -9,7 +9,9 @@ export declare class BenchReplica {
|
|
|
9
9
|
}>;
|
|
10
10
|
pocketIc?: PocketIc;
|
|
11
11
|
constructor(type: 'dfx' | 'pocket-ic', verbose?: boolean);
|
|
12
|
-
start(
|
|
12
|
+
start({ silent }?: {
|
|
13
|
+
silent?: boolean | undefined;
|
|
14
|
+
}): Promise<void>;
|
|
13
15
|
stop(): Promise<void>;
|
|
14
16
|
deploy(name: string, wasm: string, cwd?: string): Promise<void>;
|
|
15
17
|
getActor(name: string): unknown;
|
|
@@ -13,8 +13,8 @@ export class BenchReplica {
|
|
|
13
13
|
this.type = type;
|
|
14
14
|
this.verbose = verbose;
|
|
15
15
|
}
|
|
16
|
-
async start() {
|
|
17
|
-
console.log(`Starting ${this.type} replica...`);
|
|
16
|
+
async start({ silent = false } = {}) {
|
|
17
|
+
silent || console.log(`Starting ${this.type} replica...`);
|
|
18
18
|
if (this.type == 'dfx') {
|
|
19
19
|
await this.stop();
|
|
20
20
|
let dir = path.join(getRootDir(), '.mops/.bench');
|
package/dist/commands/bench.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { Benchmarks } from '../declarations/main/main.did.js';
|
|
1
2
|
type BenchOptions = {
|
|
2
3
|
replica: 'dfx' | 'pocket-ic';
|
|
3
4
|
replicaVersion: string;
|
|
4
|
-
|
|
5
|
+
compiler: 'moc';
|
|
6
|
+
compilerVersion: string;
|
|
5
7
|
gc: 'copying' | 'compacting' | 'generational' | 'incremental';
|
|
6
8
|
forceGc: boolean;
|
|
7
9
|
save: boolean;
|
|
8
10
|
compare: boolean;
|
|
9
11
|
verbose: boolean;
|
|
12
|
+
silent: boolean;
|
|
10
13
|
};
|
|
11
|
-
export declare function bench(filter?: string, optionsArg?: Partial<BenchOptions>): Promise<
|
|
14
|
+
export declare function bench(filter?: string, optionsArg?: Partial<BenchOptions>): Promise<Benchmarks>;
|
|
12
15
|
export {};
|
package/dist/commands/bench.js
CHANGED
|
@@ -7,7 +7,7 @@ import { markdownTable } from 'markdown-table';
|
|
|
7
7
|
import logUpdate from 'log-update';
|
|
8
8
|
import { execaCommand } from 'execa';
|
|
9
9
|
import stringWidth from 'string-width';
|
|
10
|
-
import { getRootDir } from '../mops.js';
|
|
10
|
+
import { getRootDir, readConfig } from '../mops.js';
|
|
11
11
|
import { parallel } from '../parallel.js';
|
|
12
12
|
import { absToRel } from './test/utils.js';
|
|
13
13
|
import { getMocVersion } from '../helpers/get-moc-version.js';
|
|
@@ -28,16 +28,24 @@ let globConfig = {
|
|
|
28
28
|
export async function bench(filter = '', optionsArg = {}) {
|
|
29
29
|
let defaultOptions = {
|
|
30
30
|
replica: 'dfx',
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
replicaVersion: '',
|
|
32
|
+
compiler: 'moc',
|
|
33
|
+
compilerVersion: getMocVersion(),
|
|
33
34
|
gc: 'copying',
|
|
34
35
|
forceGc: true,
|
|
35
36
|
save: false,
|
|
36
37
|
compare: false,
|
|
37
38
|
verbose: false,
|
|
39
|
+
silent: false,
|
|
38
40
|
};
|
|
39
41
|
let options = { ...defaultOptions, ...optionsArg };
|
|
40
|
-
|
|
42
|
+
if (options.replica == 'dfx') {
|
|
43
|
+
options.replicaVersion = getDfxVersion();
|
|
44
|
+
}
|
|
45
|
+
else if (options.replica == 'pocket-ic') {
|
|
46
|
+
let config = readConfig();
|
|
47
|
+
options.replicaVersion = config.toolchain?.['pocket-ic'] || '';
|
|
48
|
+
}
|
|
41
49
|
options.verbose && console.log(options);
|
|
42
50
|
let replica = new BenchReplica(options.replica, options.verbose);
|
|
43
51
|
let rootDir = getRootDir();
|
|
@@ -48,26 +56,30 @@ export async function bench(filter = '', optionsArg = {}) {
|
|
|
48
56
|
let files = globSync(path.join(rootDir, globStr), globConfig);
|
|
49
57
|
if (!files.length) {
|
|
50
58
|
if (filter) {
|
|
51
|
-
console.log(`No benchmark files found for filter '${filter}'`);
|
|
52
|
-
return
|
|
59
|
+
options.silent || console.log(`No benchmark files found for filter '${filter}'`);
|
|
60
|
+
return [];
|
|
61
|
+
}
|
|
62
|
+
if (!options.silent) {
|
|
63
|
+
console.log('No *.bench.mo files found');
|
|
64
|
+
console.log('Put your benchmark code in \'bench\' directory in *.bench.mo files');
|
|
53
65
|
}
|
|
54
|
-
|
|
55
|
-
console.log('Put your benchmark code in \'bench\' directory in *.bench.mo files');
|
|
56
|
-
return false;
|
|
66
|
+
return [];
|
|
57
67
|
}
|
|
58
68
|
files.sort();
|
|
59
69
|
let benchDir = `${getRootDir()}/.mops/.bench/`;
|
|
60
70
|
fs.rmSync(benchDir, { recursive: true, force: true });
|
|
61
71
|
fs.mkdirSync(benchDir, { recursive: true });
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
if (!options.silent) {
|
|
73
|
+
console.log('Benchmark files:');
|
|
74
|
+
for (let file of files) {
|
|
75
|
+
console.log(chalk.gray(`• ${absToRel(file)}`));
|
|
76
|
+
}
|
|
77
|
+
console.log('');
|
|
78
|
+
console.log('='.repeat(50));
|
|
79
|
+
console.log('');
|
|
65
80
|
}
|
|
66
|
-
|
|
67
|
-
console.log('
|
|
68
|
-
console.log('');
|
|
69
|
-
await replica.start();
|
|
70
|
-
console.log('Deploying canisters...');
|
|
81
|
+
await replica.start({ silent: options.silent });
|
|
82
|
+
options.silent || console.log('Deploying canisters...');
|
|
71
83
|
await parallel(os.cpus().length, files, async (file) => {
|
|
72
84
|
try {
|
|
73
85
|
await deployBenchFile(file, options, replica);
|
|
@@ -78,12 +90,16 @@ export async function bench(filter = '', optionsArg = {}) {
|
|
|
78
90
|
throw err;
|
|
79
91
|
}
|
|
80
92
|
});
|
|
93
|
+
let benchResults = [];
|
|
81
94
|
await parallel(1, files, async (file) => {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
if (!options.silent) {
|
|
96
|
+
console.log('\n' + '—'.repeat(50));
|
|
97
|
+
console.log(`\nRunning ${chalk.gray(absToRel(file))}...`);
|
|
98
|
+
console.log('');
|
|
99
|
+
}
|
|
85
100
|
try {
|
|
86
|
-
await runBenchFile(file, options, replica);
|
|
101
|
+
let benchResult = await runBenchFile(file, options, replica);
|
|
102
|
+
benchResults.push(benchResult);
|
|
87
103
|
}
|
|
88
104
|
catch (err) {
|
|
89
105
|
console.error('Unexpected error. Stopping replica...');
|
|
@@ -91,10 +107,10 @@ export async function bench(filter = '', optionsArg = {}) {
|
|
|
91
107
|
throw err;
|
|
92
108
|
}
|
|
93
109
|
});
|
|
94
|
-
console.log('Stopping replica...');
|
|
110
|
+
options.silent || console.log('Stopping replica...');
|
|
95
111
|
await replica.stop();
|
|
96
112
|
fs.rmSync(benchDir, { recursive: true, force: true });
|
|
97
|
-
return
|
|
113
|
+
return benchResults;
|
|
98
114
|
}
|
|
99
115
|
function getMocArgs(options) {
|
|
100
116
|
let args = '';
|
|
@@ -152,6 +168,8 @@ async function runBenchFile(file, options, replica) {
|
|
|
152
168
|
}
|
|
153
169
|
}
|
|
154
170
|
let results = new Map();
|
|
171
|
+
let instructionsCells = Array.from({ length: schema.rows.length }, () => []);
|
|
172
|
+
let heapCells = Array.from({ length: schema.rows.length }, () => []);
|
|
155
173
|
let formatNumber = (n) => {
|
|
156
174
|
return n.toLocaleString('en-US').replaceAll(',', '_');
|
|
157
175
|
};
|
|
@@ -199,17 +217,19 @@ async function runBenchFile(file, options, replica) {
|
|
|
199
217
|
\n\n${chalk.blue('Heap')}\n\n${getTable('rts_heap_size')}
|
|
200
218
|
`);
|
|
201
219
|
};
|
|
202
|
-
if (!process.env.CI) {
|
|
220
|
+
if (!process.env.CI && !options.silent) {
|
|
203
221
|
printResults();
|
|
204
222
|
}
|
|
205
223
|
// run all cells
|
|
206
224
|
for (let [rowIndex, row] of schema.rows.entries()) {
|
|
207
225
|
for (let [colIndex, col] of schema.cols.entries()) {
|
|
208
|
-
// let res = await actor.runCellQuery(BigInt(rowIndex), BigInt(colIndex));
|
|
209
|
-
// let res = await actor.runCellUpdate(BigInt(rowIndex), BigInt(colIndex));
|
|
210
226
|
let res = await actor.runCellUpdateAwait(BigInt(rowIndex), BigInt(colIndex));
|
|
211
227
|
results.set(`${row}:${col}`, res);
|
|
212
|
-
|
|
228
|
+
// @ts-ignore
|
|
229
|
+
instructionsCells[rowIndex][colIndex] = res.instructions;
|
|
230
|
+
// @ts-ignore
|
|
231
|
+
heapCells[rowIndex][colIndex] = res.rts_heap_size;
|
|
232
|
+
if (!process.env.CI && !options.silent) {
|
|
213
233
|
printResults();
|
|
214
234
|
}
|
|
215
235
|
}
|
|
@@ -223,7 +243,7 @@ async function runBenchFile(file, options, replica) {
|
|
|
223
243
|
console.log(`Saving results to ${chalk.gray(absToRel(resultsJsonFile))}`);
|
|
224
244
|
let json = {
|
|
225
245
|
version: 1,
|
|
226
|
-
moc: options.
|
|
246
|
+
moc: options.compilerVersion,
|
|
227
247
|
replica: options.replica,
|
|
228
248
|
replicaVersion: options.replicaVersion,
|
|
229
249
|
gc: options.gc,
|
|
@@ -240,5 +260,22 @@ async function runBenchFile(file, options, replica) {
|
|
|
240
260
|
}
|
|
241
261
|
}, 2));
|
|
242
262
|
}
|
|
243
|
-
|
|
263
|
+
// for backend
|
|
264
|
+
return {
|
|
265
|
+
name: schema.name,
|
|
266
|
+
description: schema.description,
|
|
267
|
+
file: absToRel(file),
|
|
268
|
+
gc: options.gc,
|
|
269
|
+
forceGC: options.forceGc,
|
|
270
|
+
replica: options.replica,
|
|
271
|
+
replicaVersion: options.replicaVersion,
|
|
272
|
+
compiler: options.compiler,
|
|
273
|
+
compilerVersion: options.compilerVersion,
|
|
274
|
+
rows: schema.rows,
|
|
275
|
+
cols: schema.cols,
|
|
276
|
+
metrics: [
|
|
277
|
+
['instructions', instructionsCells],
|
|
278
|
+
['rts_heap_size', heapCells],
|
|
279
|
+
],
|
|
280
|
+
};
|
|
244
281
|
}
|
package/dist/commands/bump.d.ts
CHANGED
|
File without changes
|
package/dist/commands/bump.js
CHANGED
|
File without changes
|
package/dist/commands/docs.d.ts
CHANGED
|
File without changes
|
package/dist/commands/docs.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/commands/init.d.ts
CHANGED
|
File without changes
|
package/dist/commands/init.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/commands/install.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/commands/publish.js
CHANGED
|
@@ -13,6 +13,7 @@ import { parallel } from '../parallel.js';
|
|
|
13
13
|
import { docs } from './docs.js';
|
|
14
14
|
import { testWithReporter } from './test/test.js';
|
|
15
15
|
import { SilentReporter } from './test/reporters/silent-reporter.js';
|
|
16
|
+
import { bench } from './bench.js';
|
|
16
17
|
export async function publish(options = {}) {
|
|
17
18
|
if (!checkConfigFile()) {
|
|
18
19
|
return;
|
|
@@ -145,7 +146,7 @@ export async function publish(options = {}) {
|
|
|
145
146
|
return {
|
|
146
147
|
...dep,
|
|
147
148
|
version: dep.version || '',
|
|
148
|
-
repo: dep.repo || ''
|
|
149
|
+
repo: dep.repo || '',
|
|
149
150
|
};
|
|
150
151
|
};
|
|
151
152
|
// map fields
|
|
@@ -231,6 +232,24 @@ export async function publish(options = {}) {
|
|
|
231
232
|
process.exit(1);
|
|
232
233
|
}
|
|
233
234
|
}
|
|
235
|
+
// bench
|
|
236
|
+
let benchmarks = [];
|
|
237
|
+
if (options.bench) {
|
|
238
|
+
console.log('Running benchmarks...');
|
|
239
|
+
try {
|
|
240
|
+
benchmarks = await bench('', {
|
|
241
|
+
replica: config.toolchain?.['pocket-ic'] ? 'pocket-ic' : 'dfx',
|
|
242
|
+
gc: 'copying',
|
|
243
|
+
forceGc: true,
|
|
244
|
+
silent: true,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
catch (err) {
|
|
248
|
+
console.error(err);
|
|
249
|
+
console.log(chalk.red('Error: ') + 'benchmarks failed');
|
|
250
|
+
process.exit(1);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
234
253
|
// progress
|
|
235
254
|
let total = files.length + 2;
|
|
236
255
|
let step = 0;
|
|
@@ -255,6 +274,10 @@ export async function publish(options = {}) {
|
|
|
255
274
|
passedNames: reporter.passedNamesFlat,
|
|
256
275
|
});
|
|
257
276
|
}
|
|
277
|
+
// upload benchmarks
|
|
278
|
+
if (options.bench) {
|
|
279
|
+
await actor.uploadBenchmarks(puiblishingId, benchmarks);
|
|
280
|
+
}
|
|
258
281
|
// upload changelog
|
|
259
282
|
if (changelog) {
|
|
260
283
|
await actor.uploadNotes(puiblishingId, changelog);
|
|
File without changes
|
package/dist/commands/remove.js
CHANGED
|
File without changes
|
|
File without changes
|
package/dist/commands/search.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import child_process, { execSync } from 'node:child_process';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { version, globalConfigDir } from '../mops.js';
|
|
4
|
+
import { cleanCache } from '../cache.js';
|
|
5
|
+
import { toolchain } from './toolchain/index.js';
|
|
6
|
+
let url = 'https://x344g-ziaaa-aaaap-abl7a-cai.icp0.io';
|
|
7
|
+
function detectPackageManager() {
|
|
8
|
+
let res = '';
|
|
9
|
+
try {
|
|
10
|
+
res = execSync('which mops').toString();
|
|
11
|
+
}
|
|
12
|
+
catch (e) { }
|
|
13
|
+
if (!res) {
|
|
14
|
+
console.error(chalk.red('Couldn\'t detect package manager'));
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
if (res.includes('pnpm/')) {
|
|
18
|
+
return 'pnpm';
|
|
19
|
+
}
|
|
20
|
+
// else if (res.includes('bun/')) {
|
|
21
|
+
// return 'bun';
|
|
22
|
+
// }
|
|
23
|
+
else {
|
|
24
|
+
return 'npm';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export async function getLatestVersion() {
|
|
28
|
+
let res = await fetch(url + '/tags/latest');
|
|
29
|
+
return res.text();
|
|
30
|
+
}
|
|
31
|
+
export async function update() {
|
|
32
|
+
let latest = await getLatestVersion();
|
|
33
|
+
let current = version();
|
|
34
|
+
if (latest === current) {
|
|
35
|
+
console.log(chalk.green('You are up to date. Version: ' + current));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log('Current version: ' + chalk.yellow(current));
|
|
39
|
+
console.log('Updating to version: ' + chalk.green(latest));
|
|
40
|
+
let pm = detectPackageManager();
|
|
41
|
+
let npmArgs = pm === 'npm' ? ['--no-fund', '--silent'] : [];
|
|
42
|
+
let proc = child_process.spawn(pm, ['add', '-g', ...npmArgs, `${url}/versions/${latest}/cli.tgz`], { stdio: 'inherit', detached: false });
|
|
43
|
+
proc.on('exit', (res) => {
|
|
44
|
+
if (res !== 0) {
|
|
45
|
+
console.log(chalk.red('Failed to update.'));
|
|
46
|
+
process.exit(1);
|
|
47
|
+
}
|
|
48
|
+
console.log(chalk.green('Success'));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export async function uninstall() {
|
|
53
|
+
console.log('Cleaning cache...');
|
|
54
|
+
cleanCache();
|
|
55
|
+
console.log('Resetting toolchain management...');
|
|
56
|
+
toolchain.init({ reset: true, silent: true });
|
|
57
|
+
console.log('Uninstalling mops CLI...');
|
|
58
|
+
let pm = detectPackageManager();
|
|
59
|
+
child_process.spawn(pm, ['remove', '-g', '--silent', 'ic-mops'], { stdio: 'inherit', detached: false });
|
|
60
|
+
console.log(chalk.yellow('Config directory has not been deleted: ' + globalConfigDir));
|
|
61
|
+
console.log('Uninstalled');
|
|
62
|
+
}
|
|
File without changes
|
package/dist/commands/sources.js
CHANGED
|
File without changes
|
package/dist/commands/sync.d.ts
CHANGED
|
File without changes
|
package/dist/commands/sync.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -142,14 +142,14 @@ export async function testWithReporter(reporter, filter = '', mode = 'interprete
|
|
|
142
142
|
'-C', 'cache=n',
|
|
143
143
|
'-W', 'bulk-memory',
|
|
144
144
|
'-W', 'multi-memory',
|
|
145
|
-
'-W', 'max-wasm-stack=
|
|
145
|
+
'-W', 'max-wasm-stack=4000000',
|
|
146
146
|
'-W', 'nan-canonicalization=y',
|
|
147
147
|
wasmFile,
|
|
148
148
|
];
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
wasmtimeArgs = [
|
|
152
|
-
'--max-wasm-stack=
|
|
152
|
+
'--max-wasm-stack=4000000',
|
|
153
153
|
'--enable-cranelift-nan-canonicalization',
|
|
154
154
|
'--wasm-features',
|
|
155
155
|
'multi-memory,bulk-memory',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
export declare let repo: string;
|
|
2
2
|
export declare let getLatestReleaseTag: () => Promise<string>;
|
|
3
|
-
export declare let getReleases: () => Promise<
|
|
4
|
-
tag_name: string;
|
|
5
|
-
published_at: Date;
|
|
6
|
-
draft: boolean;
|
|
7
|
-
}[]>;
|
|
3
|
+
export declare let getReleases: () => Promise<any>;
|
|
8
4
|
export declare let isCached: (version: string) => boolean;
|
|
9
5
|
export declare let download: (version: string, { silent, verbose }?: {
|
|
10
6
|
silent?: boolean | undefined;
|
|
@@ -5,28 +5,10 @@ import * as toolchainUtils from './toolchain-utils.js';
|
|
|
5
5
|
let cacheDir = path.join(globalCacheDir, 'pocket-ic');
|
|
6
6
|
export let repo = 'dfinity/pocketic';
|
|
7
7
|
export let getLatestReleaseTag = async () => {
|
|
8
|
-
return
|
|
9
|
-
// return toolchainUtils.getLatestReleaseTag(repo);
|
|
8
|
+
return toolchainUtils.getLatestReleaseTag(repo);
|
|
10
9
|
};
|
|
11
10
|
export let getReleases = async () => {
|
|
12
|
-
|
|
13
|
-
return [
|
|
14
|
-
{
|
|
15
|
-
tag_name: '2.0.1',
|
|
16
|
-
published_at: new Date('2023-11-23'),
|
|
17
|
-
draft: false,
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
tag_name: '2.0.0',
|
|
21
|
-
published_at: new Date('2023-11-21'),
|
|
22
|
-
draft: false,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
tag_name: '1.0.0',
|
|
26
|
-
published_at: new Date('2023-10-12'),
|
|
27
|
-
draft: false,
|
|
28
|
-
},
|
|
29
|
-
];
|
|
11
|
+
return toolchainUtils.getReleases(repo);
|
|
30
12
|
};
|
|
31
13
|
export let isCached = (version) => {
|
|
32
14
|
let dir = path.join(cacheDir, version);
|
|
@@ -45,14 +27,9 @@ export let download = async (version, { silent = false, verbose = false } = {})
|
|
|
45
27
|
}
|
|
46
28
|
let platfrom = process.platform == 'darwin' ? 'darwin' : 'linux';
|
|
47
29
|
let arch = 'x86_64';
|
|
48
|
-
let
|
|
49
|
-
'2.0.1': '69e1408347723dbaa7a6cd2faa9b65c42abbe861',
|
|
50
|
-
'2.0.0': '29ec86dc9f9ca4691d4d4386c8b2aa41e14d9d16',
|
|
51
|
-
'1.0.0': '307d5847c1d2fe1f5e19181c7d0fcec23f4658b3',
|
|
52
|
-
};
|
|
53
|
-
let url = `https://download.dfinity.systems/ic/${hashes[version]}/openssl-static-binaries/${arch}-${platfrom}/pocket-ic.gz`;
|
|
30
|
+
let url = `https://github.com/dfinity/pocketic/releases/download/${version}/pocket-ic-${arch}-${platfrom}.gz`;
|
|
54
31
|
if (verbose && !silent) {
|
|
55
32
|
console.log(`Downloading ${url}`);
|
|
56
33
|
}
|
|
57
|
-
await toolchainUtils.downloadAndExtract(url, path.join(cacheDir, version));
|
|
34
|
+
await toolchainUtils.downloadAndExtract(url, path.join(cacheDir, version), 'pocket-ic');
|
|
58
35
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare let downloadAndExtract: (url: string,
|
|
1
|
+
export declare let downloadAndExtract: (url: string, destDir: string, destFileName?: string) => Promise<void>;
|
|
2
2
|
export declare let getLatestReleaseTag: (repo: string) => Promise<string>;
|
|
3
3
|
export declare let getReleases: (repo: string) => Promise<any>;
|
|
@@ -8,7 +8,7 @@ import { deleteSync } from 'del';
|
|
|
8
8
|
import { Octokit } from 'octokit';
|
|
9
9
|
import tar from 'tar';
|
|
10
10
|
import { getRootDir } from '../../mops.js';
|
|
11
|
-
export let downloadAndExtract = async (url,
|
|
11
|
+
export let downloadAndExtract = async (url, destDir, destFileName = '') => {
|
|
12
12
|
let res = await fetch(url);
|
|
13
13
|
if (res.status !== 200) {
|
|
14
14
|
console.error(`ERROR ${res.status} ${url}`);
|
|
@@ -20,7 +20,7 @@ export let downloadAndExtract = async (url, dest) => {
|
|
|
20
20
|
let archive = path.join(tmpDir, path.basename(url));
|
|
21
21
|
fs.mkdirSync(tmpDir, { recursive: true });
|
|
22
22
|
fs.writeFileSync(archive, buffer);
|
|
23
|
-
fs.mkdirSync(
|
|
23
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
24
24
|
if (archive.endsWith('.xz')) {
|
|
25
25
|
let decompressTarxz = await import('decomp-tarxz');
|
|
26
26
|
await decompress(archive, tmpDir, {
|
|
@@ -28,16 +28,16 @@ export let downloadAndExtract = async (url, dest) => {
|
|
|
28
28
|
}).catch(() => {
|
|
29
29
|
deleteSync([tmpDir]);
|
|
30
30
|
});
|
|
31
|
-
fs.cpSync(path.join(tmpDir, path.parse(archive).name.replace('.tar', '')),
|
|
31
|
+
fs.cpSync(path.join(tmpDir, path.parse(archive).name.replace('.tar', '')), destDir, { recursive: true });
|
|
32
32
|
}
|
|
33
33
|
else if (archive.endsWith('tar.gz')) {
|
|
34
34
|
await tar.extract({
|
|
35
35
|
file: archive,
|
|
36
|
-
cwd:
|
|
36
|
+
cwd: destDir,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
else if (archive.endsWith('.gz')) {
|
|
40
|
-
let destFile = path.join(
|
|
40
|
+
let destFile = path.join(destDir, destFileName || path.parse(archive).name);
|
|
41
41
|
fs.writeFileSync(destFile, unzipSync(buffer));
|
|
42
42
|
chmodSync(destFile, 0o700);
|
|
43
43
|
}
|
|
@@ -57,8 +57,8 @@ export let getReleases = async (repo) => {
|
|
|
57
57
|
let res = await octokit.request(`GET /repos/${repo}/releases`, {
|
|
58
58
|
per_page: 10,
|
|
59
59
|
headers: {
|
|
60
|
-
'X-GitHub-Api-Version': '2022-11-28'
|
|
61
|
-
}
|
|
60
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
61
|
+
},
|
|
62
62
|
});
|
|
63
63
|
if (res.status !== 200) {
|
|
64
64
|
console.log('Releases fetch error');
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/commands/update.js
CHANGED
|
File without changes
|
package/dist/commands/user.d.ts
CHANGED
|
File without changes
|
package/dist/commands/user.js
CHANGED
|
File without changes
|