ic-mops 1.3.0-pre.0 → 1.3.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 +7 -1
- package/README.md +12 -4
- package/cli.ts +6 -0
- package/commands/bench-replica.ts +9 -7
- package/commands/bench.ts +21 -4
- package/commands/init.ts +3 -2
- package/commands/template.ts +3 -3
- package/dist/cli.js +5 -0
- package/dist/commands/bench-replica.d.ts +3 -2
- package/dist/commands/bench-replica.js +6 -4
- package/dist/commands/bench.d.ts +2 -1
- package/dist/commands/bench.js +16 -3
- package/dist/commands/init.js +3 -2
- package/dist/commands/template.js +3 -3
- package/dist/package.json +19 -19
- package/dist/pem.d.ts +1 -1
- package/package.json +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
# Mops CLI Changelog
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
- Show error on `mops install <pkg>` command. Use `mops add <pkg>` instead.
|
|
5
|
+
- Added support for pocket-ic replica that comes with dfx in `mops bench` command. To activate it, remove `pocket-ic` from `mops.toml` and run `mops bench --replica pocket-ic`. Requires dfx 0.24.1 or higher.
|
|
6
|
+
- `mops init` now pre-fills package name with current directory name in kebab-case
|
|
7
|
+
- Updated non-major npm dependencies
|
|
8
|
+
|
|
3
9
|
## 1.2.0
|
|
4
10
|
- Removed `mops transfer-ownership` command
|
|
5
11
|
- Added `mops owner` command to manage package owners ([docs](https://docs.mops.one/cli/mops-owner))
|
|
6
|
-
- Added `mops
|
|
12
|
+
- Added `mops maintainer` command to manage package maintainers ([docs](https://docs.mops.one/cli/mops-maintainer))
|
|
7
13
|
- Added experimental support for pocket-ic replica that comes with dfx in `mops test` command ([docs](https://docs.mops.one/cli/mops-test#--replica))
|
|
8
14
|
- Added flag `--verbose` to `mops test` command to show replica logs
|
|
9
15
|
- Fixed bug where `mops watch` would fail if dfx.json did not exist
|
package/README.md
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Mops is a package manager for the Motoko programming language.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- [Motoko Package Registry](https://mops.one)
|
|
6
|
+
- [Documentation](https://docs.mops.one)
|
|
7
|
+
- [Blog](https://blog.mops.one)
|
|
8
|
+
- [CLI](https://cli.mops.one)
|
|
6
9
|
|
|
7
10
|
## Setup
|
|
8
11
|
|
|
@@ -12,6 +15,10 @@ See https://mops.one
|
|
|
12
15
|
|
|
13
16
|
### 2. Install CLI tool
|
|
14
17
|
```
|
|
18
|
+
curl -fsSL cli.mops.one/install.sh | sh
|
|
19
|
+
```
|
|
20
|
+
or
|
|
21
|
+
```
|
|
15
22
|
npm i -g ic-mops
|
|
16
23
|
```
|
|
17
24
|
|
|
@@ -33,8 +40,6 @@ Add `mops` as a packtool to your `dfx.json`
|
|
|
33
40
|
### 2. Initialize
|
|
34
41
|
Run this command in the root directory of your project (where is `dfx.json` placed)
|
|
35
42
|
|
|
36
|
-
If there are Vessel config files, mops will migrate packages from `vessel.dhall` to `mops.toml`
|
|
37
|
-
|
|
38
43
|
```
|
|
39
44
|
mops init
|
|
40
45
|
```
|
|
@@ -110,4 +115,7 @@ Publish package to the mops registry!
|
|
|
110
115
|
|
|
111
116
|
```
|
|
112
117
|
mops publish
|
|
113
|
-
```
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
------------
|
|
121
|
+
*Built for the [Supernova Hackathon](https://dfinity.org/supernova/)*
|
package/cli.ts
CHANGED
|
@@ -2,6 +2,7 @@ import process from 'node:process';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import events from 'node:events';
|
|
4
4
|
import {Command, Argument, Option} from 'commander';
|
|
5
|
+
import chalk from 'chalk';
|
|
5
6
|
|
|
6
7
|
import {init} from './commands/init.js';
|
|
7
8
|
import {publish} from './commands/publish.js';
|
|
@@ -98,6 +99,11 @@ program
|
|
|
98
99
|
.option('--verbose')
|
|
99
100
|
.addOption(new Option('--lock <action>', 'Lockfile action').choices(['check', 'update', 'ignore']))
|
|
100
101
|
.action(async (options) => {
|
|
102
|
+
if (process.argv.at(-1) !== 'install') {
|
|
103
|
+
console.log(`${chalk.red('Error:')} ${chalk.yellow('mops install')} command installs all dependencies.\nUse ${chalk.green(`mops add ${process.argv.at(-1)}`)} instead.`);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
|
|
101
107
|
if (!checkConfigFile()) {
|
|
102
108
|
process.exit(1);
|
|
103
109
|
}
|
|
@@ -7,15 +7,16 @@ import {PocketIc, PocketIcServer} from 'pic-ic';
|
|
|
7
7
|
import {getRootDir, readConfig} from '../mops.js';
|
|
8
8
|
import {createActor, idlFactory} from '../declarations/bench/index.js';
|
|
9
9
|
import {toolchain} from './toolchain/index.js';
|
|
10
|
+
import {getDfxVersion} from '../helpers/get-dfx-version.js';
|
|
10
11
|
|
|
11
12
|
export class BenchReplica {
|
|
12
|
-
type : 'dfx' | 'pocket-ic';
|
|
13
|
+
type : 'dfx' | 'pocket-ic' | 'dfx-pocket-ic';
|
|
13
14
|
verbose = false;
|
|
14
15
|
canisters : Record<string, {cwd : string; canisterId : string; actor : any;}> = {};
|
|
15
16
|
pocketIcServer ?: PocketIcServer;
|
|
16
17
|
pocketIc ?: PocketIc;
|
|
17
18
|
|
|
18
|
-
constructor(type : 'dfx' | 'pocket-ic', verbose = false) {
|
|
19
|
+
constructor(type : 'dfx' | 'pocket-ic' | 'dfx-pocket-ic', verbose = false) {
|
|
19
20
|
this.type = type;
|
|
20
21
|
this.verbose = verbose;
|
|
21
22
|
}
|
|
@@ -23,11 +24,11 @@ export class BenchReplica {
|
|
|
23
24
|
async start({silent = false} = {}) {
|
|
24
25
|
silent || console.log(`Starting ${this.type} replica...`);
|
|
25
26
|
|
|
26
|
-
if (this.type == 'dfx') {
|
|
27
|
+
if (this.type == 'dfx' || this.type === 'dfx-pocket-ic') {
|
|
27
28
|
await this.stop();
|
|
28
29
|
let dir = path.join(getRootDir(), '.mops/.bench');
|
|
29
30
|
fs.writeFileSync(path.join(dir, 'dfx.json'), JSON.stringify(this.dfxJson(''), null, 2));
|
|
30
|
-
execSync('dfx start --background --clean --artificial-delay 0' + (this.verbose ? '' : ' -qqqq'), {cwd: dir, stdio: ['inherit', this.verbose ? 'inherit' : 'ignore', 'inherit']});
|
|
31
|
+
execSync('dfx start --background --clean --artificial-delay 0' + (this.type === 'dfx-pocket-ic' ? ' --pocketic' : '') + (this.verbose ? '' : ' -qqqq'), {cwd: dir, stdio: ['inherit', this.verbose ? 'inherit' : 'ignore', 'inherit']});
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
34
|
let pocketIcBin = await toolchain.bin('pocket-ic');
|
|
@@ -44,7 +45,7 @@ export class BenchReplica {
|
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
async stop() {
|
|
47
|
-
if (this.type == 'dfx') {
|
|
48
|
+
if (this.type == 'dfx' || this.type === 'dfx-pocket-ic') {
|
|
48
49
|
let dir = path.join(getRootDir(), '.mops/.bench');
|
|
49
50
|
execSync('dfx stop' + (this.verbose ? '' : ' -qqqq'), {cwd: dir, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe']});
|
|
50
51
|
}
|
|
@@ -55,7 +56,7 @@ export class BenchReplica {
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
async deploy(name : string, wasm : string, cwd : string = process.cwd()) {
|
|
58
|
-
if (this.type === 'dfx') {
|
|
59
|
+
if (this.type === 'dfx' || this.type === 'dfx-pocket-ic') {
|
|
59
60
|
await execaCommand(`dfx deploy ${name} --mode reinstall --yes --identity anonymous`, {cwd, stdio: this.verbose ? 'pipe' : ['pipe', 'ignore', 'pipe']});
|
|
60
61
|
let canisterId = execSync(`dfx canister id ${name}`, {cwd}).toString().trim();
|
|
61
62
|
let actor = await createActor(canisterId, {
|
|
@@ -96,6 +97,7 @@ export class BenchReplica {
|
|
|
96
97
|
return {
|
|
97
98
|
version: 1,
|
|
98
99
|
canisters,
|
|
100
|
+
dfx: getDfxVersion(),
|
|
99
101
|
defaults: {
|
|
100
102
|
build: {
|
|
101
103
|
packtool: 'mops sources',
|
|
@@ -109,4 +111,4 @@ export class BenchReplica {
|
|
|
109
111
|
},
|
|
110
112
|
};
|
|
111
113
|
}
|
|
112
|
-
}
|
|
114
|
+
}
|
package/commands/bench.ts
CHANGED
|
@@ -21,6 +21,9 @@ import {Benchmark, Benchmarks} from '../declarations/main/main.did.js';
|
|
|
21
21
|
import {BenchResult, _SERVICE} from '../declarations/bench/bench.did.js';
|
|
22
22
|
import {BenchReplica} from './bench-replica.js';
|
|
23
23
|
import {filesize} from 'filesize';
|
|
24
|
+
import {SemVer} from 'semver';
|
|
25
|
+
|
|
26
|
+
type ReplicaName = 'dfx' | 'pocket-ic' | 'dfx-pocket-ic';
|
|
24
27
|
|
|
25
28
|
let ignore = [
|
|
26
29
|
'**/node_modules/**',
|
|
@@ -35,7 +38,7 @@ let globConfig = {
|
|
|
35
38
|
};
|
|
36
39
|
|
|
37
40
|
type BenchOptions = {
|
|
38
|
-
replica :
|
|
41
|
+
replica : ReplicaName,
|
|
39
42
|
replicaVersion : string,
|
|
40
43
|
compiler : 'moc',
|
|
41
44
|
compilerVersion : string,
|
|
@@ -66,16 +69,30 @@ export async function bench(filter = '', optionsArg : Partial<BenchOptions> = {}
|
|
|
66
69
|
|
|
67
70
|
let options : BenchOptions = {...defaultOptions, ...optionsArg};
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
let replicaType = options.replica ?? (config.toolchain?.['pocket-ic'] ? 'pocket-ic' : 'dfx' as ReplicaName);
|
|
73
|
+
if (replicaType === 'pocket-ic' && !config.toolchain?.['pocket-ic']) {
|
|
74
|
+
let dfxVersion = getDfxVersion();
|
|
75
|
+
if (!dfxVersion || new SemVer(dfxVersion).compare('0.24.1') < 0) {
|
|
76
|
+
console.log(chalk.red('Please update dfx to the version >=0.24.1 or specify pocket-ic version in mops.toml'));
|
|
77
|
+
process.exit(1);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
replicaType = 'dfx-pocket-ic';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
options.replica = replicaType;
|
|
85
|
+
|
|
86
|
+
if (replicaType == 'dfx') {
|
|
70
87
|
options.replicaVersion = getDfxVersion();
|
|
71
88
|
}
|
|
72
|
-
else if (
|
|
89
|
+
else if (replicaType == 'pocket-ic') {
|
|
73
90
|
options.replicaVersion = config.toolchain?.['pocket-ic'] || '';
|
|
74
91
|
}
|
|
75
92
|
|
|
76
93
|
options.verbose && console.log(options);
|
|
77
94
|
|
|
78
|
-
let replica = new BenchReplica(
|
|
95
|
+
let replica = new BenchReplica(replicaType, options.verbose);
|
|
79
96
|
|
|
80
97
|
let rootDir = getRootDir();
|
|
81
98
|
let globStr = '**/bench?(mark)/**/*.bench.mo';
|
package/commands/init.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {installAll} from './install/install-all.js';
|
|
|
11
11
|
import {VesselConfig, readVesselConfig} from '../vessel.js';
|
|
12
12
|
import {Config, Dependencies} from '../types.js';
|
|
13
13
|
import {template} from './template.js';
|
|
14
|
+
import {kebabCase} from 'change-case';
|
|
14
15
|
|
|
15
16
|
export async function init({yes = false} = {}) {
|
|
16
17
|
let configFile = path.join(process.cwd(), 'mops.toml');
|
|
@@ -88,7 +89,7 @@ export async function init({yes = false} = {}) {
|
|
|
88
89
|
type: 'text',
|
|
89
90
|
name: 'name',
|
|
90
91
|
message: 'Enter package name:',
|
|
91
|
-
initial:
|
|
92
|
+
initial: kebabCase(path.basename(process.cwd())),
|
|
92
93
|
},
|
|
93
94
|
{
|
|
94
95
|
type: 'text',
|
|
@@ -133,7 +134,7 @@ export async function init({yes = false} = {}) {
|
|
|
133
134
|
], promptsConfig);
|
|
134
135
|
|
|
135
136
|
config.package = {
|
|
136
|
-
name: (res.name || '').trim(),
|
|
137
|
+
name: kebabCase((res.name || '').trim()),
|
|
137
138
|
version: '1.0.0',
|
|
138
139
|
description: (res.description || '').trim(),
|
|
139
140
|
repository: (res.repository || '').trim(),
|
package/commands/template.ts
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import prompts from 'prompts';
|
|
5
|
-
import
|
|
5
|
+
import {kebabCase, pascalCase} from 'change-case';
|
|
6
6
|
import {getRootDir, readConfig} from '../mops.js';
|
|
7
7
|
import {copyTemplateFileSync} from '../templates.js';
|
|
8
8
|
|
|
@@ -99,8 +99,8 @@ export async function template(templateName ?: string, options : any = {}) {
|
|
|
99
99
|
let data = fs.readFileSync(dest).toString();
|
|
100
100
|
data = data.replace(/<year>/g, new Date().getFullYear().toString());
|
|
101
101
|
if (config.package?.name) {
|
|
102
|
-
data = data.replace(/<name>/g, config.package.name);
|
|
103
|
-
data = data.replace(/<import-name>/g,
|
|
102
|
+
data = data.replace(/<name>/g, kebabCase(config.package.name));
|
|
103
|
+
data = data.replace(/<import-name>/g, pascalCase(config.package.name));
|
|
104
104
|
}
|
|
105
105
|
fs.writeFileSync(dest, data);
|
|
106
106
|
|
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,7 @@ import process from 'node:process';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import events from 'node:events';
|
|
4
4
|
import { Command, Argument, Option } from 'commander';
|
|
5
|
+
import chalk from 'chalk';
|
|
5
6
|
import { init } from './commands/init.js';
|
|
6
7
|
import { publish } from './commands/publish.js';
|
|
7
8
|
import { sources } from './commands/sources.js';
|
|
@@ -80,6 +81,10 @@ program
|
|
|
80
81
|
.option('--verbose')
|
|
81
82
|
.addOption(new Option('--lock <action>', 'Lockfile action').choices(['check', 'update', 'ignore']))
|
|
82
83
|
.action(async (options) => {
|
|
84
|
+
if (process.argv.at(-1) !== 'install') {
|
|
85
|
+
console.log(`${chalk.red('Error:')} ${chalk.yellow('mops install')} command installs all dependencies.\nUse ${chalk.green(`mops add ${process.argv.at(-1)}`)} instead.`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
83
88
|
if (!checkConfigFile()) {
|
|
84
89
|
process.exit(1);
|
|
85
90
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PocketIc, PocketIcServer } from 'pic-ic';
|
|
2
2
|
export declare class BenchReplica {
|
|
3
|
-
type: 'dfx' | 'pocket-ic';
|
|
3
|
+
type: 'dfx' | 'pocket-ic' | 'dfx-pocket-ic';
|
|
4
4
|
verbose: boolean;
|
|
5
5
|
canisters: Record<string, {
|
|
6
6
|
cwd: string;
|
|
@@ -9,7 +9,7 @@ export declare class BenchReplica {
|
|
|
9
9
|
}>;
|
|
10
10
|
pocketIcServer?: PocketIcServer;
|
|
11
11
|
pocketIc?: PocketIc;
|
|
12
|
-
constructor(type: 'dfx' | 'pocket-ic', verbose?: boolean);
|
|
12
|
+
constructor(type: 'dfx' | 'pocket-ic' | 'dfx-pocket-ic', verbose?: boolean);
|
|
13
13
|
start({ silent }?: {
|
|
14
14
|
silent?: boolean | undefined;
|
|
15
15
|
}): Promise<void>;
|
|
@@ -20,6 +20,7 @@ export declare class BenchReplica {
|
|
|
20
20
|
dfxJson(canisterName: string): {
|
|
21
21
|
version: number;
|
|
22
22
|
canisters: Record<string, any>;
|
|
23
|
+
dfx: string;
|
|
23
24
|
defaults: {
|
|
24
25
|
build: {
|
|
25
26
|
packtool: string;
|
|
@@ -7,6 +7,7 @@ import { PocketIc, PocketIcServer } from 'pic-ic';
|
|
|
7
7
|
import { getRootDir, readConfig } from '../mops.js';
|
|
8
8
|
import { createActor, idlFactory } from '../declarations/bench/index.js';
|
|
9
9
|
import { toolchain } from './toolchain/index.js';
|
|
10
|
+
import { getDfxVersion } from '../helpers/get-dfx-version.js';
|
|
10
11
|
export class BenchReplica {
|
|
11
12
|
constructor(type, verbose = false) {
|
|
12
13
|
this.verbose = false;
|
|
@@ -16,11 +17,11 @@ export class BenchReplica {
|
|
|
16
17
|
}
|
|
17
18
|
async start({ silent = false } = {}) {
|
|
18
19
|
silent || console.log(`Starting ${this.type} replica...`);
|
|
19
|
-
if (this.type == 'dfx') {
|
|
20
|
+
if (this.type == 'dfx' || this.type === 'dfx-pocket-ic') {
|
|
20
21
|
await this.stop();
|
|
21
22
|
let dir = path.join(getRootDir(), '.mops/.bench');
|
|
22
23
|
fs.writeFileSync(path.join(dir, 'dfx.json'), JSON.stringify(this.dfxJson(''), null, 2));
|
|
23
|
-
execSync('dfx start --background --clean --artificial-delay 0' + (this.verbose ? '' : ' -qqqq'), { cwd: dir, stdio: ['inherit', this.verbose ? 'inherit' : 'ignore', 'inherit'] });
|
|
24
|
+
execSync('dfx start --background --clean --artificial-delay 0' + (this.type === 'dfx-pocket-ic' ? ' --pocketic' : '') + (this.verbose ? '' : ' -qqqq'), { cwd: dir, stdio: ['inherit', this.verbose ? 'inherit' : 'ignore', 'inherit'] });
|
|
24
25
|
}
|
|
25
26
|
else {
|
|
26
27
|
let pocketIcBin = await toolchain.bin('pocket-ic');
|
|
@@ -36,7 +37,7 @@ export class BenchReplica {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
async stop() {
|
|
39
|
-
if (this.type == 'dfx') {
|
|
40
|
+
if (this.type == 'dfx' || this.type === 'dfx-pocket-ic') {
|
|
40
41
|
let dir = path.join(getRootDir(), '.mops/.bench');
|
|
41
42
|
execSync('dfx stop' + (this.verbose ? '' : ' -qqqq'), { cwd: dir, stdio: ['pipe', this.verbose ? 'inherit' : 'ignore', 'pipe'] });
|
|
42
43
|
}
|
|
@@ -46,7 +47,7 @@ export class BenchReplica {
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
async deploy(name, wasm, cwd = process.cwd()) {
|
|
49
|
-
if (this.type === 'dfx') {
|
|
50
|
+
if (this.type === 'dfx' || this.type === 'dfx-pocket-ic') {
|
|
50
51
|
await execaCommand(`dfx deploy ${name} --mode reinstall --yes --identity anonymous`, { cwd, stdio: this.verbose ? 'pipe' : ['pipe', 'ignore', 'pipe'] });
|
|
51
52
|
let canisterId = execSync(`dfx canister id ${name}`, { cwd }).toString().trim();
|
|
52
53
|
let actor = await createActor(canisterId, {
|
|
@@ -83,6 +84,7 @@ export class BenchReplica {
|
|
|
83
84
|
return {
|
|
84
85
|
version: 1,
|
|
85
86
|
canisters,
|
|
87
|
+
dfx: getDfxVersion(),
|
|
86
88
|
defaults: {
|
|
87
89
|
build: {
|
|
88
90
|
packtool: 'mops sources',
|
package/dist/commands/bench.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Benchmarks } from '../declarations/main/main.did.js';
|
|
2
|
+
type ReplicaName = 'dfx' | 'pocket-ic' | 'dfx-pocket-ic';
|
|
2
3
|
type BenchOptions = {
|
|
3
|
-
replica:
|
|
4
|
+
replica: ReplicaName;
|
|
4
5
|
replicaVersion: string;
|
|
5
6
|
compiler: 'moc';
|
|
6
7
|
compilerVersion: string;
|
package/dist/commands/bench.js
CHANGED
|
@@ -17,6 +17,7 @@ import { getMocPath } from '../helpers/get-moc-path.js';
|
|
|
17
17
|
import { sources } from './sources.js';
|
|
18
18
|
import { BenchReplica } from './bench-replica.js';
|
|
19
19
|
import { filesize } from 'filesize';
|
|
20
|
+
import { SemVer } from 'semver';
|
|
20
21
|
let ignore = [
|
|
21
22
|
'**/node_modules/**',
|
|
22
23
|
'**/.mops/**',
|
|
@@ -42,14 +43,26 @@ export async function bench(filter = '', optionsArg = {}) {
|
|
|
42
43
|
silent: false,
|
|
43
44
|
};
|
|
44
45
|
let options = { ...defaultOptions, ...optionsArg };
|
|
45
|
-
|
|
46
|
+
let replicaType = options.replica ?? (config.toolchain?.['pocket-ic'] ? 'pocket-ic' : 'dfx');
|
|
47
|
+
if (replicaType === 'pocket-ic' && !config.toolchain?.['pocket-ic']) {
|
|
48
|
+
let dfxVersion = getDfxVersion();
|
|
49
|
+
if (!dfxVersion || new SemVer(dfxVersion).compare('0.24.1') < 0) {
|
|
50
|
+
console.log(chalk.red('Please update dfx to the version >=0.24.1 or specify pocket-ic version in mops.toml'));
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
replicaType = 'dfx-pocket-ic';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
options.replica = replicaType;
|
|
58
|
+
if (replicaType == 'dfx') {
|
|
46
59
|
options.replicaVersion = getDfxVersion();
|
|
47
60
|
}
|
|
48
|
-
else if (
|
|
61
|
+
else if (replicaType == 'pocket-ic') {
|
|
49
62
|
options.replicaVersion = config.toolchain?.['pocket-ic'] || '';
|
|
50
63
|
}
|
|
51
64
|
options.verbose && console.log(options);
|
|
52
|
-
let replica = new BenchReplica(
|
|
65
|
+
let replica = new BenchReplica(replicaType, options.verbose);
|
|
53
66
|
let rootDir = getRootDir();
|
|
54
67
|
let globStr = '**/bench?(mark)/**/*.bench.mo';
|
|
55
68
|
if (filter) {
|
package/dist/commands/init.js
CHANGED
|
@@ -9,6 +9,7 @@ import { mainActor } from '../api/actors.js';
|
|
|
9
9
|
import { installAll } from './install/install-all.js';
|
|
10
10
|
import { readVesselConfig } from '../vessel.js';
|
|
11
11
|
import { template } from './template.js';
|
|
12
|
+
import { kebabCase } from 'change-case';
|
|
12
13
|
export async function init({ yes = false } = {}) {
|
|
13
14
|
let configFile = path.join(process.cwd(), 'mops.toml');
|
|
14
15
|
let exists = existsSync(configFile);
|
|
@@ -73,7 +74,7 @@ export async function init({ yes = false } = {}) {
|
|
|
73
74
|
type: 'text',
|
|
74
75
|
name: 'name',
|
|
75
76
|
message: 'Enter package name:',
|
|
76
|
-
initial:
|
|
77
|
+
initial: kebabCase(path.basename(process.cwd())),
|
|
77
78
|
},
|
|
78
79
|
{
|
|
79
80
|
type: 'text',
|
|
@@ -117,7 +118,7 @@ export async function init({ yes = false } = {}) {
|
|
|
117
118
|
},
|
|
118
119
|
], promptsConfig);
|
|
119
120
|
config.package = {
|
|
120
|
-
name: (res.name || '').trim(),
|
|
121
|
+
name: kebabCase((res.name || '').trim()),
|
|
121
122
|
version: '1.0.0',
|
|
122
123
|
description: (res.description || '').trim(),
|
|
123
124
|
repository: (res.repository || '').trim(),
|
|
@@ -2,7 +2,7 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import prompts from 'prompts';
|
|
5
|
-
import
|
|
5
|
+
import { kebabCase, pascalCase } from 'change-case';
|
|
6
6
|
import { getRootDir, readConfig } from '../mops.js';
|
|
7
7
|
import { copyTemplateFileSync } from '../templates.js';
|
|
8
8
|
export async function template(templateName, options = {}) {
|
|
@@ -93,8 +93,8 @@ export async function template(templateName, options = {}) {
|
|
|
93
93
|
let data = fs.readFileSync(dest).toString();
|
|
94
94
|
data = data.replace(/<year>/g, new Date().getFullYear().toString());
|
|
95
95
|
if (config.package?.name) {
|
|
96
|
-
data = data.replace(/<name>/g, config.package.name);
|
|
97
|
-
data = data.replace(/<import-name>/g,
|
|
96
|
+
data = data.replace(/<name>/g, kebabCase(config.package.name));
|
|
97
|
+
data = data.replace(/<import-name>/g, pascalCase(config.package.name));
|
|
98
98
|
}
|
|
99
99
|
fs.writeFileSync(dest, data);
|
|
100
100
|
console.log(chalk.green('Created'), path.relative(getRootDir(), 'README.md'));
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "bin/mops.js",
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"node": ">=18.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@dfinity/agent": "2.
|
|
32
|
-
"@dfinity/candid": "2.
|
|
33
|
-
"@dfinity/identity": "2.
|
|
34
|
-
"@dfinity/identity-secp256k1": "2.
|
|
35
|
-
"@dfinity/principal": "2.
|
|
31
|
+
"@dfinity/agent": "2.3.0",
|
|
32
|
+
"@dfinity/candid": "2.3.0",
|
|
33
|
+
"@dfinity/identity": "2.3.0",
|
|
34
|
+
"@dfinity/identity-secp256k1": "2.3.0",
|
|
35
|
+
"@dfinity/principal": "2.3.0",
|
|
36
36
|
"@iarna/toml": "2.2.5",
|
|
37
|
-
"@noble/hashes": "1.
|
|
37
|
+
"@noble/hashes": "1.7.1",
|
|
38
38
|
"as-table": "1.0.55",
|
|
39
39
|
"buffer": "6.0.3",
|
|
40
40
|
"cacheable-request": "12.0.1",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
41
|
+
"chalk": "5.4.1",
|
|
42
|
+
"change-case": "5.4.4",
|
|
43
43
|
"chokidar": "3.6.0",
|
|
44
44
|
"commander": "12.1.0",
|
|
45
45
|
"debounce": "2.1.1",
|
|
@@ -51,22 +51,22 @@
|
|
|
51
51
|
"filesize": "10.1.6",
|
|
52
52
|
"fs-extra": "11.2.0",
|
|
53
53
|
"get-folder-size": "5.0.0",
|
|
54
|
-
"glob": "11.0.
|
|
54
|
+
"glob": "11.0.1",
|
|
55
55
|
"globby": "14.0.2",
|
|
56
|
-
"got": "14.4.
|
|
56
|
+
"got": "14.4.6",
|
|
57
57
|
"log-update": "6.1.0",
|
|
58
|
-
"markdown-table": "3.0.
|
|
59
|
-
"mdast-util-from-markdown": "2.0.
|
|
60
|
-
"mdast-util-to-markdown": "2.1.
|
|
58
|
+
"markdown-table": "3.0.4",
|
|
59
|
+
"mdast-util-from-markdown": "2.0.2",
|
|
60
|
+
"mdast-util-to-markdown": "2.1.2",
|
|
61
61
|
"minimatch": "10.0.1",
|
|
62
62
|
"ncp": "2.0.0",
|
|
63
63
|
"node-fetch": "3.3.2",
|
|
64
64
|
"octokit": "3.1.2",
|
|
65
65
|
"pem-file": "1.0.1",
|
|
66
|
-
"pic-ic": "0.
|
|
66
|
+
"pic-ic": "0.5.3",
|
|
67
67
|
"promisify-child-process": "4.1.2",
|
|
68
68
|
"prompts": "2.4.2",
|
|
69
|
-
"semver": "7.
|
|
69
|
+
"semver": "7.7.1",
|
|
70
70
|
"stream-to-promise": "3.0.0",
|
|
71
71
|
"string-width": "7.2.0",
|
|
72
72
|
"tar": "7.4.3"
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@types/fs-extra": "11.0.4",
|
|
79
79
|
"@types/glob": "8.1.0",
|
|
80
80
|
"@types/ncp": "2.0.8",
|
|
81
|
-
"@types/node": "22.
|
|
81
|
+
"@types/node": "22.13.4",
|
|
82
82
|
"@types/prompts": "2.4.9",
|
|
83
83
|
"@types/semver": "7.5.8",
|
|
84
84
|
"@types/stream-to-promise": "2.2.4",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"bun": "1.1.27",
|
|
87
87
|
"esbuild": "0.23.1",
|
|
88
88
|
"eslint": "8.57.0",
|
|
89
|
-
"tsx": "4.19.
|
|
90
|
-
"typescript": "5.
|
|
89
|
+
"tsx": "4.19.2",
|
|
90
|
+
"typescript": "5.7.3"
|
|
91
91
|
}
|
|
92
92
|
}
|
package/dist/pem.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { Buffer } from 'node:buffer';
|
|
|
2
2
|
import { Ed25519KeyIdentity } from '@dfinity/identity';
|
|
3
3
|
import { Secp256k1KeyIdentity } from '@dfinity/identity-secp256k1';
|
|
4
4
|
export declare function decodeFile(file: string, password?: string): Secp256k1KeyIdentity | Ed25519KeyIdentity;
|
|
5
|
-
export declare function encrypt(buffer: Buffer, password: string): Buffer
|
|
5
|
+
export declare function encrypt(buffer: Buffer, password: string): Buffer<ArrayBuffer>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "dist/bin/mops.js",
|
|
@@ -44,18 +44,18 @@
|
|
|
44
44
|
"esbuild": "esbuild"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@dfinity/agent": "2.
|
|
48
|
-
"@dfinity/candid": "2.
|
|
49
|
-
"@dfinity/identity": "2.
|
|
50
|
-
"@dfinity/identity-secp256k1": "2.
|
|
51
|
-
"@dfinity/principal": "2.
|
|
47
|
+
"@dfinity/agent": "2.3.0",
|
|
48
|
+
"@dfinity/candid": "2.3.0",
|
|
49
|
+
"@dfinity/identity": "2.3.0",
|
|
50
|
+
"@dfinity/identity-secp256k1": "2.3.0",
|
|
51
|
+
"@dfinity/principal": "2.3.0",
|
|
52
52
|
"@iarna/toml": "2.2.5",
|
|
53
|
-
"@noble/hashes": "1.
|
|
53
|
+
"@noble/hashes": "1.7.1",
|
|
54
54
|
"as-table": "1.0.55",
|
|
55
55
|
"buffer": "6.0.3",
|
|
56
56
|
"cacheable-request": "12.0.1",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
57
|
+
"chalk": "5.4.1",
|
|
58
|
+
"change-case": "5.4.4",
|
|
59
59
|
"chokidar": "3.6.0",
|
|
60
60
|
"commander": "12.1.0",
|
|
61
61
|
"debounce": "2.1.1",
|
|
@@ -67,22 +67,22 @@
|
|
|
67
67
|
"filesize": "10.1.6",
|
|
68
68
|
"fs-extra": "11.2.0",
|
|
69
69
|
"get-folder-size": "5.0.0",
|
|
70
|
-
"glob": "11.0.
|
|
70
|
+
"glob": "11.0.1",
|
|
71
71
|
"globby": "14.0.2",
|
|
72
|
-
"got": "14.4.
|
|
72
|
+
"got": "14.4.6",
|
|
73
73
|
"log-update": "6.1.0",
|
|
74
|
-
"markdown-table": "3.0.
|
|
75
|
-
"mdast-util-from-markdown": "2.0.
|
|
76
|
-
"mdast-util-to-markdown": "2.1.
|
|
74
|
+
"markdown-table": "3.0.4",
|
|
75
|
+
"mdast-util-from-markdown": "2.0.2",
|
|
76
|
+
"mdast-util-to-markdown": "2.1.2",
|
|
77
77
|
"minimatch": "10.0.1",
|
|
78
78
|
"ncp": "2.0.0",
|
|
79
79
|
"node-fetch": "3.3.2",
|
|
80
80
|
"octokit": "3.1.2",
|
|
81
81
|
"pem-file": "1.0.1",
|
|
82
|
-
"pic-ic": "0.
|
|
82
|
+
"pic-ic": "0.5.3",
|
|
83
83
|
"promisify-child-process": "4.1.2",
|
|
84
84
|
"prompts": "2.4.2",
|
|
85
|
-
"semver": "7.
|
|
85
|
+
"semver": "7.7.1",
|
|
86
86
|
"stream-to-promise": "3.0.0",
|
|
87
87
|
"string-width": "7.2.0",
|
|
88
88
|
"tar": "7.4.3"
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@types/fs-extra": "11.0.4",
|
|
95
95
|
"@types/glob": "8.1.0",
|
|
96
96
|
"@types/ncp": "2.0.8",
|
|
97
|
-
"@types/node": "22.
|
|
97
|
+
"@types/node": "22.13.4",
|
|
98
98
|
"@types/prompts": "2.4.9",
|
|
99
99
|
"@types/semver": "7.5.8",
|
|
100
100
|
"@types/stream-to-promise": "2.2.4",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"bun": "1.1.27",
|
|
103
103
|
"esbuild": "0.23.1",
|
|
104
104
|
"eslint": "8.57.0",
|
|
105
|
-
"tsx": "4.19.
|
|
106
|
-
"typescript": "5.
|
|
105
|
+
"tsx": "4.19.2",
|
|
106
|
+
"typescript": "5.7.3"
|
|
107
107
|
}
|
|
108
108
|
}
|