ic-mops 1.0.0-pre.0 → 1.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/CHANGELOG.md +9 -5
- package/bundle/cli.tgz +0 -0
- package/cache.ts +1 -1
- package/cli.ts +0 -1
- package/commands/bench.ts +2 -2
- package/commands/replica.ts +11 -9
- package/commands/test/mmf1.ts +5 -1
- package/commands/test/test.ts +2 -8
- package/declarations/bench/bench.did +9 -9
- package/declarations/bench/bench.did.d.ts +5 -5
- package/declarations/bench/bench.did.js +5 -5
- package/dist/cache.js +1 -1
- package/dist/cli.js +0 -1
- package/dist/commands/bench.js +2 -2
- package/dist/commands/replica.js +10 -8
- package/dist/commands/test/mmf1.js +5 -1
- package/dist/commands/test/test.js +2 -8
- package/dist/declarations/bench/bench.did +9 -9
- package/dist/declarations/bench/bench.did.d.ts +5 -5
- package/dist/declarations/bench/bench.did.js +5 -5
- package/dist/mops.js +1 -1
- package/dist/package.json +20 -22
- package/dist/release-cli.js +5 -2
- package/dist/vessel.js +1 -1
- package/mops.ts +1 -1
- package/package.json +24 -25
- package/release-cli.ts +7 -2
- package/vessel.ts +1 -1
- package/DEVELOPMENT.md +0 -25
- package/dist/commands/import-identity.d.ts +0 -5
- package/dist/commands/import-identity.js +0 -51
- package/dist/commands/whoami.d.ts +0 -1
- package/dist/commands/whoami.js +0 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
# Mops CLI Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 1.0.0
|
|
4
4
|
- `mops cache clean` now cleans local cache too (`.mops` folder)
|
|
5
5
|
- Conflicting dependencies are now reported on `mops add/install/sources`
|
|
6
6
|
- New `--conflicts <action>` option in `mops sources` command ([docs](https://docs.mops.one/cli/mops-sources#--conflicts))
|
|
7
7
|
- New "Stable Memory" and "Garbage Collection" metrics are now reported in the `mops bench` command
|
|
8
8
|
- `mops test` command now supports `replica` mode for running actor tests ([docs](https://docs.mops.one/cli/mops-test#--mode))
|
|
9
9
|
- New `--replica` option in `mops test` command
|
|
10
|
+
- Updated npm dependencies
|
|
11
|
+
- Fixed bug with GitHub dependency with branch name containing `/`
|
|
10
12
|
|
|
11
13
|
**Breaking changes**:
|
|
12
|
-
- Default replica in `mops bench` commands now is `pocket-ic` if `pocket-ic` is specified in `mops.toml` in `[toolchain]` section
|
|
14
|
+
- Default replica in `mops bench` and `mops test` commands now is `pocket-ic` if `pocket-ic` is specified in `mops.toml` in `[toolchain]` section and `dfx` otherwise
|
|
13
15
|
- The only supported version of `pocket-ic` is `4.0.0`
|
|
14
|
-
-
|
|
15
|
-
- Default reporter in `mops test` command is now `
|
|
16
|
-
- Removed legacy folders migration code. If you are using Mops CLI `<= 0.21.0`, you need first to run `npm i -g ic-mops@0.45.3` to migrate your legacy folders. After that, you can run `mops self update` to update your Mops CLI to the latest version.
|
|
16
|
+
- Dropped support for `wasmtime` version `< 14.0.0`
|
|
17
|
+
- Default reporter in `mops test` command is now `files` if test file count is > 1 and `verbose` otherwise.
|
|
17
18
|
- Renamed `mops import-identity` command to `mops user import`
|
|
18
19
|
- Renamed `mops whoami` command to `mops user get-principal`
|
|
20
|
+
- Removed the ability to install a specific package with `mops install <pkg>` command. Use `mops add <pkg>` instead.
|
|
21
|
+
- Removed legacy folders migration code. If you are using Mops CLI `<= 0.21.0`, you need first to run `npm i -g ic-mops@0.45.3` to migrate your legacy folders. After that, you can run `mops self update` to update your Mops CLI to the latest version.
|
|
22
|
+
- Removed `--verbose` flag from `mops sources` command
|
|
19
23
|
|
|
20
24
|
## 0.45.3
|
|
21
25
|
- Fixed bug with missing `tar` package
|
package/bundle/cli.tgz
ADDED
|
Binary file
|
package/cache.ts
CHANGED
|
@@ -35,7 +35,7 @@ export function getMopsDepCacheName(name : string, version : string) {
|
|
|
35
35
|
|
|
36
36
|
export function getGithubDepCacheName(name : string, repo : string) {
|
|
37
37
|
const {branch, commitHash} = parseGithubURL(repo);
|
|
38
|
-
return `_github/${name}#${branch}` + (commitHash ? `@${commitHash}` : '');
|
|
38
|
+
return `_github/${name}#${branch.replaceAll('/', '___')}` + (commitHash ? `@${commitHash}` : '');
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export let addCache = (cacheName : string, source : string) => {
|
package/cli.ts
CHANGED
|
@@ -168,7 +168,6 @@ program
|
|
|
168
168
|
.description('for dfx packtool')
|
|
169
169
|
.option('--no-install', 'Do not install dependencies before running sources')
|
|
170
170
|
.addOption(new Option('--conflicts <action>', 'What to do with dependency version conflicts').choices(['ignore', 'warning', 'error']).default('warning'))
|
|
171
|
-
.option('--verbose', 'Show more information') // for backcompat
|
|
172
171
|
.action(async (options) => {
|
|
173
172
|
if (!checkConfigFile()) {
|
|
174
173
|
process.exit(1);
|
package/commands/bench.ts
CHANGED
|
@@ -98,7 +98,7 @@ export async function bench(filter = '', optionsArg : Partial<BenchOptions> = {}
|
|
|
98
98
|
files.sort();
|
|
99
99
|
|
|
100
100
|
let benchDir = `${getRootDir()}/.mops/.bench/`;
|
|
101
|
-
|
|
101
|
+
fs.rmSync(benchDir, {recursive: true, force: true});
|
|
102
102
|
fs.mkdirSync(benchDir, {recursive: true});
|
|
103
103
|
|
|
104
104
|
if (!options.silent) {
|
|
@@ -147,7 +147,7 @@ export async function bench(filter = '', optionsArg : Partial<BenchOptions> = {}
|
|
|
147
147
|
options.silent || console.log('Stopping replica...');
|
|
148
148
|
await replica.stop();
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
fs.rmSync(benchDir, {recursive: true, force: true});
|
|
151
151
|
|
|
152
152
|
return benchResults;
|
|
153
153
|
}
|
package/commands/replica.ts
CHANGED
|
@@ -95,18 +95,20 @@ export class Replica {
|
|
|
95
95
|
curData = curData + data.toString();
|
|
96
96
|
|
|
97
97
|
if (curData.includes('\n')) {
|
|
98
|
-
let
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
let chunk = curData.split('\n').slice(0, -1).join('\n');
|
|
99
|
+
let matches = [...chunk.matchAll(/\[Canister ([a-z0-9-]+)\] (.*)/g)];
|
|
100
|
+
|
|
101
|
+
for (let match of matches) {
|
|
102
|
+
let [, canisterId, msg] = match;
|
|
103
|
+
let stream = this.getCanisterStream(canisterId || '');
|
|
104
|
+
if (stream) {
|
|
105
|
+
stream.write(msg);
|
|
106
|
+
}
|
|
101
107
|
}
|
|
102
|
-
let [, canisterId, msg] = m;
|
|
103
108
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
stream.write(msg);
|
|
109
|
+
if (matches.length) {
|
|
110
|
+
curData = curData.split('\n').slice(-1).join('\n');
|
|
107
111
|
}
|
|
108
|
-
|
|
109
|
-
curData = '';
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
}
|
package/commands/test/mmf1.ts
CHANGED
|
@@ -83,7 +83,11 @@ export class MMF1 {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
_testEnd(name : string) {
|
|
86
|
-
|
|
86
|
+
let last = this.stack.pop();
|
|
87
|
+
if (name !== last) {
|
|
88
|
+
console.error(`Expected test name "${last}" but got "${name}"`);
|
|
89
|
+
console.error(`Stack: ${this.stack.join(' › ')}`);
|
|
90
|
+
console.error(`File: ${this.file}`);
|
|
87
91
|
throw 'mmf1._testEnd: start and end test mismatch';
|
|
88
92
|
}
|
|
89
93
|
this._status(name, 'pass');
|
package/commands/test/test.ts
CHANGED
|
@@ -247,15 +247,9 @@ export async function testWithReporter(reporterName : ReporterName | Reporter |
|
|
|
247
247
|
wasmFile,
|
|
248
248
|
];
|
|
249
249
|
}
|
|
250
|
-
// backcompat
|
|
251
250
|
else {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
'--enable-cranelift-nan-canonicalization',
|
|
255
|
-
'--wasm-features',
|
|
256
|
-
'multi-memory,bulk-memory',
|
|
257
|
-
wasmFile,
|
|
258
|
-
];
|
|
251
|
+
console.error(chalk.red('Minimum wasmtime version is 14.0.0. Please update wasmtime to the latest version'));
|
|
252
|
+
process.exit(1);
|
|
259
253
|
}
|
|
260
254
|
|
|
261
255
|
let proc = spawn(wasmtimePath, wasmtimeArgs);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type _anon_class_13_1 =
|
|
2
2
|
service {
|
|
3
3
|
getSchema: () -> (BenchSchema) query;
|
|
4
4
|
getStats: () -> (BenchResult) query;
|
|
@@ -7,24 +7,24 @@ type _anon_class_10_1 =
|
|
|
7
7
|
runCellUpdate: (nat, nat) -> (BenchResult);
|
|
8
8
|
runCellUpdateAwait: (nat, nat) -> (BenchResult);
|
|
9
9
|
};
|
|
10
|
-
type BenchSchema =
|
|
10
|
+
type BenchSchema =
|
|
11
11
|
record {
|
|
12
12
|
cols: vec text;
|
|
13
13
|
description: text;
|
|
14
14
|
name: text;
|
|
15
15
|
rows: vec text;
|
|
16
16
|
};
|
|
17
|
-
type BenchResult =
|
|
17
|
+
type BenchResult =
|
|
18
18
|
record {
|
|
19
19
|
instructions: int;
|
|
20
|
-
rts_heap_size: int;
|
|
21
|
-
stable_memory_size: int;
|
|
22
|
-
rts_stable_memory_size: int;
|
|
23
20
|
rts_collector_instructions: int;
|
|
21
|
+
rts_heap_size: int;
|
|
22
|
+
rts_logical_stable_memory_size: int;
|
|
24
23
|
rts_memory_size: int;
|
|
25
24
|
rts_mutator_instructions: int;
|
|
26
|
-
rts_total_allocation: int;
|
|
27
|
-
rts_logical_stable_memory_size: int;
|
|
28
25
|
rts_reclaimed: int;
|
|
26
|
+
rts_stable_memory_size: int;
|
|
27
|
+
rts_total_allocation: int;
|
|
28
|
+
stable_memory_size: int;
|
|
29
29
|
};
|
|
30
|
-
service : () ->
|
|
30
|
+
service : () -> _anon_class_13_1
|
|
@@ -3,14 +3,14 @@ import type { ActorMethod } from '@dfinity/agent';
|
|
|
3
3
|
import type { IDL } from '@dfinity/candid';
|
|
4
4
|
|
|
5
5
|
export interface BenchResult {
|
|
6
|
+
'rts_stable_memory_size' : bigint,
|
|
7
|
+
'stable_memory_size' : bigint,
|
|
6
8
|
'instructions' : bigint,
|
|
7
9
|
'rts_memory_size' : bigint,
|
|
8
|
-
'stable_memory_size' : bigint,
|
|
9
|
-
'rts_stable_memory_size' : bigint,
|
|
10
|
-
'rts_logical_stable_memory_size' : bigint,
|
|
11
10
|
'rts_total_allocation' : bigint,
|
|
12
11
|
'rts_collector_instructions' : bigint,
|
|
13
12
|
'rts_mutator_instructions' : bigint,
|
|
13
|
+
'rts_logical_stable_memory_size' : bigint,
|
|
14
14
|
'rts_heap_size' : bigint,
|
|
15
15
|
'rts_reclaimed' : bigint,
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@ export interface BenchSchema {
|
|
|
20
20
|
'rows' : Array<string>,
|
|
21
21
|
'description' : string,
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
23
|
+
export interface _anon_class_13_1 {
|
|
24
24
|
'getSchema' : ActorMethod<[], BenchSchema>,
|
|
25
25
|
'getStats' : ActorMethod<[], BenchResult>,
|
|
26
26
|
'init' : ActorMethod<[], BenchSchema>,
|
|
@@ -28,6 +28,6 @@ export interface _anon_class_10_1 {
|
|
|
28
28
|
'runCellUpdate' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
29
29
|
'runCellUpdateAwait' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
30
30
|
}
|
|
31
|
-
export interface _SERVICE extends
|
|
31
|
+
export interface _SERVICE extends _anon_class_13_1 {}
|
|
32
32
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
33
33
|
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -6,18 +6,18 @@ export const idlFactory = ({ IDL }) => {
|
|
|
6
6
|
'description' : IDL.Text,
|
|
7
7
|
});
|
|
8
8
|
const BenchResult = IDL.Record({
|
|
9
|
-
'instructions' : IDL.Int,
|
|
10
|
-
'stable_memory_size' : IDL.Int,
|
|
11
9
|
'rts_stable_memory_size' : IDL.Int,
|
|
12
|
-
'
|
|
10
|
+
'stable_memory_size' : IDL.Int,
|
|
11
|
+
'instructions' : IDL.Int,
|
|
13
12
|
'rts_memory_size' : IDL.Int,
|
|
14
13
|
'rts_total_allocation' : IDL.Int,
|
|
15
14
|
'rts_collector_instructions' : IDL.Int,
|
|
16
15
|
'rts_mutator_instructions' : IDL.Int,
|
|
16
|
+
'rts_logical_stable_memory_size' : IDL.Int,
|
|
17
17
|
'rts_heap_size' : IDL.Int,
|
|
18
18
|
'rts_reclaimed' : IDL.Int,
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const _anon_class_13_1 = IDL.Service({
|
|
21
21
|
'getSchema' : IDL.Func([], [BenchSchema], ['query']),
|
|
22
22
|
'getStats' : IDL.Func([], [BenchResult], ['query']),
|
|
23
23
|
'init' : IDL.Func([], [BenchSchema], []),
|
|
@@ -25,6 +25,6 @@ export const idlFactory = ({ IDL }) => {
|
|
|
25
25
|
'runCellUpdate' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
|
|
26
26
|
'runCellUpdateAwait' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
|
|
27
27
|
});
|
|
28
|
-
return
|
|
28
|
+
return _anon_class_13_1;
|
|
29
29
|
};
|
|
30
30
|
export const init = ({ IDL }) => { return []; };
|
package/dist/cache.js
CHANGED
|
@@ -27,7 +27,7 @@ export function getMopsDepCacheName(name, version) {
|
|
|
27
27
|
}
|
|
28
28
|
export function getGithubDepCacheName(name, repo) {
|
|
29
29
|
const { branch, commitHash } = parseGithubURL(repo);
|
|
30
|
-
return `_github/${name}#${branch}` + (commitHash ? `@${commitHash}` : '');
|
|
30
|
+
return `_github/${name}#${branch.replaceAll('/', '___')}` + (commitHash ? `@${commitHash}` : '');
|
|
31
31
|
}
|
|
32
32
|
export let addCache = (cacheName, source) => {
|
|
33
33
|
let dest = path.join(getGlobalCacheDir(), 'packages', cacheName);
|
package/dist/cli.js
CHANGED
|
@@ -140,7 +140,6 @@ program
|
|
|
140
140
|
.description('for dfx packtool')
|
|
141
141
|
.option('--no-install', 'Do not install dependencies before running sources')
|
|
142
142
|
.addOption(new Option('--conflicts <action>', 'What to do with dependency version conflicts').choices(['ignore', 'warning', 'error']).default('warning'))
|
|
143
|
-
.option('--verbose', 'Show more information') // for backcompat
|
|
144
143
|
.action(async (options) => {
|
|
145
144
|
if (!checkConfigFile()) {
|
|
146
145
|
process.exit(1);
|
package/dist/commands/bench.js
CHANGED
|
@@ -69,7 +69,7 @@ export async function bench(filter = '', optionsArg = {}) {
|
|
|
69
69
|
}
|
|
70
70
|
files.sort();
|
|
71
71
|
let benchDir = `${getRootDir()}/.mops/.bench/`;
|
|
72
|
-
|
|
72
|
+
fs.rmSync(benchDir, { recursive: true, force: true });
|
|
73
73
|
fs.mkdirSync(benchDir, { recursive: true });
|
|
74
74
|
if (!options.silent) {
|
|
75
75
|
console.log('Benchmark files:');
|
|
@@ -111,7 +111,7 @@ export async function bench(filter = '', optionsArg = {}) {
|
|
|
111
111
|
});
|
|
112
112
|
options.silent || console.log('Stopping replica...');
|
|
113
113
|
await replica.stop();
|
|
114
|
-
|
|
114
|
+
fs.rmSync(benchDir, { recursive: true, force: true });
|
|
115
115
|
return benchResults;
|
|
116
116
|
}
|
|
117
117
|
function getMocArgs(options) {
|
package/dist/commands/replica.js
CHANGED
|
@@ -70,16 +70,18 @@ export class Replica {
|
|
|
70
70
|
proc.stderr.on('data', (data) => {
|
|
71
71
|
curData = curData + data.toString();
|
|
72
72
|
if (curData.includes('\n')) {
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
let chunk = curData.split('\n').slice(0, -1).join('\n');
|
|
74
|
+
let matches = [...chunk.matchAll(/\[Canister ([a-z0-9-]+)\] (.*)/g)];
|
|
75
|
+
for (let match of matches) {
|
|
76
|
+
let [, canisterId, msg] = match;
|
|
77
|
+
let stream = this.getCanisterStream(canisterId || '');
|
|
78
|
+
if (stream) {
|
|
79
|
+
stream.write(msg);
|
|
80
|
+
}
|
|
76
81
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (stream) {
|
|
80
|
-
stream.write(msg);
|
|
82
|
+
if (matches.length) {
|
|
83
|
+
curData = curData.split('\n').slice(-1).join('\n');
|
|
81
84
|
}
|
|
82
|
-
curData = '';
|
|
83
85
|
}
|
|
84
86
|
});
|
|
85
87
|
}
|
|
@@ -67,7 +67,11 @@ export class MMF1 {
|
|
|
67
67
|
this.stack.push(name);
|
|
68
68
|
}
|
|
69
69
|
_testEnd(name) {
|
|
70
|
-
|
|
70
|
+
let last = this.stack.pop();
|
|
71
|
+
if (name !== last) {
|
|
72
|
+
console.error(`Expected test name "${last}" but got "${name}"`);
|
|
73
|
+
console.error(`Stack: ${this.stack.join(' › ')}`);
|
|
74
|
+
console.error(`File: ${this.file}`);
|
|
71
75
|
throw 'mmf1._testEnd: start and end test mismatch';
|
|
72
76
|
}
|
|
73
77
|
this._status(name, 'pass');
|
|
@@ -200,15 +200,9 @@ export async function testWithReporter(reporterName, filter = '', defaultMode =
|
|
|
200
200
|
wasmFile,
|
|
201
201
|
];
|
|
202
202
|
}
|
|
203
|
-
// backcompat
|
|
204
203
|
else {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
'--enable-cranelift-nan-canonicalization',
|
|
208
|
-
'--wasm-features',
|
|
209
|
-
'multi-memory,bulk-memory',
|
|
210
|
-
wasmFile,
|
|
211
|
-
];
|
|
204
|
+
console.error(chalk.red('Minimum wasmtime version is 14.0.0. Please update wasmtime to the latest version'));
|
|
205
|
+
process.exit(1);
|
|
212
206
|
}
|
|
213
207
|
let proc = spawn(wasmtimePath, wasmtimeArgs);
|
|
214
208
|
await pipeMMF(proc, mmf);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type _anon_class_13_1 =
|
|
2
2
|
service {
|
|
3
3
|
getSchema: () -> (BenchSchema) query;
|
|
4
4
|
getStats: () -> (BenchResult) query;
|
|
@@ -7,24 +7,24 @@ type _anon_class_10_1 =
|
|
|
7
7
|
runCellUpdate: (nat, nat) -> (BenchResult);
|
|
8
8
|
runCellUpdateAwait: (nat, nat) -> (BenchResult);
|
|
9
9
|
};
|
|
10
|
-
type BenchSchema =
|
|
10
|
+
type BenchSchema =
|
|
11
11
|
record {
|
|
12
12
|
cols: vec text;
|
|
13
13
|
description: text;
|
|
14
14
|
name: text;
|
|
15
15
|
rows: vec text;
|
|
16
16
|
};
|
|
17
|
-
type BenchResult =
|
|
17
|
+
type BenchResult =
|
|
18
18
|
record {
|
|
19
19
|
instructions: int;
|
|
20
|
-
rts_heap_size: int;
|
|
21
|
-
stable_memory_size: int;
|
|
22
|
-
rts_stable_memory_size: int;
|
|
23
20
|
rts_collector_instructions: int;
|
|
21
|
+
rts_heap_size: int;
|
|
22
|
+
rts_logical_stable_memory_size: int;
|
|
24
23
|
rts_memory_size: int;
|
|
25
24
|
rts_mutator_instructions: int;
|
|
26
|
-
rts_total_allocation: int;
|
|
27
|
-
rts_logical_stable_memory_size: int;
|
|
28
25
|
rts_reclaimed: int;
|
|
26
|
+
rts_stable_memory_size: int;
|
|
27
|
+
rts_total_allocation: int;
|
|
28
|
+
stable_memory_size: int;
|
|
29
29
|
};
|
|
30
|
-
service : () ->
|
|
30
|
+
service : () -> _anon_class_13_1
|
|
@@ -3,14 +3,14 @@ import type { ActorMethod } from '@dfinity/agent';
|
|
|
3
3
|
import type { IDL } from '@dfinity/candid';
|
|
4
4
|
|
|
5
5
|
export interface BenchResult {
|
|
6
|
+
'rts_stable_memory_size' : bigint,
|
|
7
|
+
'stable_memory_size' : bigint,
|
|
6
8
|
'instructions' : bigint,
|
|
7
9
|
'rts_memory_size' : bigint,
|
|
8
|
-
'stable_memory_size' : bigint,
|
|
9
|
-
'rts_stable_memory_size' : bigint,
|
|
10
|
-
'rts_logical_stable_memory_size' : bigint,
|
|
11
10
|
'rts_total_allocation' : bigint,
|
|
12
11
|
'rts_collector_instructions' : bigint,
|
|
13
12
|
'rts_mutator_instructions' : bigint,
|
|
13
|
+
'rts_logical_stable_memory_size' : bigint,
|
|
14
14
|
'rts_heap_size' : bigint,
|
|
15
15
|
'rts_reclaimed' : bigint,
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@ export interface BenchSchema {
|
|
|
20
20
|
'rows' : Array<string>,
|
|
21
21
|
'description' : string,
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
23
|
+
export interface _anon_class_13_1 {
|
|
24
24
|
'getSchema' : ActorMethod<[], BenchSchema>,
|
|
25
25
|
'getStats' : ActorMethod<[], BenchResult>,
|
|
26
26
|
'init' : ActorMethod<[], BenchSchema>,
|
|
@@ -28,6 +28,6 @@ export interface _anon_class_10_1 {
|
|
|
28
28
|
'runCellUpdate' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
29
29
|
'runCellUpdateAwait' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
30
30
|
}
|
|
31
|
-
export interface _SERVICE extends
|
|
31
|
+
export interface _SERVICE extends _anon_class_13_1 {}
|
|
32
32
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
33
33
|
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -6,18 +6,18 @@ export const idlFactory = ({ IDL }) => {
|
|
|
6
6
|
'description' : IDL.Text,
|
|
7
7
|
});
|
|
8
8
|
const BenchResult = IDL.Record({
|
|
9
|
-
'instructions' : IDL.Int,
|
|
10
|
-
'stable_memory_size' : IDL.Int,
|
|
11
9
|
'rts_stable_memory_size' : IDL.Int,
|
|
12
|
-
'
|
|
10
|
+
'stable_memory_size' : IDL.Int,
|
|
11
|
+
'instructions' : IDL.Int,
|
|
13
12
|
'rts_memory_size' : IDL.Int,
|
|
14
13
|
'rts_total_allocation' : IDL.Int,
|
|
15
14
|
'rts_collector_instructions' : IDL.Int,
|
|
16
15
|
'rts_mutator_instructions' : IDL.Int,
|
|
16
|
+
'rts_logical_stable_memory_size' : IDL.Int,
|
|
17
17
|
'rts_heap_size' : IDL.Int,
|
|
18
18
|
'rts_reclaimed' : IDL.Int,
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const _anon_class_13_1 = IDL.Service({
|
|
21
21
|
'getSchema' : IDL.Func([], [BenchSchema], ['query']),
|
|
22
22
|
'getStats' : IDL.Func([], [BenchResult], ['query']),
|
|
23
23
|
'init' : IDL.Func([], [BenchSchema], []),
|
|
@@ -25,6 +25,6 @@ export const idlFactory = ({ IDL }) => {
|
|
|
25
25
|
'runCellUpdate' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
|
|
26
26
|
'runCellUpdateAwait' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
|
|
27
27
|
});
|
|
28
|
-
return
|
|
28
|
+
return _anon_class_13_1;
|
|
29
29
|
};
|
|
30
30
|
export const init = ({ IDL }) => { return []; };
|
package/dist/mops.js
CHANGED
|
@@ -187,7 +187,7 @@ export function formatDir(name, version) {
|
|
|
187
187
|
}
|
|
188
188
|
export function formatGithubDir(name, repo) {
|
|
189
189
|
const { branch, commitHash } = parseGithubURL(repo);
|
|
190
|
-
return path.join(getRootDir(), '.mops/_github', `${name}#${branch}` + (commitHash ? `@${commitHash}` : ''));
|
|
190
|
+
return path.join(getRootDir(), '.mops/_github', `${name}#${branch.replaceAll('/', '___')}` + (commitHash ? `@${commitHash}` : ''));
|
|
191
191
|
}
|
|
192
192
|
export function readDfxJson() {
|
|
193
193
|
let dir = process.cwd();
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "bin/mops.js",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"*",
|
|
12
12
|
"!network.txt",
|
|
13
|
+
"!Dockerfile",
|
|
14
|
+
"!verify.sh",
|
|
15
|
+
"!build.sh",
|
|
16
|
+
"!DEVELOPMENT.md",
|
|
13
17
|
"!.mops",
|
|
14
18
|
"/templates"
|
|
15
19
|
],
|
|
@@ -24,13 +28,13 @@
|
|
|
24
28
|
"node": ">=18.0.0"
|
|
25
29
|
},
|
|
26
30
|
"dependencies": {
|
|
27
|
-
"@dfinity/agent": "2.
|
|
28
|
-
"@dfinity/candid": "2.
|
|
29
|
-
"@dfinity/identity": "2.
|
|
30
|
-
"@dfinity/identity-secp256k1": "2.
|
|
31
|
-
"@dfinity/principal": "2.
|
|
31
|
+
"@dfinity/agent": "2.1.0",
|
|
32
|
+
"@dfinity/candid": "2.1.0",
|
|
33
|
+
"@dfinity/identity": "2.1.0",
|
|
34
|
+
"@dfinity/identity-secp256k1": "2.1.0",
|
|
35
|
+
"@dfinity/principal": "2.1.0",
|
|
32
36
|
"@iarna/toml": "2.2.5",
|
|
33
|
-
"@noble/hashes": "1.
|
|
37
|
+
"@noble/hashes": "1.5.0",
|
|
34
38
|
"as-table": "1.0.55",
|
|
35
39
|
"buffer": "6.0.3",
|
|
36
40
|
"cacheable-request": "12.0.1",
|
|
@@ -38,13 +42,13 @@
|
|
|
38
42
|
"chalk": "5.3.0",
|
|
39
43
|
"chokidar": "3.6.0",
|
|
40
44
|
"commander": "12.1.0",
|
|
41
|
-
"debounce": "2.1.
|
|
45
|
+
"debounce": "2.1.1",
|
|
42
46
|
"decomp-tarxz": "0.1.1",
|
|
43
47
|
"decompress": "4.2.1",
|
|
44
48
|
"del": "7.1.0",
|
|
45
49
|
"dhall-to-json-cli": "1.7.6",
|
|
46
|
-
"execa": "9.3.
|
|
47
|
-
"filesize": "10.1.
|
|
50
|
+
"execa": "9.3.1",
|
|
51
|
+
"filesize": "10.1.6",
|
|
48
52
|
"fs-extra": "11.2.0",
|
|
49
53
|
"get-folder-size": "5.0.0",
|
|
50
54
|
"glob": "11.0.0",
|
|
@@ -59,7 +63,7 @@
|
|
|
59
63
|
"node-fetch": "3.3.2",
|
|
60
64
|
"octokit": "3.1.2",
|
|
61
65
|
"pem-file": "1.0.1",
|
|
62
|
-
"pic-ic": "0.5.
|
|
66
|
+
"pic-ic": "0.5.3",
|
|
63
67
|
"prompts": "2.4.2",
|
|
64
68
|
"semver": "7.6.3",
|
|
65
69
|
"stream-to-promise": "3.0.0",
|
|
@@ -73,21 +77,15 @@
|
|
|
73
77
|
"@types/fs-extra": "11.0.4",
|
|
74
78
|
"@types/glob": "8.1.0",
|
|
75
79
|
"@types/ncp": "2.0.8",
|
|
76
|
-
"@types/node": "22.
|
|
80
|
+
"@types/node": "22.5.4",
|
|
77
81
|
"@types/prompts": "2.4.9",
|
|
78
82
|
"@types/semver": "7.5.8",
|
|
79
83
|
"@types/stream-to-promise": "2.2.4",
|
|
80
84
|
"@types/tar": "6.1.13",
|
|
81
|
-
"bun": "1.
|
|
82
|
-
"esbuild": "0.23.
|
|
85
|
+
"bun": "1.1.27",
|
|
86
|
+
"esbuild": "0.23.1",
|
|
83
87
|
"eslint": "8.57.0",
|
|
84
|
-
"tsx": "4.
|
|
85
|
-
"typescript": "5.
|
|
86
|
-
},
|
|
87
|
-
"overrides": {
|
|
88
|
-
"@dfinity/agent": "2.0.0",
|
|
89
|
-
"@dfinity/identity": "2.0.0",
|
|
90
|
-
"@dfinity/principal": "2.0.0",
|
|
91
|
-
"@dfinity/candid": "2.0.0"
|
|
88
|
+
"tsx": "4.19.1",
|
|
89
|
+
"typescript": "5.6.2"
|
|
92
90
|
}
|
|
93
91
|
}
|
package/dist/release-cli.js
CHANGED
|
@@ -8,8 +8,9 @@ import { sha256 } from '@noble/hashes/sha256';
|
|
|
8
8
|
import { bytesToHex } from '@noble/hashes/utils';
|
|
9
9
|
import { findChangelogEntry } from './helpers/find-changelog-entry.js';
|
|
10
10
|
let __dirname = new URL('.', import.meta.url).pathname;
|
|
11
|
-
|
|
12
|
-
execSync('
|
|
11
|
+
// build using Docker
|
|
12
|
+
execSync('./build.sh', { stdio: 'inherit', cwd: __dirname });
|
|
13
|
+
let commitHash = process.env.COMMIT_HASH || execSync('git rev-parse HEAD').toString().trim();
|
|
13
14
|
let version = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json'), 'utf8')).version;
|
|
14
15
|
let major = semver.parse(version)?.major;
|
|
15
16
|
let tag = semver.parse(version)?.prerelease[0] || 'latest';
|
|
@@ -17,6 +18,7 @@ let releaseNotes = findChangelogEntry(fs.readFileSync(path.resolve(__dirname, 'C
|
|
|
17
18
|
let data = fs.readFileSync(path.resolve(__dirname, 'bundle/cli.tgz'));
|
|
18
19
|
let hash = bytesToHex(sha256(data));
|
|
19
20
|
let size = data.byteLength;
|
|
21
|
+
console.log(`Commit hash of release: ${commitHash}`);
|
|
20
22
|
fs.cpSync(path.resolve(__dirname, 'bundle/cli.tgz'), path.resolve(__dirname, `../cli-releases/versions/${version}.tgz`), { force: false, errorOnExist: true });
|
|
21
23
|
fs.cpSync(path.resolve(__dirname, `../cli-releases/versions/${version}.tgz`), path.resolve(__dirname, `../cli-releases/versions/${tag}.tgz`), { force: true, errorOnExist: false, recursive: true });
|
|
22
24
|
fs.cpSync(path.resolve(__dirname, `../cli-releases/versions/${version}.tgz`), path.resolve(__dirname, `../cli-releases/versions/${major}.tgz`), { force: true, errorOnExist: false, recursive: true });
|
|
@@ -31,6 +33,7 @@ releases.versions[version] = {
|
|
|
31
33
|
time: new Date().getTime(),
|
|
32
34
|
size,
|
|
33
35
|
relseaseNotes: releaseNotes,
|
|
36
|
+
commitHash: commitHash,
|
|
34
37
|
url: `https://cli.mops.one/versions/${version}.tgz`,
|
|
35
38
|
hash,
|
|
36
39
|
};
|
package/dist/vessel.js
CHANGED
|
@@ -82,7 +82,7 @@ export const downloadFromGithub = async (repo, dest, onProgress) => {
|
|
|
82
82
|
// Prevent `onError` being called twice.
|
|
83
83
|
readStream.off('error', reject);
|
|
84
84
|
const tmpDir = path.resolve(process.cwd(), '.mops/_tmp/');
|
|
85
|
-
const tmpFile = path.resolve(tmpDir, `${gitName}@${commitHash || branch}.zip`);
|
|
85
|
+
const tmpFile = path.resolve(tmpDir, `${gitName}@${(commitHash || branch).replaceAll('/', '___')}.zip`);
|
|
86
86
|
try {
|
|
87
87
|
mkdirSync(tmpDir, { recursive: true });
|
|
88
88
|
pipeline(readStream, createWriteStream(tmpFile), (err) => {
|
package/mops.ts
CHANGED
|
@@ -219,7 +219,7 @@ export function formatDir(name : string, version : string) {
|
|
|
219
219
|
|
|
220
220
|
export function formatGithubDir(name : string, repo : string) {
|
|
221
221
|
const {branch, commitHash} = parseGithubURL(repo);
|
|
222
|
-
return path.join(getRootDir(), '.mops/_github', `${name}#${branch}` + (commitHash ? `@${commitHash}` : ''));
|
|
222
|
+
return path.join(getRootDir(), '.mops/_github', `${name}#${branch.replaceAll('/', '___')}` + (commitHash ? `@${commitHash}` : ''));
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
export function readDfxJson() : any {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "dist/bin/mops.js",
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"*",
|
|
12
12
|
"!network.txt",
|
|
13
|
+
"!Dockerfile",
|
|
14
|
+
"!verify.sh",
|
|
15
|
+
"!build.sh",
|
|
16
|
+
"!DEVELOPMENT.md",
|
|
13
17
|
"!.mops",
|
|
14
18
|
"/templates"
|
|
15
19
|
],
|
|
@@ -24,14 +28,15 @@
|
|
|
24
28
|
"node": ">=18.0.0"
|
|
25
29
|
},
|
|
26
30
|
"scripts": {
|
|
27
|
-
"build": "
|
|
31
|
+
"build": "npm run prepare && npm run bundle",
|
|
32
|
+
"dist": "tsc",
|
|
28
33
|
"bundle": "rm -rf ./bundle && bun build ./cli.ts --outdir ./bundle --target node --minify --external @napi-rs/lzma --external fsevents --format esm --define '__dirname=import.meta.dirname' && npm run bundle:fix && npm run bundle:copy && npm run bundle:package-json && npm run bundle:tar",
|
|
29
34
|
"bundle:fix": "npx -y rexreplace 'new URL\\(\"\\.\\./templates' 'new URL(\"./templates' bundle/cli.js",
|
|
30
35
|
"bundle:copy": "cp -r commands/bench bundle && cp -r bin declarations templates package.json bundle",
|
|
31
36
|
"bundle:package-json": "tsx bundle-package-json.ts",
|
|
32
|
-
"bundle:tar": "touch bundle/cli.tgz && tar --exclude bundle/cli.tgz -
|
|
37
|
+
"bundle:tar": "rm -f bundle/cli.tgz && touch -t 200101010101 bundle/cli.tgz && find bundle -exec touch -d '1970-01-01 00:00:00' {} + && tar --sort name --exclude bundle/cli.tgz -cvf - bundle | gzip -n > bundle/cli.tgz",
|
|
33
38
|
"copy": "cp -r commands/bench dist/commands && cp -r declarations templates package.json bin dist | true",
|
|
34
|
-
"prepare": "npm run
|
|
39
|
+
"prepare": "rm -rf dist && npm run dist && npm run copy && npm run fix-dist",
|
|
35
40
|
"fix-dist": "tsx ./fix-dist.ts",
|
|
36
41
|
"release": "tsx release-cli.ts",
|
|
37
42
|
"check": "tsc --project tsconfig.json --noEmit",
|
|
@@ -39,13 +44,13 @@
|
|
|
39
44
|
"esbuild": "esbuild"
|
|
40
45
|
},
|
|
41
46
|
"dependencies": {
|
|
42
|
-
"@dfinity/agent": "2.
|
|
43
|
-
"@dfinity/candid": "2.
|
|
44
|
-
"@dfinity/identity": "2.
|
|
45
|
-
"@dfinity/identity-secp256k1": "2.
|
|
46
|
-
"@dfinity/principal": "2.
|
|
47
|
+
"@dfinity/agent": "2.1.0",
|
|
48
|
+
"@dfinity/candid": "2.1.0",
|
|
49
|
+
"@dfinity/identity": "2.1.0",
|
|
50
|
+
"@dfinity/identity-secp256k1": "2.1.0",
|
|
51
|
+
"@dfinity/principal": "2.1.0",
|
|
47
52
|
"@iarna/toml": "2.2.5",
|
|
48
|
-
"@noble/hashes": "1.
|
|
53
|
+
"@noble/hashes": "1.5.0",
|
|
49
54
|
"as-table": "1.0.55",
|
|
50
55
|
"buffer": "6.0.3",
|
|
51
56
|
"cacheable-request": "12.0.1",
|
|
@@ -53,13 +58,13 @@
|
|
|
53
58
|
"chalk": "5.3.0",
|
|
54
59
|
"chokidar": "3.6.0",
|
|
55
60
|
"commander": "12.1.0",
|
|
56
|
-
"debounce": "2.1.
|
|
61
|
+
"debounce": "2.1.1",
|
|
57
62
|
"decomp-tarxz": "0.1.1",
|
|
58
63
|
"decompress": "4.2.1",
|
|
59
64
|
"del": "7.1.0",
|
|
60
65
|
"dhall-to-json-cli": "1.7.6",
|
|
61
|
-
"execa": "9.3.
|
|
62
|
-
"filesize": "10.1.
|
|
66
|
+
"execa": "9.3.1",
|
|
67
|
+
"filesize": "10.1.6",
|
|
63
68
|
"fs-extra": "11.2.0",
|
|
64
69
|
"get-folder-size": "5.0.0",
|
|
65
70
|
"glob": "11.0.0",
|
|
@@ -74,7 +79,7 @@
|
|
|
74
79
|
"node-fetch": "3.3.2",
|
|
75
80
|
"octokit": "3.1.2",
|
|
76
81
|
"pem-file": "1.0.1",
|
|
77
|
-
"pic-ic": "0.5.
|
|
82
|
+
"pic-ic": "0.5.3",
|
|
78
83
|
"prompts": "2.4.2",
|
|
79
84
|
"semver": "7.6.3",
|
|
80
85
|
"stream-to-promise": "3.0.0",
|
|
@@ -88,21 +93,15 @@
|
|
|
88
93
|
"@types/fs-extra": "11.0.4",
|
|
89
94
|
"@types/glob": "8.1.0",
|
|
90
95
|
"@types/ncp": "2.0.8",
|
|
91
|
-
"@types/node": "22.
|
|
96
|
+
"@types/node": "22.5.4",
|
|
92
97
|
"@types/prompts": "2.4.9",
|
|
93
98
|
"@types/semver": "7.5.8",
|
|
94
99
|
"@types/stream-to-promise": "2.2.4",
|
|
95
100
|
"@types/tar": "6.1.13",
|
|
96
|
-
"bun": "1.
|
|
97
|
-
"esbuild": "0.23.
|
|
101
|
+
"bun": "1.1.27",
|
|
102
|
+
"esbuild": "0.23.1",
|
|
98
103
|
"eslint": "8.57.0",
|
|
99
|
-
"tsx": "4.
|
|
100
|
-
"typescript": "5.
|
|
101
|
-
},
|
|
102
|
-
"overrides": {
|
|
103
|
-
"@dfinity/agent": "2.0.0",
|
|
104
|
-
"@dfinity/identity": "2.0.0",
|
|
105
|
-
"@dfinity/principal": "2.0.0",
|
|
106
|
-
"@dfinity/candid": "2.0.0"
|
|
104
|
+
"tsx": "4.19.1",
|
|
105
|
+
"typescript": "5.6.2"
|
|
107
106
|
}
|
|
108
107
|
}
|
package/release-cli.ts
CHANGED
|
@@ -11,9 +11,10 @@ import {findChangelogEntry} from './helpers/find-changelog-entry.js';
|
|
|
11
11
|
|
|
12
12
|
let __dirname = new URL('.', import.meta.url).pathname;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
execSync('
|
|
14
|
+
// build using Docker
|
|
15
|
+
execSync('./build.sh', {stdio: 'inherit', cwd: __dirname});
|
|
16
16
|
|
|
17
|
+
let commitHash = process.env.COMMIT_HASH || execSync('git rev-parse HEAD').toString().trim();
|
|
17
18
|
let version = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json'), 'utf8')).version;
|
|
18
19
|
let major = semver.parse(version)?.major;
|
|
19
20
|
let tag = semver.parse(version)?.prerelease[0] || 'latest';
|
|
@@ -22,6 +23,8 @@ let data = fs.readFileSync(path.resolve(__dirname, 'bundle/cli.tgz'));
|
|
|
22
23
|
let hash = bytesToHex(sha256(data));
|
|
23
24
|
let size = data.byteLength;
|
|
24
25
|
|
|
26
|
+
console.log(`Commit hash of release: ${commitHash}`);
|
|
27
|
+
|
|
25
28
|
fs.cpSync(path.resolve(__dirname, 'bundle/cli.tgz'), path.resolve(__dirname, `../cli-releases/versions/${version}.tgz`), {force: false, errorOnExist: true});
|
|
26
29
|
|
|
27
30
|
fs.cpSync(path.resolve(__dirname, `../cli-releases/versions/${version}.tgz`), path.resolve(__dirname, `../cli-releases/versions/${tag}.tgz`), {force: true, errorOnExist: false, recursive: true});
|
|
@@ -39,6 +42,7 @@ type Releases = {
|
|
|
39
42
|
time : number;
|
|
40
43
|
size : number;
|
|
41
44
|
hash : string;
|
|
45
|
+
commitHash ?: string;
|
|
42
46
|
url : string;
|
|
43
47
|
relseaseNotes : string;
|
|
44
48
|
}>;
|
|
@@ -55,6 +59,7 @@ releases.versions[version] = {
|
|
|
55
59
|
time: new Date().getTime(),
|
|
56
60
|
size,
|
|
57
61
|
relseaseNotes: releaseNotes,
|
|
62
|
+
commitHash: commitHash,
|
|
58
63
|
url: `https://cli.mops.one/versions/${version}.tgz`,
|
|
59
64
|
hash,
|
|
60
65
|
};
|
package/vessel.ts
CHANGED
|
@@ -111,7 +111,7 @@ export const downloadFromGithub = async (repo : string, dest : string, onProgres
|
|
|
111
111
|
// Prevent `onError` being called twice.
|
|
112
112
|
readStream.off('error', reject);
|
|
113
113
|
const tmpDir = path.resolve(process.cwd(), '.mops/_tmp/');
|
|
114
|
-
const tmpFile = path.resolve(tmpDir, `${gitName}@${commitHash || branch}.zip`);
|
|
114
|
+
const tmpFile = path.resolve(tmpDir, `${gitName}@${(commitHash || branch).replaceAll('/', '___')}.zip`);
|
|
115
115
|
|
|
116
116
|
try {
|
|
117
117
|
mkdirSync(tmpDir, {recursive: true});
|
package/DEVELOPMENT.md
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Mops CLI
|
|
2
|
-
|
|
3
|
-
1. Update the version in `package.json` using `npm version` command.
|
|
4
|
-
|
|
5
|
-
2. Update changelog in `CHANGELOG.md` file.
|
|
6
|
-
|
|
7
|
-
3. Publish.
|
|
8
|
-
|
|
9
|
-
## Publish to npm
|
|
10
|
-
```
|
|
11
|
-
npm publish
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Publish on chain
|
|
15
|
-
|
|
16
|
-
1. Prepeare release
|
|
17
|
-
```
|
|
18
|
-
npm run release
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
2. Deploy canister
|
|
22
|
-
(from root of the project)
|
|
23
|
-
```
|
|
24
|
-
dfx deploy --network ic --no-wallet cli
|
|
25
|
-
```
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { Buffer } from 'node:buffer';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import prompts from 'prompts';
|
|
6
|
-
import { deleteSync } from 'del';
|
|
7
|
-
import { globalConfigDir } from '../mops.js';
|
|
8
|
-
import { encrypt } from '../pem.js';
|
|
9
|
-
export async function importPem(data, options = { encrypt: true }) {
|
|
10
|
-
try {
|
|
11
|
-
if (!fs.existsSync(globalConfigDir)) {
|
|
12
|
-
fs.mkdirSync(globalConfigDir);
|
|
13
|
-
}
|
|
14
|
-
let password = '';
|
|
15
|
-
if (options.encrypt) {
|
|
16
|
-
let res = await prompts({
|
|
17
|
-
type: 'invisible',
|
|
18
|
-
name: 'password',
|
|
19
|
-
message: 'Enter password to encrypt identity.pem',
|
|
20
|
-
});
|
|
21
|
-
password = res.password;
|
|
22
|
-
if (!password) {
|
|
23
|
-
let res = await prompts({
|
|
24
|
-
type: 'confirm',
|
|
25
|
-
name: 'ok',
|
|
26
|
-
message: 'Are you sure you don\'t want to protect your identity.pem with a password?',
|
|
27
|
-
});
|
|
28
|
-
if (!res.ok) {
|
|
29
|
-
console.log('aborted');
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
let identityPem = path.resolve(globalConfigDir, 'identity.pem');
|
|
35
|
-
let identityPemEncrypted = path.resolve(globalConfigDir, 'identity.pem.encrypted');
|
|
36
|
-
deleteSync([identityPem, identityPemEncrypted], { force: true });
|
|
37
|
-
// encrypted
|
|
38
|
-
if (password) {
|
|
39
|
-
let encrypted = await encrypt(Buffer.from(data), password);
|
|
40
|
-
fs.writeFileSync(identityPemEncrypted, encrypted);
|
|
41
|
-
}
|
|
42
|
-
// unencrypted
|
|
43
|
-
else {
|
|
44
|
-
fs.writeFileSync(identityPem, data);
|
|
45
|
-
}
|
|
46
|
-
console.log(chalk.green('Success'));
|
|
47
|
-
}
|
|
48
|
-
catch (err) {
|
|
49
|
-
console.log(chalk.red('Error: ') + err);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function whoami(): Promise<void>;
|
package/dist/commands/whoami.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { getIdentity } from '../mops.js';
|
|
3
|
-
export async function whoami() {
|
|
4
|
-
let identity = await getIdentity();
|
|
5
|
-
if (identity) {
|
|
6
|
-
console.log(identity.getPrincipal().toText());
|
|
7
|
-
}
|
|
8
|
-
else {
|
|
9
|
-
console.log(chalk.red('Error: ') + 'identity not found. Run ' + chalk.greenBright('mops import-identity') + ' command.');
|
|
10
|
-
}
|
|
11
|
-
}
|