ic-mops 0.40.0 → 0.41.1
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/.DS_Store +0 -0
- package/.npmrc +2 -1
- package/CHANGELOG.md +8 -0
- package/DEVELOPMENT.md +25 -0
- package/bundle/bench/bench-canister.mo +87 -0
- package/bundle/bench/user-bench.mo +14 -0
- package/bundle/bin/moc-wrapper.sh +3 -0
- package/bundle/bin/mops.js +3 -0
- package/bundle/cli.js +88 -0
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +26 -0
- package/bundle/declarations/bench/bench.did.d.ts +29 -0
- package/bundle/declarations/bench/bench.did.js +26 -0
- package/bundle/declarations/bench/index.d.ts +50 -0
- package/bundle/declarations/bench/index.js +40 -0
- package/bundle/declarations/main/index.d.ts +50 -0
- package/bundle/declarations/main/index.js +40 -0
- package/bundle/declarations/main/main.did +433 -0
- package/bundle/declarations/main/main.did.d.ts +355 -0
- package/bundle/declarations/main/main.did.js +407 -0
- package/bundle/declarations/storage/index.d.ts +50 -0
- package/bundle/declarations/storage/index.js +30 -0
- package/bundle/declarations/storage/storage.did +46 -0
- package/bundle/declarations/storage/storage.did.d.ts +37 -0
- package/bundle/declarations/storage/storage.did.js +38 -0
- package/bundle/package.json +31 -0
- package/bundle/templates/README.md +13 -0
- package/bundle/templates/licenses/Apache-2.0 +202 -0
- package/bundle/templates/licenses/Apache-2.0-NOTICE +13 -0
- package/bundle/templates/licenses/MIT +21 -0
- package/bundle/templates/mops-publish.yml +17 -0
- package/bundle/templates/mops-test.yml +22 -0
- package/bundle/templates/src/lib.mo +15 -0
- package/bundle/templates/test/lib.test.mo +4 -0
- package/bundle-package-json.ts +17 -0
- package/check-requirements.ts +50 -0
- package/cli.ts +22 -19
- package/commands/add.ts +4 -0
- package/commands/install-all.ts +2 -0
- package/commands/publish.ts +18 -30
- package/commands/self.ts +75 -0
- package/commands/template.ts +9 -10
- package/commands/toolchain/index.ts +7 -0
- package/declarations/bench/bench.did.d.ts +1 -1
- package/declarations/bench/index.js +1 -2
- package/declarations/main/index.js +1 -2
- package/declarations/main/main.did +15 -8
- package/declarations/main/main.did.d.ts +12 -9
- package/declarations/main/main.did.js +11 -8
- package/dist/api/actors.d.ts +0 -0
- package/dist/api/actors.js +0 -0
- package/dist/api/downloadPackageFiles.d.ts +0 -0
- package/dist/api/downloadPackageFiles.js +0 -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/mops.d.ts +1 -1
- package/dist/bin/mops.js +2 -1
- package/dist/bundle-package-json.d.ts +0 -0
- package/dist/bundle-package-json.js +2 -0
- package/dist/cache.d.ts +0 -0
- package/dist/cache.js +0 -0
- package/dist/check-requirements.d.ts +3 -0
- package/dist/check-requirements.js +44 -0
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +18 -18
- package/dist/commands/add.d.ts +0 -0
- package/dist/commands/add.js +2 -0
- package/dist/commands/available-updates.d.ts +0 -0
- package/dist/commands/available-updates.js +0 -0
- package/dist/commands/bench-replica.d.ts +0 -0
- package/dist/commands/bench-replica.js +0 -0
- package/dist/commands/bench.d.ts +0 -0
- package/dist/commands/bench.js +0 -0
- 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 +0 -0
- package/dist/commands/install-all.d.ts +0 -0
- package/dist/commands/install-all.js +2 -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 +0 -0
- package/dist/commands/publish.js +14 -25
- 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.js +1 -1
- 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 +9 -10
- package/dist/commands/test/mmf1.d.ts +0 -0
- package/dist/commands/test/mmf1.js +0 -0
- 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 +0 -0
- 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 +5 -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 +0 -0
- package/dist/commands/toolchain/pocket-ic.js +0 -0
- package/dist/commands/toolchain/toolchain-utils.d.ts +0 -0
- package/dist/commands/toolchain/toolchain-utils.js +0 -0
- 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 +0 -0
- 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 +1 -1
- package/dist/declarations/bench/bench.did.js +0 -0
- package/dist/declarations/bench/index.d.ts +0 -0
- package/dist/declarations/bench/index.js +1 -2
- package/dist/declarations/main/index.d.ts +0 -0
- package/dist/declarations/main/index.js +1 -2
- package/dist/declarations/main/main.did +15 -8
- package/dist/declarations/main/main.did.d.ts +12 -9
- package/dist/declarations/main/main.did.js +11 -8
- package/dist/helpers/find-changelog-entry.d.ts +0 -0
- package/dist/helpers/find-changelog-entry.js +0 -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 +1 -0
- package/dist/mops.js +12 -1
- package/dist/notify-installs.d.ts +0 -0
- package/dist/notify-installs.js +0 -0
- package/dist/package.json +18 -24
- 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 +0 -0
- package/dist/release-cli.js +13 -7
- package/dist/resolve-packages.d.ts +0 -0
- package/dist/resolve-packages.js +0 -0
- package/dist/templates.d.ts +1 -0
- package/dist/templates.js +4 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js +0 -0
- package/dist/vessel.d.ts +0 -0
- package/dist/vessel.js +0 -0
- package/helpers/find-changelog-entry.ts +27 -0
- package/mops.ts +15 -1
- package/package.json +26 -17
- package/release-cli.ts +67 -0
- package/remove-scripts.ts +6 -0
- package/templates.ts +5 -0
- package/tsconfig.json +1 -1
- package/types.ts +7 -2
- package/commands/self-update.ts +0 -6
- package/dist/commands/self-update.d.ts +0 -3
- package/dist/commands/self-update.js +0 -5
- /package/bin/{mops.ts → mops.js} +0 -0
package/commands/template.ts
CHANGED
|
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
import prompts from 'prompts';
|
|
5
5
|
import camelCase from 'camelcase';
|
|
6
6
|
import {getRootDir, readConfig} from '../mops.js';
|
|
7
|
+
import {copyTemplateFileSync} from '../templates.js';
|
|
7
8
|
|
|
8
9
|
export async function template(templateName ?: string, options : any = {}) {
|
|
9
10
|
if (!templateName) {
|
|
@@ -32,9 +33,8 @@ export async function template(templateName ?: string, options : any = {}) {
|
|
|
32
33
|
console.log(chalk.yellow('Workflow already exists:'), path.relative(getRootDir(), dest));
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
|
-
let mopsTestYml = new URL('../templates/mops-test.yml', import.meta.url);
|
|
36
36
|
fs.mkdirSync(path.resolve(getRootDir(), '.github/workflows'), {recursive: true});
|
|
37
|
-
|
|
37
|
+
copyTemplateFileSync('mops-test.yml', dest);
|
|
38
38
|
console.log(chalk.green('Created'), path.relative(getRootDir(), dest));
|
|
39
39
|
}
|
|
40
40
|
else if (templateName === 'github-workflow:mops-publish') {
|
|
@@ -43,9 +43,8 @@ export async function template(templateName ?: string, options : any = {}) {
|
|
|
43
43
|
console.log(chalk.yellow('Workflow already exists:'), path.relative(getRootDir(), dest));
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
let mopsPublishYml = new URL('../templates/mops-publish.yml', import.meta.url);
|
|
47
46
|
fs.mkdirSync(path.resolve(getRootDir(), '.github/workflows'), {recursive: true});
|
|
48
|
-
|
|
47
|
+
copyTemplateFileSync('mops-publish.yml', dest);
|
|
49
48
|
console.log(chalk.green('Created'), path.relative(getRootDir(), dest));
|
|
50
49
|
}
|
|
51
50
|
else if (templateName?.startsWith('license:')) {
|
|
@@ -65,13 +64,13 @@ export async function template(templateName ?: string, options : any = {}) {
|
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
if (templateName === 'license:MIT') {
|
|
68
|
-
|
|
67
|
+
copyTemplateFileSync('licenses/MIT', path.resolve(getRootDir(), 'LICENSE'));
|
|
69
68
|
setYearAndOwner(path.resolve(getRootDir(), 'LICENSE'));
|
|
70
69
|
console.log(chalk.green('Created'), path.relative(getRootDir(), 'LICENSE'));
|
|
71
70
|
}
|
|
72
71
|
else if (templateName === 'license:Apache-2.0') {
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
copyTemplateFileSync('licenses/Apache-2.0', path.resolve(getRootDir(), 'LICENSE'));
|
|
73
|
+
copyTemplateFileSync('licenses/Apache-2.0-NOTICE', path.resolve(getRootDir(), 'NOTICE'));
|
|
75
74
|
setYearAndOwner(path.resolve(getRootDir(), 'NOTICE'));
|
|
76
75
|
console.log(chalk.green('Created'), path.relative(getRootDir(), 'LICENSE'));
|
|
77
76
|
console.log(chalk.green('Created'), path.relative(getRootDir(), 'NOTICE'));
|
|
@@ -79,12 +78,12 @@ export async function template(templateName ?: string, options : any = {}) {
|
|
|
79
78
|
}
|
|
80
79
|
else if (templateName === 'lib.mo') {
|
|
81
80
|
fs.mkdirSync(path.join(getRootDir(), 'src'), {recursive: true});
|
|
82
|
-
|
|
81
|
+
copyTemplateFileSync('src/lib.mo', path.resolve(getRootDir(), 'src/lib.mo'));
|
|
83
82
|
console.log(chalk.green('Created'), path.relative(getRootDir(), 'src/lib.mo'));
|
|
84
83
|
}
|
|
85
84
|
else if (templateName === 'lib.test.mo') {
|
|
86
85
|
fs.mkdirSync(path.join(getRootDir(), 'test'), {recursive: true});
|
|
87
|
-
|
|
86
|
+
copyTemplateFileSync('test/lib.test.mo', path.resolve(getRootDir(), 'test/lib.test.mo'));
|
|
88
87
|
console.log(chalk.green('Created'), path.relative(getRootDir(), 'test/lib.test.mo'));
|
|
89
88
|
}
|
|
90
89
|
else if (templateName === 'readme') {
|
|
@@ -93,7 +92,7 @@ export async function template(templateName ?: string, options : any = {}) {
|
|
|
93
92
|
console.log(chalk.yellow('README.md already exists'));
|
|
94
93
|
return;
|
|
95
94
|
}
|
|
96
|
-
|
|
95
|
+
copyTemplateFileSync('README.md', dest);
|
|
97
96
|
|
|
98
97
|
let config = readConfig();
|
|
99
98
|
|
|
@@ -7,6 +7,7 @@ import prompts from 'prompts';
|
|
|
7
7
|
import {createLogUpdate} from 'log-update';
|
|
8
8
|
import {checkConfigFile, getClosestConfigFile, getRootDir, globalCacheDir, readConfig, writeConfig} from '../../mops.js';
|
|
9
9
|
import {Tool} from '../../types.js';
|
|
10
|
+
import {checkRequirements} from '../../check-requirements.js';
|
|
10
11
|
import * as moc from './moc.js';
|
|
11
12
|
import * as pocketIc from './pocket-ic.js';
|
|
12
13
|
import * as wasmtime from './wasmtime.js';
|
|
@@ -243,6 +244,8 @@ async function use(tool : Tool, version ?: string) {
|
|
|
243
244
|
config.toolchain[tool] = version;
|
|
244
245
|
writeConfig(config);
|
|
245
246
|
|
|
247
|
+
await checkRequirements();
|
|
248
|
+
|
|
246
249
|
if (oldVersion === version) {
|
|
247
250
|
console.log((`${tool} ${version} is already installed`));
|
|
248
251
|
}
|
|
@@ -277,6 +280,10 @@ async function update(tool ?: Tool) {
|
|
|
277
280
|
config.toolchain[tool] = version;
|
|
278
281
|
writeConfig(config);
|
|
279
282
|
|
|
283
|
+
if (tool === 'moc') {
|
|
284
|
+
await checkRequirements();
|
|
285
|
+
}
|
|
286
|
+
|
|
280
287
|
if (oldVersion === version) {
|
|
281
288
|
console.log((`Latest ${tool} ${version} is already installed`));
|
|
282
289
|
}
|
|
@@ -26,4 +26,4 @@ export interface anon_class_10_1 {
|
|
|
26
26
|
}
|
|
27
27
|
export interface _SERVICE extends anon_class_10_1 {}
|
|
28
28
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
29
|
-
export declare const init: (
|
|
29
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -10,8 +10,7 @@ export { idlFactory } from "./bench.did.js";
|
|
|
10
10
|
* beginning in dfx 0.15.0
|
|
11
11
|
*/
|
|
12
12
|
export const canisterId =
|
|
13
|
-
process.env.CANISTER_ID_BENCH
|
|
14
|
-
process.env.BENCH_CANISTER_ID;
|
|
13
|
+
process.env.CANISTER_ID_BENCH;
|
|
15
14
|
|
|
16
15
|
export const createActor = (canisterId, options = {}) => {
|
|
17
16
|
const agent = options.agent || new HttpAgent({ ...options.agentOptions });
|
|
@@ -10,8 +10,7 @@ export { idlFactory } from "./main.did.js";
|
|
|
10
10
|
* beginning in dfx 0.15.0
|
|
11
11
|
*/
|
|
12
12
|
export const canisterId =
|
|
13
|
-
process.env.CANISTER_ID_MAIN
|
|
14
|
-
process.env.MAIN_CANISTER_ID;
|
|
13
|
+
process.env.CANISTER_ID_MAIN;
|
|
15
14
|
|
|
16
15
|
export const createActor = (canisterId, options = {}) => {
|
|
17
16
|
const agent = options.agent || new HttpAgent({ ...options.agentOptions });
|
|
@@ -132,6 +132,11 @@ type Response =
|
|
|
132
132
|
streaming_strategy: opt StreamingStrategy;
|
|
133
133
|
upgrade: opt bool;
|
|
134
134
|
};
|
|
135
|
+
type Requirement =
|
|
136
|
+
record {
|
|
137
|
+
name: text;
|
|
138
|
+
value: text;
|
|
139
|
+
};
|
|
135
140
|
type Request =
|
|
136
141
|
record {
|
|
137
142
|
body: blob;
|
|
@@ -145,7 +150,7 @@ type PageCount = nat;
|
|
|
145
150
|
type PackageVersion = text;
|
|
146
151
|
type PackageSummary__1 =
|
|
147
152
|
record {
|
|
148
|
-
config:
|
|
153
|
+
config: PackageConfigV3;
|
|
149
154
|
downloadsInLast30Days: nat;
|
|
150
155
|
downloadsInLast7Days: nat;
|
|
151
156
|
downloadsTotal: nat;
|
|
@@ -157,7 +162,7 @@ type PackageSummary__1 =
|
|
|
157
162
|
type PackageSummaryWithChanges__1 =
|
|
158
163
|
record {
|
|
159
164
|
changes: PackageChanges;
|
|
160
|
-
config:
|
|
165
|
+
config: PackageConfigV3;
|
|
161
166
|
downloadsInLast30Days: nat;
|
|
162
167
|
downloadsInLast7Days: nat;
|
|
163
168
|
downloadsTotal: nat;
|
|
@@ -169,7 +174,7 @@ type PackageSummaryWithChanges__1 =
|
|
|
169
174
|
type PackageSummaryWithChanges =
|
|
170
175
|
record {
|
|
171
176
|
changes: PackageChanges;
|
|
172
|
-
config:
|
|
177
|
+
config: PackageConfigV3;
|
|
173
178
|
downloadsInLast30Days: nat;
|
|
174
179
|
downloadsInLast7Days: nat;
|
|
175
180
|
downloadsTotal: nat;
|
|
@@ -180,7 +185,7 @@ type PackageSummaryWithChanges =
|
|
|
180
185
|
};
|
|
181
186
|
type PackageSummary =
|
|
182
187
|
record {
|
|
183
|
-
config:
|
|
188
|
+
config: PackageConfigV3;
|
|
184
189
|
downloadsInLast30Days: nat;
|
|
185
190
|
downloadsInLast7Days: nat;
|
|
186
191
|
downloadsTotal: nat;
|
|
@@ -218,7 +223,7 @@ type PackageDetails =
|
|
|
218
223
|
record {
|
|
219
224
|
benchmarks: Benchmarks__1;
|
|
220
225
|
changes: PackageChanges;
|
|
221
|
-
config:
|
|
226
|
+
config: PackageConfigV3;
|
|
222
227
|
dependents: vec PackageSummary__1;
|
|
223
228
|
deps: vec PackageSummary__1;
|
|
224
229
|
devDeps: vec PackageSummary__1;
|
|
@@ -234,7 +239,7 @@ type PackageDetails =
|
|
|
234
239
|
testStats: TestStats__1;
|
|
235
240
|
versionHistory: vec PackageSummaryWithChanges__1;
|
|
236
241
|
};
|
|
237
|
-
type
|
|
242
|
+
type PackageConfigV3_Publishing =
|
|
238
243
|
record {
|
|
239
244
|
baseDir: text;
|
|
240
245
|
dependencies: vec DependencyV2;
|
|
@@ -250,10 +255,11 @@ type PackageConfigV2__1 =
|
|
|
250
255
|
name: PackageName__1;
|
|
251
256
|
readme: text;
|
|
252
257
|
repository: text;
|
|
258
|
+
requirements: opt vec Requirement;
|
|
253
259
|
scripts: vec Script;
|
|
254
260
|
version: text;
|
|
255
261
|
};
|
|
256
|
-
type
|
|
262
|
+
type PackageConfigV3 =
|
|
257
263
|
record {
|
|
258
264
|
baseDir: text;
|
|
259
265
|
dependencies: vec DependencyV2;
|
|
@@ -269,6 +275,7 @@ type PackageConfigV2 =
|
|
|
269
275
|
name: PackageName__1;
|
|
270
276
|
readme: text;
|
|
271
277
|
repository: text;
|
|
278
|
+
requirements: vec Requirement;
|
|
272
279
|
scripts: vec Script;
|
|
273
280
|
version: text;
|
|
274
281
|
};
|
|
@@ -341,7 +348,7 @@ type Main =
|
|
|
341
348
|
search: (Text, opt nat, opt nat) -> (vec PackageSummary, PageCount) query;
|
|
342
349
|
setUserProp: (text, text) -> (Result_1);
|
|
343
350
|
startFileUpload: (PublishingId, Text, nat, blob) -> (Result_3);
|
|
344
|
-
startPublish: (
|
|
351
|
+
startPublish: (PackageConfigV3_Publishing) -> (Result_2);
|
|
345
352
|
transferOwnership: (PackageName, principal) -> (Result_1);
|
|
346
353
|
transformRequest: (HttpTransformArg) -> (HttpResponse) query;
|
|
347
354
|
uploadBenchmarks: (PublishingId, Benchmarks) -> (Result);
|
|
@@ -117,7 +117,7 @@ export interface Main {
|
|
|
117
117
|
[PublishingId, Text, bigint, Uint8Array | number[]],
|
|
118
118
|
Result_3
|
|
119
119
|
>,
|
|
120
|
-
'startPublish' : ActorMethod<[
|
|
120
|
+
'startPublish' : ActorMethod<[PackageConfigV3_Publishing], Result_2>,
|
|
121
121
|
'transferOwnership' : ActorMethod<[PackageName, Principal], Result_1>,
|
|
122
122
|
'transformRequest' : ActorMethod<[HttpTransformArg], HttpResponse>,
|
|
123
123
|
'uploadBenchmarks' : ActorMethod<[PublishingId, Benchmarks], Result>,
|
|
@@ -136,7 +136,7 @@ export interface PackageChanges {
|
|
|
136
136
|
'notes' : string,
|
|
137
137
|
'devDeps' : Array<DepChange>,
|
|
138
138
|
}
|
|
139
|
-
export interface
|
|
139
|
+
export interface PackageConfigV3 {
|
|
140
140
|
'dfx' : string,
|
|
141
141
|
'moc' : string,
|
|
142
142
|
'scripts' : Array<Script>,
|
|
@@ -151,10 +151,11 @@ export interface PackageConfigV2 {
|
|
|
151
151
|
'devDependencies' : Array<DependencyV2>,
|
|
152
152
|
'repository' : string,
|
|
153
153
|
'dependencies' : Array<DependencyV2>,
|
|
154
|
+
'requirements' : Array<Requirement>,
|
|
154
155
|
'license' : string,
|
|
155
156
|
'readme' : string,
|
|
156
157
|
}
|
|
157
|
-
export interface
|
|
158
|
+
export interface PackageConfigV3_Publishing {
|
|
158
159
|
'dfx' : string,
|
|
159
160
|
'moc' : string,
|
|
160
161
|
'scripts' : Array<Script>,
|
|
@@ -169,6 +170,7 @@ export interface PackageConfigV2__1 {
|
|
|
169
170
|
'devDependencies' : Array<DependencyV2>,
|
|
170
171
|
'repository' : string,
|
|
171
172
|
'dependencies' : Array<DependencyV2>,
|
|
173
|
+
'requirements' : [] | [Array<Requirement>],
|
|
172
174
|
'license' : string,
|
|
173
175
|
'readme' : string,
|
|
174
176
|
}
|
|
@@ -187,7 +189,7 @@ export interface PackageDetails {
|
|
|
187
189
|
'dependents' : Array<PackageSummary__1>,
|
|
188
190
|
'devDeps' : Array<PackageSummary__1>,
|
|
189
191
|
'downloadsInLast7Days' : bigint,
|
|
190
|
-
'config' :
|
|
192
|
+
'config' : PackageConfigV3,
|
|
191
193
|
'changes' : PackageChanges,
|
|
192
194
|
'publication' : PackagePublication,
|
|
193
195
|
}
|
|
@@ -220,7 +222,7 @@ export interface PackageSummary {
|
|
|
220
222
|
'downloadsTotal' : bigint,
|
|
221
223
|
'downloadsInLast30Days' : bigint,
|
|
222
224
|
'downloadsInLast7Days' : bigint,
|
|
223
|
-
'config' :
|
|
225
|
+
'config' : PackageConfigV3,
|
|
224
226
|
'publication' : PackagePublication,
|
|
225
227
|
}
|
|
226
228
|
export interface PackageSummaryWithChanges {
|
|
@@ -230,7 +232,7 @@ export interface PackageSummaryWithChanges {
|
|
|
230
232
|
'downloadsTotal' : bigint,
|
|
231
233
|
'downloadsInLast30Days' : bigint,
|
|
232
234
|
'downloadsInLast7Days' : bigint,
|
|
233
|
-
'config' :
|
|
235
|
+
'config' : PackageConfigV3,
|
|
234
236
|
'changes' : PackageChanges,
|
|
235
237
|
'publication' : PackagePublication,
|
|
236
238
|
}
|
|
@@ -241,7 +243,7 @@ export interface PackageSummaryWithChanges__1 {
|
|
|
241
243
|
'downloadsTotal' : bigint,
|
|
242
244
|
'downloadsInLast30Days' : bigint,
|
|
243
245
|
'downloadsInLast7Days' : bigint,
|
|
244
|
-
'config' :
|
|
246
|
+
'config' : PackageConfigV3,
|
|
245
247
|
'changes' : PackageChanges,
|
|
246
248
|
'publication' : PackagePublication,
|
|
247
249
|
}
|
|
@@ -252,7 +254,7 @@ export interface PackageSummary__1 {
|
|
|
252
254
|
'downloadsTotal' : bigint,
|
|
253
255
|
'downloadsInLast30Days' : bigint,
|
|
254
256
|
'downloadsInLast7Days' : bigint,
|
|
255
|
-
'config' :
|
|
257
|
+
'config' : PackageConfigV3,
|
|
256
258
|
'publication' : PackagePublication,
|
|
257
259
|
}
|
|
258
260
|
export type PackageVersion = string;
|
|
@@ -265,6 +267,7 @@ export interface Request {
|
|
|
265
267
|
'headers' : Array<Header>,
|
|
266
268
|
'certificate_version' : [] | [number],
|
|
267
269
|
}
|
|
270
|
+
export interface Requirement { 'value' : string, 'name' : string }
|
|
268
271
|
export interface Response {
|
|
269
272
|
'body' : Uint8Array | number[],
|
|
270
273
|
'headers' : Array<Header>,
|
|
@@ -349,4 +352,4 @@ export interface User__1 {
|
|
|
349
352
|
}
|
|
350
353
|
export interface _SERVICE extends Main {}
|
|
351
354
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
352
|
-
export declare const init: (
|
|
355
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -62,7 +62,8 @@ export const idlFactory = ({ IDL }) => {
|
|
|
62
62
|
'repo' : IDL.Text,
|
|
63
63
|
'version' : IDL.Text,
|
|
64
64
|
});
|
|
65
|
-
const
|
|
65
|
+
const Requirement = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
|
|
66
|
+
const PackageConfigV3 = IDL.Record({
|
|
66
67
|
'dfx' : IDL.Text,
|
|
67
68
|
'moc' : IDL.Text,
|
|
68
69
|
'scripts' : IDL.Vec(Script),
|
|
@@ -77,6 +78,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
77
78
|
'devDependencies' : IDL.Vec(DependencyV2),
|
|
78
79
|
'repository' : IDL.Text,
|
|
79
80
|
'dependencies' : IDL.Vec(DependencyV2),
|
|
81
|
+
'requirements' : IDL.Vec(Requirement),
|
|
80
82
|
'license' : IDL.Text,
|
|
81
83
|
'readme' : IDL.Text,
|
|
82
84
|
});
|
|
@@ -92,7 +94,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
92
94
|
'downloadsTotal' : IDL.Nat,
|
|
93
95
|
'downloadsInLast30Days' : IDL.Nat,
|
|
94
96
|
'downloadsInLast7Days' : IDL.Nat,
|
|
95
|
-
'config' :
|
|
97
|
+
'config' : PackageConfigV3,
|
|
96
98
|
'publication' : PackagePublication,
|
|
97
99
|
});
|
|
98
100
|
const BenchmarkMetric = IDL.Text;
|
|
@@ -118,7 +120,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
118
120
|
'downloadsTotal' : IDL.Nat,
|
|
119
121
|
'downloadsInLast30Days' : IDL.Nat,
|
|
120
122
|
'downloadsInLast7Days' : IDL.Nat,
|
|
121
|
-
'config' :
|
|
123
|
+
'config' : PackageConfigV3,
|
|
122
124
|
'publication' : PackagePublication,
|
|
123
125
|
});
|
|
124
126
|
const TestStats__1 = IDL.Record({
|
|
@@ -158,7 +160,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
158
160
|
'downloadsTotal' : IDL.Nat,
|
|
159
161
|
'downloadsInLast30Days' : IDL.Nat,
|
|
160
162
|
'downloadsInLast7Days' : IDL.Nat,
|
|
161
|
-
'config' :
|
|
163
|
+
'config' : PackageConfigV3,
|
|
162
164
|
'changes' : PackageChanges,
|
|
163
165
|
'publication' : PackagePublication,
|
|
164
166
|
});
|
|
@@ -177,7 +179,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
177
179
|
'dependents' : IDL.Vec(PackageSummary__1),
|
|
178
180
|
'devDeps' : IDL.Vec(PackageSummary__1),
|
|
179
181
|
'downloadsInLast7Days' : IDL.Nat,
|
|
180
|
-
'config' :
|
|
182
|
+
'config' : PackageConfigV3,
|
|
181
183
|
'changes' : PackageChanges,
|
|
182
184
|
'publication' : PackagePublication,
|
|
183
185
|
});
|
|
@@ -189,7 +191,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
189
191
|
'downloadsTotal' : IDL.Nat,
|
|
190
192
|
'downloadsInLast30Days' : IDL.Nat,
|
|
191
193
|
'downloadsInLast7Days' : IDL.Nat,
|
|
192
|
-
'config' :
|
|
194
|
+
'config' : PackageConfigV3,
|
|
193
195
|
'changes' : PackageChanges,
|
|
194
196
|
'publication' : PackagePublication,
|
|
195
197
|
});
|
|
@@ -245,7 +247,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
245
247
|
const PageCount = IDL.Nat;
|
|
246
248
|
const Result_1 = IDL.Variant({ 'ok' : IDL.Null, 'err' : IDL.Text });
|
|
247
249
|
const Result_3 = IDL.Variant({ 'ok' : FileId, 'err' : Err });
|
|
248
|
-
const
|
|
250
|
+
const PackageConfigV3_Publishing = IDL.Record({
|
|
249
251
|
'dfx' : IDL.Text,
|
|
250
252
|
'moc' : IDL.Text,
|
|
251
253
|
'scripts' : IDL.Vec(Script),
|
|
@@ -260,6 +262,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
260
262
|
'devDependencies' : IDL.Vec(DependencyV2),
|
|
261
263
|
'repository' : IDL.Text,
|
|
262
264
|
'dependencies' : IDL.Vec(DependencyV2),
|
|
265
|
+
'requirements' : IDL.Opt(IDL.Vec(Requirement)),
|
|
263
266
|
'license' : IDL.Text,
|
|
264
267
|
'readme' : IDL.Text,
|
|
265
268
|
});
|
|
@@ -379,7 +382,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
379
382
|
[Result_3],
|
|
380
383
|
[],
|
|
381
384
|
),
|
|
382
|
-
'startPublish' : IDL.Func([
|
|
385
|
+
'startPublish' : IDL.Func([PackageConfigV3_Publishing], [Result_2], []),
|
|
383
386
|
'transferOwnership' : IDL.Func(
|
|
384
387
|
[PackageName, IDL.Principal],
|
|
385
388
|
[Result_1],
|
package/dist/api/actors.d.ts
CHANGED
|
File without changes
|
package/dist/api/actors.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/api/index.d.ts
CHANGED
|
File without changes
|
package/dist/api/index.js
CHANGED
|
File without changes
|
package/dist/api/network.d.ts
CHANGED
|
File without changes
|
package/dist/api/network.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/bin/mops.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
export {};
|
package/dist/bin/mops.js
CHANGED
|
File without changes
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync } from 'node:fs';
|
|
2
2
|
let packageJson = JSON.parse(readFileSync('./bundle/package.json', 'utf8'));
|
|
3
|
+
packageJson.bin.mops = 'bin/mops.js';
|
|
4
|
+
packageJson.bin['ic-mops'] = 'bin/mops.js';
|
|
3
5
|
delete packageJson.scripts;
|
|
4
6
|
delete packageJson.devDependencies;
|
|
5
7
|
delete packageJson.overrides;
|
package/dist/cache.d.ts
CHANGED
|
File without changes
|
package/dist/cache.js
CHANGED
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { SemVer } from 'semver';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { getDependencyType, readConfig } from './mops.js';
|
|
5
|
+
import { resolvePackages } from './resolve-packages.js';
|
|
6
|
+
import { getMocVersion } from './helpers/get-moc-version.js';
|
|
7
|
+
export async function checkRequirements({ verbose = false } = {}) {
|
|
8
|
+
let config = readConfig();
|
|
9
|
+
let mocVersion = config.toolchain?.moc;
|
|
10
|
+
if (!mocVersion) {
|
|
11
|
+
mocVersion = getMocVersion();
|
|
12
|
+
}
|
|
13
|
+
if (!mocVersion) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
let installedMoc = new SemVer(mocVersion);
|
|
17
|
+
let highestRequiredMoc = new SemVer('0.0.0');
|
|
18
|
+
let highestRequiredMocPkgId = '';
|
|
19
|
+
let resolvedPackages = await resolvePackages();
|
|
20
|
+
for (let [name, version] of Object.entries(resolvedPackages)) {
|
|
21
|
+
if (getDependencyType(version) === 'mops') {
|
|
22
|
+
let pkgId = `${name}@${version}`;
|
|
23
|
+
let depConfig = readConfig(path.join('.mops', pkgId, 'mops.toml'));
|
|
24
|
+
let moc = depConfig.requirements?.moc;
|
|
25
|
+
if (moc) {
|
|
26
|
+
let requiredMoc = new SemVer(moc);
|
|
27
|
+
if (highestRequiredMoc.compare(requiredMoc) < 0) {
|
|
28
|
+
highestRequiredMoc = requiredMoc;
|
|
29
|
+
highestRequiredMocPkgId = pkgId;
|
|
30
|
+
}
|
|
31
|
+
verbose && _check(pkgId, installedMoc, requiredMoc);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
verbose || _check(highestRequiredMocPkgId, installedMoc, highestRequiredMoc);
|
|
36
|
+
}
|
|
37
|
+
function _check(pkgId, installedMoc, requiredMoc) {
|
|
38
|
+
let comp = installedMoc.compare(requiredMoc);
|
|
39
|
+
if (comp < 0) {
|
|
40
|
+
console.log(chalk.yellow(`moc version does not meet the requirements of ${pkgId}`));
|
|
41
|
+
console.log(chalk.yellow(` Required: >= ${requiredMoc.format()}`));
|
|
42
|
+
console.log(chalk.yellow(` Installed: ${installedMoc.format()}`));
|
|
43
|
+
}
|
|
44
|
+
}
|
package/dist/cli.d.ts
CHANGED
|
File without changes
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { init } from './commands/init.js';
|
|
|
5
5
|
import { publish } from './commands/publish.js';
|
|
6
6
|
import { importPem } from './commands/import-identity.js';
|
|
7
7
|
import { sources } from './commands/sources.js';
|
|
8
|
-
import { checkApiCompatibility, setNetwork, apiVersion, checkConfigFile, getNetworkFile } from './mops.js';
|
|
8
|
+
import { checkApiCompatibility, setNetwork, apiVersion, checkConfigFile, getNetworkFile, version } from './mops.js';
|
|
9
9
|
import { getNetwork } from './api/network.js';
|
|
10
10
|
import { whoami } from './commands/whoami.js';
|
|
11
11
|
import { installAll } from './commands/install-all.js';
|
|
@@ -14,7 +14,6 @@ import { add } from './commands/add.js';
|
|
|
14
14
|
import { cacheSize, cleanCache } from './cache.js';
|
|
15
15
|
import { test } from './commands/test/test.js';
|
|
16
16
|
import { template } from './commands/template.js';
|
|
17
|
-
import { selfUpdate } from './commands/self-update.js';
|
|
18
17
|
import { remove } from './commands/remove.js';
|
|
19
18
|
import { getUserProp, setUserProp } from './commands/user.js';
|
|
20
19
|
import { bump } from './commands/bump.js';
|
|
@@ -24,6 +23,7 @@ import { update } from './commands/update.js';
|
|
|
24
23
|
import { bench } from './commands/bench.js';
|
|
25
24
|
import { transferOwnership } from './commands/transfer-ownership.js';
|
|
26
25
|
import { toolchain } from './commands/toolchain/index.js';
|
|
26
|
+
import * as self from './commands/self.js';
|
|
27
27
|
let networkFile = getNetworkFile();
|
|
28
28
|
if (fs.existsSync(networkFile)) {
|
|
29
29
|
globalThis.MOPS_NETWORK = fs.readFileSync(networkFile).toString() || 'ic';
|
|
@@ -31,8 +31,7 @@ if (fs.existsSync(networkFile)) {
|
|
|
31
31
|
let program = new Command();
|
|
32
32
|
program.name('mops');
|
|
33
33
|
// --version
|
|
34
|
-
|
|
35
|
-
program.version(`CLI ${packageJson.version}\nAPI ${apiVersion}`, '-v --version');
|
|
34
|
+
program.version(`CLI ${version()}\nAPI ${apiVersion}`, '-v --version');
|
|
36
35
|
// init
|
|
37
36
|
program
|
|
38
37
|
.command('init')
|
|
@@ -225,20 +224,6 @@ program
|
|
|
225
224
|
// }
|
|
226
225
|
// await docs();
|
|
227
226
|
// });
|
|
228
|
-
// self update
|
|
229
|
-
program
|
|
230
|
-
.command('self-update')
|
|
231
|
-
.description('Update mops CLI to the latest version')
|
|
232
|
-
.option('--detached')
|
|
233
|
-
.option('--force')
|
|
234
|
-
.action(async (options) => {
|
|
235
|
-
if (options.force) {
|
|
236
|
-
selfUpdate(options);
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
console.log('Please run \'npm i -g ic-mops\'');
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
227
|
// user
|
|
243
228
|
program
|
|
244
229
|
.command('user')
|
|
@@ -340,4 +325,19 @@ toolchainCommand
|
|
|
340
325
|
console.log(bin);
|
|
341
326
|
});
|
|
342
327
|
program.addCommand(toolchainCommand);
|
|
328
|
+
// self
|
|
329
|
+
const selfCommand = new Command('self').description('Mops CLI management');
|
|
330
|
+
selfCommand
|
|
331
|
+
.command('update')
|
|
332
|
+
.description('Update mops CLI to the latest version')
|
|
333
|
+
.action(async () => {
|
|
334
|
+
await self.update();
|
|
335
|
+
});
|
|
336
|
+
selfCommand
|
|
337
|
+
.command('uninstall')
|
|
338
|
+
.description('Uninstall mops CLI')
|
|
339
|
+
.action(async () => {
|
|
340
|
+
await self.uninstall();
|
|
341
|
+
});
|
|
342
|
+
program.addCommand(selfCommand);
|
|
343
343
|
program.parse();
|
package/dist/commands/add.d.ts
CHANGED
|
File without changes
|
package/dist/commands/add.js
CHANGED
|
@@ -7,6 +7,7 @@ import { installFromGithub } from '../vessel.js';
|
|
|
7
7
|
import { install } from './install.js';
|
|
8
8
|
import { notifyInstalls } from '../notify-installs.js';
|
|
9
9
|
import { checkIntegrity } from '../integrity.js';
|
|
10
|
+
import { checkRequirements } from '../check-requirements.js';
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
12
|
export async function add(name, { verbose = false, dev = false, lock } = {}, asName) {
|
|
12
13
|
if (!checkConfigFile()) {
|
|
@@ -100,5 +101,6 @@ export async function add(name, { verbose = false, dev = false, lock } = {}, asN
|
|
|
100
101
|
checkIntegrity(lock),
|
|
101
102
|
]);
|
|
102
103
|
logUpdate.clear();
|
|
104
|
+
await checkRequirements({ verbose });
|
|
103
105
|
console.log(chalk.green('Package installed ') + `${pkgDetails.name} = "${pkgDetails.repo || pkgDetails.path || pkgDetails.version}"`);
|
|
104
106
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/commands/bench.d.ts
CHANGED
|
File without changes
|
package/dist/commands/bench.js
CHANGED
|
File without changes
|
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
|