ic-mops 0.41.0 → 0.42.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/.DS_Store +0 -0
- package/CHANGELOG.md +12 -0
- package/api/actors.ts +2 -3
- package/bundle/bin/mops.js +0 -0
- package/bundle/cli.js +29 -29
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did.d.ts +1 -1
- package/bundle/declarations/bench/index.js +0 -9
- package/bundle/declarations/main/index.js +1 -2
- package/bundle/declarations/main/main.did +15 -8
- package/bundle/declarations/main/main.did.d.ts +12 -9
- package/bundle/declarations/main/main.did.js +11 -8
- package/bundle/declarations/storage/storage.did.d.ts +3 -0
- package/bundle/package.json +2 -2
- package/bundle-package-json.ts +3 -0
- package/cache.ts +25 -7
- package/check-requirements.ts +50 -0
- package/cli.ts +3 -2
- package/commands/add.ts +13 -7
- package/commands/available-updates.ts +1 -0
- package/commands/bench-replica.ts +1 -0
- package/commands/bench.ts +1 -0
- package/commands/bump.ts +1 -0
- package/commands/docs.ts +1 -0
- package/commands/import-identity.ts +1 -0
- package/commands/init.ts +2 -1
- package/commands/install/install-all.ts +51 -0
- package/commands/install/install-dep.ts +34 -0
- package/commands/install/install-deps.ts +31 -0
- package/commands/install/install-local-dep.ts +31 -0
- package/commands/{install.ts → install/install-mops-dep.ts} +43 -43
- package/commands/install/sync-local-cache.ts +34 -0
- package/commands/publish.ts +18 -3
- package/commands/remove.ts +15 -18
- package/commands/search.ts +1 -0
- package/commands/self.ts +1 -0
- package/commands/sources.ts +1 -0
- package/commands/sync.ts +1 -0
- package/commands/test/test.ts +1 -0
- package/commands/toolchain/index.ts +8 -0
- package/commands/toolchain/moc.ts +1 -0
- package/commands/toolchain/pocket-ic.ts +1 -0
- package/commands/toolchain/toolchain-utils.ts +2 -0
- package/commands/toolchain/wasmtime.ts +1 -0
- package/commands/transfer-ownership.ts +1 -0
- package/commands/user.ts +1 -0
- package/declarations/bench/bench.did.d.ts +1 -1
- package/declarations/bench/index.js +0 -9
- 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/declarations/storage/storage.did.d.ts +3 -0
- package/dist/api/actors.js +2 -2
- package/dist/bin/mops.js +0 -0
- package/dist/bundle-package-json.js +2 -0
- package/dist/cache.d.ts +7 -3
- package/dist/cache.js +21 -7
- package/dist/check-requirements.js +9 -4
- package/dist/cli.js +3 -2
- package/dist/commands/add.js +9 -6
- package/dist/commands/available-updates.js +1 -0
- package/dist/commands/bench-replica.js +1 -0
- package/dist/commands/bench.js +1 -0
- package/dist/commands/bump.js +1 -0
- package/dist/commands/docs.js +1 -0
- package/dist/commands/import-identity.js +1 -0
- package/dist/commands/init.js +2 -1
- package/dist/commands/install/install-all.d.ts +8 -0
- package/dist/commands/install/install-all.js +36 -0
- package/dist/commands/install/install-dep.d.ts +8 -0
- package/dist/commands/install/install-dep.js +25 -0
- package/dist/commands/install/install-deps.d.ts +8 -0
- package/dist/commands/install/install-deps.js +21 -0
- package/dist/commands/install/install-local-dep.d.ts +6 -0
- package/dist/commands/install/install-local-dep.js +23 -0
- package/dist/commands/install/install-mops-dep.d.ts +8 -0
- package/dist/commands/install/install-mops-dep.js +103 -0
- package/dist/commands/install/sync-local-cache.d.ts +3 -0
- package/dist/commands/install/sync-local-cache.js +26 -0
- package/dist/commands/install-all.js +2 -0
- package/dist/commands/publish.js +14 -1
- package/dist/commands/remove.js +15 -18
- package/dist/commands/search.js +1 -0
- package/dist/commands/self.js +1 -0
- package/dist/commands/sources.js +1 -0
- package/dist/commands/sync.js +1 -0
- package/dist/commands/test/test.js +1 -0
- package/dist/commands/toolchain/index.js +6 -0
- package/dist/commands/toolchain/moc.js +1 -0
- package/dist/commands/toolchain/pocket-ic.js +1 -0
- package/dist/commands/toolchain/toolchain-utils.js +2 -0
- package/dist/commands/toolchain/wasmtime.js +1 -0
- package/dist/commands/transfer-ownership.js +1 -0
- package/dist/commands/user.js +1 -0
- package/dist/declarations/bench/bench.did.d.ts +1 -1
- package/dist/declarations/bench/index.js +0 -9
- 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/declarations/storage/storage.did.d.ts +3 -0
- package/dist/fix-dist.d.ts +1 -0
- package/dist/fix-dist.js +9 -0
- package/dist/helpers/get-moc-path.js +1 -0
- package/dist/integrity.js +1 -0
- package/dist/mops.js +11 -3
- package/dist/notify-installs.d.ts +1 -1
- package/dist/notify-installs.js +8 -5
- package/dist/package.json +3 -3
- package/dist/pem.d.ts +1 -0
- package/dist/pem.js +2 -1
- package/dist/resolve-packages.js +11 -9
- package/dist/types.d.ts +4 -0
- package/dist/vessel.js +10 -12
- package/{remove-scripts.ts → fix-dist.ts} +6 -0
- package/helpers/get-moc-path.ts +1 -0
- package/integrity.ts +1 -0
- package/mops.ts +13 -3
- package/notify-installs.ts +9 -5
- package/package.json +7 -7
- package/pem.ts +2 -1
- package/resolve-packages.ts +11 -9
- package/tsconfig.json +1 -0
- package/types.ts +7 -2
- package/vessel.ts +11 -13
- package/commands/install-all.ts +0 -56
- package/commands/install-local.ts +0 -52
|
@@ -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],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Principal } from '@dfinity/principal';
|
|
2
2
|
import type { ActorMethod } from '@dfinity/agent';
|
|
3
|
+
import type { IDL } from '@dfinity/candid';
|
|
3
4
|
|
|
4
5
|
export type Chunk = Array<number>;
|
|
5
6
|
export type Err = string;
|
|
@@ -35,3 +36,5 @@ export interface StorageStats {
|
|
|
35
36
|
'memorySize' : bigint,
|
|
36
37
|
}
|
|
37
38
|
export interface _SERVICE extends Storage {}
|
|
39
|
+
export declare const idlFactory: IDL.InterfaceFactory;
|
|
40
|
+
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
package/dist/api/actors.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Actor, HttpAgent } from '@dfinity/agent';
|
|
2
|
-
import { idlFactory } from '../declarations/main/
|
|
3
|
-
import { idlFactory as storageIdlFactory } from '../declarations/storage/
|
|
2
|
+
import { idlFactory } from '../declarations/main/main.did.js';
|
|
3
|
+
import { idlFactory as storageIdlFactory } from '../declarations/storage/storage.did.js';
|
|
4
4
|
import { getEndpoint } from './network.js';
|
|
5
5
|
import { getNetwork } from './network.js';
|
|
6
6
|
export let mainActor = async (identity) => {
|
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
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export declare let
|
|
2
|
-
export declare let
|
|
3
|
-
export declare
|
|
1
|
+
export declare let getDepCacheDir: (cacheName: string) => string;
|
|
2
|
+
export declare let isDepCached: (cacheName: string) => boolean;
|
|
3
|
+
export declare function getDepCacheName(name: string, version: string): string;
|
|
4
|
+
export declare function getMopsDepCacheName(name: string, version: string): string;
|
|
5
|
+
export declare function getGithubDepCacheName(name: string, repo: string): string;
|
|
6
|
+
export declare let addCache: (cacheName: string, source: string) => Promise<void>;
|
|
7
|
+
export declare let copyCache: (cacheName: string, dest: string) => Promise<void>;
|
|
4
8
|
export declare let cacheSize: () => Promise<string>;
|
|
5
9
|
export declare let cleanCache: () => Promise<void>;
|
package/dist/cache.js
CHANGED
|
@@ -2,13 +2,27 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import ncp from 'ncp';
|
|
4
4
|
import getFolderSize from 'get-folder-size';
|
|
5
|
-
import { globalCacheDir } from './mops.js';
|
|
6
|
-
export let
|
|
7
|
-
|
|
5
|
+
import { getDependencyType, globalCacheDir, parseGithubURL } from './mops.js';
|
|
6
|
+
export let getDepCacheDir = (cacheName) => {
|
|
7
|
+
return path.join(globalCacheDir, 'packages', cacheName);
|
|
8
|
+
};
|
|
9
|
+
export let isDepCached = (cacheName) => {
|
|
10
|
+
let dir = getDepCacheDir(cacheName);
|
|
8
11
|
return fs.existsSync(dir);
|
|
9
12
|
};
|
|
10
|
-
export
|
|
11
|
-
let
|
|
13
|
+
export function getDepCacheName(name, version) {
|
|
14
|
+
let depType = getDependencyType(version);
|
|
15
|
+
return depType === 'mops' ? getMopsDepCacheName(name, version) : getGithubDepCacheName(name, version);
|
|
16
|
+
}
|
|
17
|
+
export function getMopsDepCacheName(name, version) {
|
|
18
|
+
return `${name}@${version}`;
|
|
19
|
+
}
|
|
20
|
+
export function getGithubDepCacheName(name, repo) {
|
|
21
|
+
const { branch, commitHash } = parseGithubURL(repo);
|
|
22
|
+
return `_github/${name}#${branch}` + (commitHash ? `@${commitHash}` : '');
|
|
23
|
+
}
|
|
24
|
+
export let addCache = (cacheName, source) => {
|
|
25
|
+
let dest = path.join(globalCacheDir, 'packages', cacheName);
|
|
12
26
|
fs.mkdirSync(dest, { recursive: true });
|
|
13
27
|
return new Promise((resolve, reject) => {
|
|
14
28
|
ncp.ncp(source, dest, { stopOnErr: true }, (err) => {
|
|
@@ -19,8 +33,8 @@ export let addCache = (pkgId, source) => {
|
|
|
19
33
|
});
|
|
20
34
|
});
|
|
21
35
|
};
|
|
22
|
-
export let copyCache = (
|
|
23
|
-
let source = path.join(globalCacheDir, 'packages',
|
|
36
|
+
export let copyCache = (cacheName, dest) => {
|
|
37
|
+
let source = path.join(globalCacheDir, 'packages', cacheName);
|
|
24
38
|
fs.mkdirSync(dest, { recursive: true });
|
|
25
39
|
return new Promise((resolve, reject) => {
|
|
26
40
|
ncp.ncp(source, dest, { stopOnErr: true }, (err) => {
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
import { getDependencyType, readConfig } from './mops.js';
|
|
3
|
-
import { resolvePackages } from './resolve-packages.js';
|
|
4
2
|
import { SemVer } from 'semver';
|
|
5
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';
|
|
6
7
|
export async function checkRequirements({ verbose = false } = {}) {
|
|
7
8
|
let config = readConfig();
|
|
8
|
-
|
|
9
|
+
let mocVersion = config.toolchain?.moc;
|
|
10
|
+
if (!mocVersion) {
|
|
11
|
+
mocVersion = getMocVersion();
|
|
12
|
+
}
|
|
13
|
+
if (!mocVersion) {
|
|
9
14
|
return;
|
|
10
15
|
}
|
|
11
|
-
let installedMoc = new SemVer(
|
|
16
|
+
let installedMoc = new SemVer(mocVersion);
|
|
12
17
|
let highestRequiredMoc = new SemVer('0.0.0');
|
|
13
18
|
let highestRequiredMocPkgId = '';
|
|
14
19
|
let resolvedPackages = await resolvePackages();
|
package/dist/cli.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
1
2
|
import fs from 'node:fs';
|
|
2
3
|
import { Command, Argument, Option } from 'commander';
|
|
3
4
|
import chalk from 'chalk';
|
|
@@ -8,7 +9,7 @@ import { sources } from './commands/sources.js';
|
|
|
8
9
|
import { checkApiCompatibility, setNetwork, apiVersion, checkConfigFile, getNetworkFile, version } from './mops.js';
|
|
9
10
|
import { getNetwork } from './api/network.js';
|
|
10
11
|
import { whoami } from './commands/whoami.js';
|
|
11
|
-
import { installAll } from './commands/install-all.js';
|
|
12
|
+
import { installAll } from './commands/install/install-all.js';
|
|
12
13
|
import { search } from './commands/search.js';
|
|
13
14
|
import { add } from './commands/add.js';
|
|
14
15
|
import { cacheSize, cleanCache } from './cache.js';
|
|
@@ -145,7 +146,7 @@ program
|
|
|
145
146
|
if (!checkConfigFile()) {
|
|
146
147
|
process.exit(1);
|
|
147
148
|
}
|
|
148
|
-
await installAll({ silent: true, lock: 'ignore' });
|
|
149
|
+
await installAll({ silent: true, lock: 'ignore', threads: 6 });
|
|
149
150
|
await toolchain.ensureToolchainInited({ strict: false });
|
|
150
151
|
let sourcesArr = await sources(options);
|
|
151
152
|
console.log(sourcesArr.join('\n'));
|
package/dist/commands/add.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import chalk from 'chalk';
|
|
3
4
|
import { createLogUpdate } from 'log-update';
|
|
4
5
|
import { checkConfigFile, getGithubCommit, parseGithubURL, readConfig, writeConfig } from '../mops.js';
|
|
5
6
|
import { getHighestVersion } from '../api/getHighestVersion.js';
|
|
7
|
+
import { installMopsDep } from './install/install-mops-dep.js';
|
|
6
8
|
import { installFromGithub } from '../vessel.js';
|
|
7
|
-
import { install } from './install.js';
|
|
8
|
-
import { notifyInstalls } from '../notify-installs.js';
|
|
9
9
|
import { checkIntegrity } from '../integrity.js';
|
|
10
|
+
import { checkRequirements } from '../check-requirements.js';
|
|
11
|
+
import { syncLocalCache } from './install/sync-local-cache.js';
|
|
12
|
+
import { notifyInstalls } from '../notify-installs.js';
|
|
10
13
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11
14
|
export async function add(name, { verbose = false, dev = false, lock } = {}, asName) {
|
|
12
15
|
if (!checkConfigFile()) {
|
|
@@ -71,16 +74,14 @@ export async function add(name, { verbose = false, dev = false, lock } = {}, asN
|
|
|
71
74
|
version: ver,
|
|
72
75
|
};
|
|
73
76
|
}
|
|
74
|
-
let installedPackages = {};
|
|
75
77
|
if (pkgDetails.repo) {
|
|
76
78
|
await installFromGithub(pkgDetails.name, pkgDetails.repo, { verbose: verbose });
|
|
77
79
|
}
|
|
78
80
|
else if (!pkgDetails.path) {
|
|
79
|
-
let res = await
|
|
81
|
+
let res = await installMopsDep(pkgDetails.name, pkgDetails.version, { verbose: verbose });
|
|
80
82
|
if (res === false) {
|
|
81
83
|
return;
|
|
82
84
|
}
|
|
83
|
-
installedPackages = { ...installedPackages, ...res };
|
|
84
85
|
}
|
|
85
86
|
const depsProp = dev ? 'dev-dependencies' : 'dependencies';
|
|
86
87
|
let deps = config[depsProp];
|
|
@@ -95,10 +96,12 @@ export async function add(name, { verbose = false, dev = false, lock } = {}, asN
|
|
|
95
96
|
if (lock !== 'ignore') {
|
|
96
97
|
logUpdate('Checking integrity...');
|
|
97
98
|
}
|
|
99
|
+
let installedPackages = await syncLocalCache();
|
|
98
100
|
await Promise.all([
|
|
99
|
-
notifyInstalls(
|
|
101
|
+
notifyInstalls(installedPackages),
|
|
100
102
|
checkIntegrity(lock),
|
|
101
103
|
]);
|
|
102
104
|
logUpdate.clear();
|
|
105
|
+
await checkRequirements({ verbose });
|
|
103
106
|
console.log(chalk.green('Package installed ') + `${pkgDetails.name} = "${pkgDetails.repo || pkgDetails.path || pkgDetails.version}"`);
|
|
104
107
|
}
|
package/dist/commands/bench.js
CHANGED
package/dist/commands/bump.js
CHANGED
package/dist/commands/docs.js
CHANGED
package/dist/commands/init.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
1
2
|
import { execSync } from 'node:child_process';
|
|
2
3
|
import path from 'node:path';
|
|
3
4
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
@@ -5,7 +6,7 @@ import chalk from 'chalk';
|
|
|
5
6
|
import prompts from 'prompts';
|
|
6
7
|
import { checkApiCompatibility, writeConfig } from '../mops.js';
|
|
7
8
|
import { mainActor } from '../api/actors.js';
|
|
8
|
-
import { installAll } from './install-all.js';
|
|
9
|
+
import { installAll } from './install/install-all.js';
|
|
9
10
|
import { readVesselConfig } from '../vessel.js';
|
|
10
11
|
import { template } from './template.js';
|
|
11
12
|
export async function init({ yes = false } = {}) {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { createLogUpdate } from 'log-update';
|
|
4
|
+
import { checkConfigFile, readConfig } from '../../mops.js';
|
|
5
|
+
import { checkIntegrity } from '../../integrity.js';
|
|
6
|
+
import { installDeps } from './install-deps.js';
|
|
7
|
+
import { checkRequirements } from '../../check-requirements.js';
|
|
8
|
+
import { syncLocalCache } from './sync-local-cache.js';
|
|
9
|
+
import { notifyInstalls } from '../../notify-installs.js';
|
|
10
|
+
export async function installAll({ verbose = false, silent = false, threads, lock } = {}) {
|
|
11
|
+
if (!checkConfigFile()) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
let config = readConfig();
|
|
15
|
+
let deps = Object.values(config.dependencies || {});
|
|
16
|
+
let devDeps = Object.values(config['dev-dependencies'] || {});
|
|
17
|
+
let allDeps = [...deps, ...devDeps];
|
|
18
|
+
let res = await installDeps(allDeps, { silent, verbose, threads });
|
|
19
|
+
if (!res) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
|
|
23
|
+
if (!silent && lock !== 'ignore') {
|
|
24
|
+
logUpdate('Checking integrity...');
|
|
25
|
+
}
|
|
26
|
+
let installedPackages = await syncLocalCache();
|
|
27
|
+
await Promise.all([
|
|
28
|
+
notifyInstalls(installedPackages),
|
|
29
|
+
checkIntegrity(lock),
|
|
30
|
+
]);
|
|
31
|
+
if (!silent) {
|
|
32
|
+
logUpdate.clear();
|
|
33
|
+
await checkRequirements();
|
|
34
|
+
console.log(chalk.green('Packages installed'));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dependency } from '../../types.js';
|
|
2
|
+
type InstallDepOptions = {
|
|
3
|
+
verbose?: boolean;
|
|
4
|
+
silent?: boolean;
|
|
5
|
+
threads?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function installDep(dep: Dependency, { verbose, silent, threads }?: InstallDepOptions, parentPkgPath?: string): Promise<Record<string, string> | false>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { installFromGithub } from '../../vessel.js';
|
|
3
|
+
import { installMopsDep } from './install-mops-dep.js';
|
|
4
|
+
import { installLocalDep } from './install-local-dep.js';
|
|
5
|
+
import { getRootDir } from '../../mops.js';
|
|
6
|
+
// install dependency
|
|
7
|
+
// returns false if failed
|
|
8
|
+
export async function installDep(dep, { verbose, silent, threads } = {}, parentPkgPath) {
|
|
9
|
+
if (dep.repo) {
|
|
10
|
+
await installFromGithub(dep.name, dep.repo, { silent, verbose });
|
|
11
|
+
return {};
|
|
12
|
+
}
|
|
13
|
+
else if (dep.path) {
|
|
14
|
+
let depPath = dep.path;
|
|
15
|
+
parentPkgPath = parentPkgPath || getRootDir();
|
|
16
|
+
if (parentPkgPath) {
|
|
17
|
+
depPath = path.resolve(parentPkgPath, dep.path);
|
|
18
|
+
}
|
|
19
|
+
return installLocalDep(dep.name, depPath, { silent, verbose });
|
|
20
|
+
}
|
|
21
|
+
else if (dep.version) {
|
|
22
|
+
return installMopsDep(dep.name, dep.version, { silent, verbose, threads });
|
|
23
|
+
}
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Dependency } from '../../types.js';
|
|
2
|
+
type InstallDepsOptions = {
|
|
3
|
+
verbose?: boolean;
|
|
4
|
+
silent?: boolean;
|
|
5
|
+
threads?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function installDeps(deps: Dependency[], { verbose, silent, threads }?: InstallDepsOptions, parentPkgPath?: string): Promise<Record<string, string> | false>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { installDep } from './install-dep.js';
|
|
2
|
+
// install all dependencies
|
|
3
|
+
// returns actual installed dependencies
|
|
4
|
+
// returns false if failed
|
|
5
|
+
export async function installDeps(deps, { verbose, silent, threads } = {}, parentPkgPath) {
|
|
6
|
+
let installedDeps = {};
|
|
7
|
+
let ok = true;
|
|
8
|
+
for (const dep of deps) {
|
|
9
|
+
let res = await installDep(dep, { verbose, silent, threads }, parentPkgPath);
|
|
10
|
+
if (res) {
|
|
11
|
+
installedDeps = { ...installedDeps, ...res };
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
ok = false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (!ok) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return installedDeps;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { createLogUpdate } from 'log-update';
|
|
4
|
+
import { getRootDir, readConfig } from '../../mops.js';
|
|
5
|
+
import { installDeps } from './install-deps.js';
|
|
6
|
+
// skip install and just find non-local dependencies to install
|
|
7
|
+
// pkgPath should be relative to the current root dir or absolute
|
|
8
|
+
export async function installLocalDep(pkg, pkgPath = '', { verbose, silent } = {}) {
|
|
9
|
+
if (!silent) {
|
|
10
|
+
let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
|
|
11
|
+
logUpdate(`Local dependency ${pkg} = "${pkgPath}"`);
|
|
12
|
+
if (verbose) {
|
|
13
|
+
silent || logUpdate.done();
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
logUpdate.clear();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// install dependencies
|
|
20
|
+
let dir = path.resolve(getRootDir(), pkgPath);
|
|
21
|
+
let config = readConfig(path.join(dir, 'mops.toml'));
|
|
22
|
+
return installDeps(Object.values(config.dependencies || {}), { silent, verbose }, pkgPath);
|
|
23
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type InstallMopsDepOptions = {
|
|
2
|
+
verbose?: boolean;
|
|
3
|
+
silent?: boolean;
|
|
4
|
+
dep?: boolean;
|
|
5
|
+
threads?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function installMopsDep(pkg: string, version?: string, { verbose, silent, dep, threads }?: InstallMopsDepOptions): Promise<Record<string, string> | false>;
|
|
8
|
+
export {};
|