ic-mops 0.37.2 → 0.37.4
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/commands/bench-replica.ts +6 -1
- package/commands/docs.ts +1 -1
- package/commands/test/test.ts +1 -1
- package/commands/toolchain/index.ts +14 -6
- package/commands/toolchain/pocket-ic.ts +12 -16
- package/dist/commands/bench-replica.js +6 -1
- package/dist/commands/docs.js +1 -1
- package/dist/commands/test/test.js +1 -1
- package/dist/commands/toolchain/index.js +11 -6
- package/dist/commands/toolchain/pocket-ic.js +12 -16
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import {execaCommand} from 'execa';
|
|
5
5
|
import {PocketIc} from 'pic-ic';
|
|
6
|
-
import {getRootDir} from '../mops.js';
|
|
6
|
+
import {getRootDir, readConfig} from '../mops.js';
|
|
7
7
|
import {createActor, idlFactory} from '../declarations/bench/index.js';
|
|
8
8
|
import {toolchain} from './toolchain/index.js';
|
|
9
9
|
|
|
@@ -29,6 +29,11 @@ export class BenchReplica {
|
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
31
|
let pocketIcBin = await toolchain.bin('pocket-ic');
|
|
32
|
+
let config = readConfig();
|
|
33
|
+
if (config.toolchain?.['pocket-ic'] !== '1.0.0') {
|
|
34
|
+
console.error('Currently only pocket-ic 1.0.0 is supported');
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
32
37
|
this.pocketIc = await PocketIc.create(pocketIcBin);
|
|
33
38
|
}
|
|
34
39
|
}
|
package/commands/docs.ts
CHANGED
|
@@ -25,7 +25,7 @@ export async function docs({silent = false} = {}) {
|
|
|
25
25
|
}
|
|
26
26
|
else {
|
|
27
27
|
// fallbacks to dfx moc if not specified in config
|
|
28
|
-
let mocPath = await toolchain.bin('moc');
|
|
28
|
+
let mocPath = await toolchain.bin('moc', {fallback: true});
|
|
29
29
|
moDocPath = mocPath.replace(/\/moc$/, '/mo-doc');
|
|
30
30
|
}
|
|
31
31
|
|
package/commands/test/test.ts
CHANGED
|
@@ -122,7 +122,7 @@ export async function testWithReporter(reporter: Reporter, filter = '', mode: Te
|
|
|
122
122
|
let sourcesArr = await sources();
|
|
123
123
|
|
|
124
124
|
if (!mocPath) {
|
|
125
|
-
mocPath = await toolchain.bin('moc');
|
|
125
|
+
mocPath = await toolchain.bin('moc', {fallback: true});
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
let wasmDir = `${getRootDir()}/.mops/.test/`;
|
|
@@ -134,7 +134,18 @@ async function init({reset = false, silent = false} = {}) {
|
|
|
134
134
|
|
|
135
135
|
async function download(tool: Tool, version: string, {silent = false, verbose = false} = {}) {
|
|
136
136
|
let toolUtils = getToolUtils(tool);
|
|
137
|
+
let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
|
|
138
|
+
|
|
139
|
+
silent || logUpdate('Installing', tool, version);
|
|
140
|
+
|
|
137
141
|
await toolUtils.download(version, {silent, verbose});
|
|
142
|
+
|
|
143
|
+
if (verbose) {
|
|
144
|
+
logUpdate.done();
|
|
145
|
+
}
|
|
146
|
+
else if (!silent) {
|
|
147
|
+
logUpdate.clear();
|
|
148
|
+
}
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
async function installAll({silent = false, verbose = false} = {}) {
|
|
@@ -161,16 +172,13 @@ async function installAll({silent = false, verbose = false} = {}) {
|
|
|
161
172
|
log('Installing toolchain...');
|
|
162
173
|
|
|
163
174
|
if (config.toolchain?.moc) {
|
|
164
|
-
|
|
165
|
-
await download('moc', config.toolchain.moc, {verbose});
|
|
175
|
+
await download('moc', config.toolchain.moc, {silent, verbose});
|
|
166
176
|
}
|
|
167
177
|
if (config.toolchain?.wasmtime) {
|
|
168
|
-
|
|
169
|
-
await download('wasmtime', config.toolchain.wasmtime, {verbose});
|
|
178
|
+
await download('wasmtime', config.toolchain.wasmtime, {silent, verbose});
|
|
170
179
|
}
|
|
171
180
|
if (config.toolchain?.['pocket-ic']) {
|
|
172
|
-
|
|
173
|
-
await download('pocket-ic', config.toolchain['pocket-ic'], {verbose});
|
|
181
|
+
await download('pocket-ic', config.toolchain['pocket-ic'], {silent, verbose});
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
if (!silent) {
|
|
@@ -16,16 +16,16 @@ export let getLatestReleaseTag = async () => {
|
|
|
16
16
|
export let getReleases = async () => {
|
|
17
17
|
// return toolchainUtils.getReleases(repo);
|
|
18
18
|
return [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
{
|
|
20
|
+
tag_name: '2.0.1',
|
|
21
|
+
published_at: new Date('2023-11-23'),
|
|
22
|
+
draft: false,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
tag_name: '2.0.0',
|
|
26
|
+
published_at: new Date('2023-11-21'),
|
|
27
|
+
draft: false,
|
|
28
|
+
},
|
|
29
29
|
{
|
|
30
30
|
tag_name: '1.0.0',
|
|
31
31
|
published_at: new Date('2023-10-12'),
|
|
@@ -44,10 +44,6 @@ export let download = async (version: string, {silent = false, verbose = false}
|
|
|
44
44
|
console.error('version is not defined');
|
|
45
45
|
process.exit(1);
|
|
46
46
|
}
|
|
47
|
-
if (version !== '1.0.0') {
|
|
48
|
-
console.error('Currently only pocket-ic 1.0.0 is supported');
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
47
|
if (isCached(version)) {
|
|
52
48
|
if (verbose) {
|
|
53
49
|
console.log(`pocket-ic ${version} is already installed`);
|
|
@@ -59,8 +55,8 @@ export let download = async (version: string, {silent = false, verbose = false}
|
|
|
59
55
|
let arch = 'x86_64';
|
|
60
56
|
|
|
61
57
|
let hashes: Record<string, string> = {
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
'2.0.1': '69e1408347723dbaa7a6cd2faa9b65c42abbe861',
|
|
59
|
+
'2.0.0': '29ec86dc9f9ca4691d4d4386c8b2aa41e14d9d16',
|
|
64
60
|
'1.0.0': '307d5847c1d2fe1f5e19181c7d0fcec23f4658b3',
|
|
65
61
|
};
|
|
66
62
|
|
|
@@ -3,7 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import { execaCommand } from 'execa';
|
|
5
5
|
import { PocketIc } from 'pic-ic';
|
|
6
|
-
import { getRootDir } from '../mops.js';
|
|
6
|
+
import { getRootDir, readConfig } from '../mops.js';
|
|
7
7
|
import { createActor, idlFactory } from '../declarations/bench/index.js';
|
|
8
8
|
import { toolchain } from './toolchain/index.js';
|
|
9
9
|
export class BenchReplica {
|
|
@@ -23,6 +23,11 @@ export class BenchReplica {
|
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
let pocketIcBin = await toolchain.bin('pocket-ic');
|
|
26
|
+
let config = readConfig();
|
|
27
|
+
if (config.toolchain?.['pocket-ic'] !== '1.0.0') {
|
|
28
|
+
console.error('Currently only pocket-ic 1.0.0 is supported');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
26
31
|
this.pocketIc = await PocketIc.create(pocketIcBin);
|
|
27
32
|
}
|
|
28
33
|
}
|
package/dist/commands/docs.js
CHANGED
|
@@ -20,7 +20,7 @@ export async function docs({ silent = false } = {}) {
|
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
22
|
// fallbacks to dfx moc if not specified in config
|
|
23
|
-
let mocPath = await toolchain.bin('moc');
|
|
23
|
+
let mocPath = await toolchain.bin('moc', { fallback: true });
|
|
24
24
|
moDocPath = mocPath.replace(/\/moc$/, '/mo-doc');
|
|
25
25
|
}
|
|
26
26
|
// generate docs
|
|
@@ -104,7 +104,7 @@ export async function testWithReporter(reporter, filter = '', mode = 'interprete
|
|
|
104
104
|
let config = readConfig();
|
|
105
105
|
let sourcesArr = await sources();
|
|
106
106
|
if (!mocPath) {
|
|
107
|
-
mocPath = await toolchain.bin('moc');
|
|
107
|
+
mocPath = await toolchain.bin('moc', { fallback: true });
|
|
108
108
|
}
|
|
109
109
|
let wasmDir = `${getRootDir()}/.mops/.test/`;
|
|
110
110
|
fs.mkdirSync(wasmDir, { recursive: true });
|
|
@@ -115,7 +115,15 @@ async function init({ reset = false, silent = false } = {}) {
|
|
|
115
115
|
}
|
|
116
116
|
async function download(tool, version, { silent = false, verbose = false } = {}) {
|
|
117
117
|
let toolUtils = getToolUtils(tool);
|
|
118
|
+
let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
|
|
119
|
+
silent || logUpdate('Installing', tool, version);
|
|
118
120
|
await toolUtils.download(version, { silent, verbose });
|
|
121
|
+
if (verbose) {
|
|
122
|
+
logUpdate.done();
|
|
123
|
+
}
|
|
124
|
+
else if (!silent) {
|
|
125
|
+
logUpdate.clear();
|
|
126
|
+
}
|
|
119
127
|
}
|
|
120
128
|
async function installAll({ silent = false, verbose = false } = {}) {
|
|
121
129
|
let config = readConfig();
|
|
@@ -136,16 +144,13 @@ async function installAll({ silent = false, verbose = false } = {}) {
|
|
|
136
144
|
};
|
|
137
145
|
log('Installing toolchain...');
|
|
138
146
|
if (config.toolchain?.moc) {
|
|
139
|
-
|
|
140
|
-
await download('moc', config.toolchain.moc, { verbose });
|
|
147
|
+
await download('moc', config.toolchain.moc, { silent, verbose });
|
|
141
148
|
}
|
|
142
149
|
if (config.toolchain?.wasmtime) {
|
|
143
|
-
|
|
144
|
-
await download('wasmtime', config.toolchain.wasmtime, { verbose });
|
|
150
|
+
await download('wasmtime', config.toolchain.wasmtime, { silent, verbose });
|
|
145
151
|
}
|
|
146
152
|
if (config.toolchain?.['pocket-ic']) {
|
|
147
|
-
|
|
148
|
-
await download('pocket-ic', config.toolchain['pocket-ic'], { verbose });
|
|
153
|
+
await download('pocket-ic', config.toolchain['pocket-ic'], { silent, verbose });
|
|
149
154
|
}
|
|
150
155
|
if (!silent) {
|
|
151
156
|
logUpdate.clear();
|
|
@@ -11,16 +11,16 @@ export let getLatestReleaseTag = async () => {
|
|
|
11
11
|
export let getReleases = async () => {
|
|
12
12
|
// return toolchainUtils.getReleases(repo);
|
|
13
13
|
return [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
24
|
{
|
|
25
25
|
tag_name: '1.0.0',
|
|
26
26
|
published_at: new Date('2023-10-12'),
|
|
@@ -37,10 +37,6 @@ export let download = async (version, { silent = false, verbose = false } = {})
|
|
|
37
37
|
console.error('version is not defined');
|
|
38
38
|
process.exit(1);
|
|
39
39
|
}
|
|
40
|
-
if (version !== '1.0.0') {
|
|
41
|
-
console.error('Currently only pocket-ic 1.0.0 is supported');
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
44
40
|
if (isCached(version)) {
|
|
45
41
|
if (verbose) {
|
|
46
42
|
console.log(`pocket-ic ${version} is already installed`);
|
|
@@ -50,8 +46,8 @@ export let download = async (version, { silent = false, verbose = false } = {})
|
|
|
50
46
|
let platfrom = process.platform == 'darwin' ? 'darwin' : 'linux';
|
|
51
47
|
let arch = 'x86_64';
|
|
52
48
|
let hashes = {
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
'2.0.1': '69e1408347723dbaa7a6cd2faa9b65c42abbe861',
|
|
50
|
+
'2.0.0': '29ec86dc9f9ca4691d4d4386c8b2aa41e14d9d16',
|
|
55
51
|
'1.0.0': '307d5847c1d2fe1f5e19181c7d0fcec23f4658b3',
|
|
56
52
|
};
|
|
57
53
|
let url = `https://download.dfinity.systems/ic/${hashes[version]}/openssl-static-binaries/${arch}-${platfrom}/pocket-ic.gz`;
|
package/dist/package.json
CHANGED