ic-mops 0.44.1 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/bin/moc-wrapper.sh +2 -1
- package/bundle/bin/moc-wrapper.sh +2 -1
- package/bundle/cli.js +90 -33
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +2 -2
- package/bundle/declarations/bench/bench.did.d.ts +2 -2
- package/bundle/declarations/bench/bench.did.js +2 -2
- package/bundle/declarations/bench/index.js +8 -0
- package/bundle/declarations/main/main.did +5 -0
- package/bundle/declarations/main/main.did.d.ts +5 -0
- package/bundle/declarations/main/main.did.js +5 -0
- package/bundle/package.json +1 -1
- package/cache.ts +2 -1
- package/check-requirements.ts +2 -1
- package/cli.ts +5 -1
- package/commands/available-updates.ts +4 -0
- package/commands/install/install-mops-dep.ts +7 -5
- package/commands/publish.ts +10 -5
- package/commands/remove.ts +5 -4
- package/declarations/bench/bench.did +2 -2
- package/declarations/bench/bench.did.d.ts +2 -2
- package/declarations/bench/bench.did.js +2 -2
- package/declarations/bench/index.js +8 -0
- package/declarations/main/main.did +5 -0
- package/declarations/main/main.did.d.ts +5 -0
- package/declarations/main/main.did.js +5 -0
- package/dist/bin/moc-wrapper.sh +2 -1
- package/dist/cache.js +2 -1
- package/dist/check-requirements.js +2 -1
- package/dist/cli.js +5 -1
- package/dist/commands/available-updates.js +3 -0
- package/dist/commands/install/install-mops-dep.js +7 -5
- package/dist/commands/publish.d.ts +1 -0
- package/dist/commands/publish.js +8 -4
- package/dist/commands/remove.js +5 -4
- package/dist/declarations/bench/bench.did +2 -2
- package/dist/declarations/bench/bench.did.d.ts +2 -2
- package/dist/declarations/bench/bench.did.js +2 -2
- package/dist/declarations/bench/index.js +8 -0
- package/dist/declarations/main/main.did +5 -0
- package/dist/declarations/main/main.did.d.ts +5 -0
- package/dist/declarations/main/main.did.js +5 -0
- package/dist/helpers/get-dep-name.d.ts +1 -0
- package/dist/helpers/get-dep-name.js +3 -0
- package/dist/helpers/get-package-id.d.ts +1 -0
- package/dist/helpers/get-package-id.js +4 -0
- package/dist/integrity.js +2 -1
- package/dist/mops.js +5 -4
- package/dist/notify-installs.js +5 -2
- package/dist/package.json +1 -1
- package/dist/pem.js +1 -1
- package/dist/vessel.js +1 -1
- package/helpers/get-dep-name.ts +3 -0
- package/helpers/get-package-id.ts +5 -0
- package/integrity.ts +2 -1
- package/mops.ts +5 -4
- package/notify-installs.ts +6 -2
- package/package.json +2 -2
- package/pem.ts +1 -1
- package/vessel.ts +1 -1
- package/.npmrc +0 -2
- package/dist/commands/install-all.d.ts +0 -7
- package/dist/commands/install-all.js +0 -45
- package/dist/commands/install-local.d.ts +0 -4
- package/dist/commands/install-local.js +0 -47
- package/dist/commands/install.d.ts +0 -5
- package/dist/commands/install.js +0 -109
- package/dist/remove-scripts.d.ts +0 -1
- package/dist/remove-scripts.js +0 -5
package/dist/cli.js
CHANGED
|
@@ -105,6 +105,7 @@ program
|
|
|
105
105
|
.option('--no-docs', 'Do not generate docs')
|
|
106
106
|
.option('--no-test', 'Do not run tests')
|
|
107
107
|
.option('--no-bench', 'Do not run benchmarks')
|
|
108
|
+
.option('--verbose')
|
|
108
109
|
.action(async (options) => {
|
|
109
110
|
if (!checkConfigFile()) {
|
|
110
111
|
process.exit(1);
|
|
@@ -144,12 +145,15 @@ program
|
|
|
144
145
|
program
|
|
145
146
|
.command('sources')
|
|
146
147
|
.description('for dfx packtool')
|
|
148
|
+
.option('--no-install', 'Do not install dependencies before running sources')
|
|
147
149
|
.option('--verbose')
|
|
148
150
|
.action(async (options) => {
|
|
149
151
|
if (!checkConfigFile()) {
|
|
150
152
|
process.exit(1);
|
|
151
153
|
}
|
|
152
|
-
|
|
154
|
+
if (options.install) {
|
|
155
|
+
await installAll({ silent: true, lock: 'ignore', threads: 6 });
|
|
156
|
+
}
|
|
153
157
|
await toolchain.ensureToolchainInited({ strict: false });
|
|
154
158
|
let sourcesArr = await sources(options);
|
|
155
159
|
console.log(sourcesArr.join('\n'));
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { mainActor } from '../api/actors.js';
|
|
4
|
+
import { getDepName } from '../helpers/get-dep-name.js';
|
|
4
5
|
// [pkg, oldVersion, newVersion]
|
|
5
6
|
export async function getAvailableUpdates(config, pkg) {
|
|
6
7
|
let deps = Object.values(config.dependencies || {});
|
|
7
8
|
let devDeps = Object.values(config['dev-dependencies'] || {});
|
|
8
9
|
let allDeps = [...deps, ...devDeps].filter((dep) => dep.version);
|
|
9
10
|
let depsToUpdate = pkg ? allDeps.filter((dep) => dep.name === pkg) : allDeps;
|
|
11
|
+
// skip pinned dependencies
|
|
12
|
+
depsToUpdate = depsToUpdate.filter((dep) => getDepName(dep.name) === dep.name);
|
|
10
13
|
let getCurrentVersion = (pkg) => {
|
|
11
14
|
for (let dep of allDeps) {
|
|
12
15
|
if (dep.name === pkg && dep.version) {
|
|
@@ -12,8 +12,10 @@ import { parallel } from '../../parallel.js';
|
|
|
12
12
|
import { getDepCacheDir, getMopsDepCacheName, isDepCached } from '../../cache.js';
|
|
13
13
|
import { downloadFile, getPackageFilesInfo } from '../../api/downloadPackageFiles.js';
|
|
14
14
|
import { installDeps } from './install-deps.js';
|
|
15
|
+
import { getDepName } from '../../helpers/get-dep-name.js';
|
|
15
16
|
export async function installMopsDep(pkg, version = '', { verbose, silent, dep, threads } = {}) {
|
|
16
17
|
threads = threads || 12;
|
|
18
|
+
let depName = getDepName(pkg);
|
|
17
19
|
if (!checkConfigFile()) {
|
|
18
20
|
return false;
|
|
19
21
|
}
|
|
@@ -23,22 +25,22 @@ export async function installMopsDep(pkg, version = '', { verbose, silent, dep,
|
|
|
23
25
|
let step = 0;
|
|
24
26
|
let progress = () => {
|
|
25
27
|
step++;
|
|
26
|
-
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${
|
|
28
|
+
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${depName}@${version} ${progressBar(step, total)}`);
|
|
27
29
|
};
|
|
28
30
|
progress();
|
|
29
31
|
if (!version) {
|
|
30
|
-
let versionRes = await getHighestVersion(
|
|
32
|
+
let versionRes = await getHighestVersion(depName);
|
|
31
33
|
if ('err' in versionRes) {
|
|
32
34
|
console.log(chalk.red('Error: ') + versionRes.err);
|
|
33
35
|
return false;
|
|
34
36
|
}
|
|
35
37
|
version = versionRes.ok;
|
|
36
38
|
}
|
|
37
|
-
let cacheName = getMopsDepCacheName(
|
|
39
|
+
let cacheName = getMopsDepCacheName(depName, version);
|
|
38
40
|
let cacheDir = getDepCacheDir(cacheName);
|
|
39
41
|
// global cache hit
|
|
40
42
|
if (isDepCached(cacheName)) {
|
|
41
|
-
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${
|
|
43
|
+
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${depName}@${version} (cache)`);
|
|
42
44
|
}
|
|
43
45
|
// download
|
|
44
46
|
else {
|
|
@@ -47,7 +49,7 @@ export async function installMopsDep(pkg, version = '', { verbose, silent, dep,
|
|
|
47
49
|
threads = 4;
|
|
48
50
|
}
|
|
49
51
|
try {
|
|
50
|
-
let { storageId, fileIds } = await getPackageFilesInfo(
|
|
52
|
+
let { storageId, fileIds } = await getPackageFilesInfo(depName, version);
|
|
51
53
|
total = fileIds.length + 2;
|
|
52
54
|
let filesData = new Map;
|
|
53
55
|
let storage = await storageActor(storageId);
|
package/dist/commands/publish.js
CHANGED
|
@@ -198,6 +198,10 @@ export async function publish(options = {}) {
|
|
|
198
198
|
let files = config.package.files || ['**/*.mo'];
|
|
199
199
|
files = [...files, ...defaultFiles];
|
|
200
200
|
files = globbySync([...files, ...defaultFiles]);
|
|
201
|
+
if (options.verbose) {
|
|
202
|
+
console.log('Files:');
|
|
203
|
+
console.log(files.map((file) => ' ' + file).join('\n'));
|
|
204
|
+
}
|
|
201
205
|
// generate docs
|
|
202
206
|
let docsFile = path.join(rootDir, '.mops/.docs/docs.tgz');
|
|
203
207
|
if (options.docs) {
|
|
@@ -276,7 +280,7 @@ export async function publish(options = {}) {
|
|
|
276
280
|
let publishing = await actor.startPublish(backendPkgConfig);
|
|
277
281
|
if ('err' in publishing) {
|
|
278
282
|
console.log(chalk.red('Error: ') + publishing.err);
|
|
279
|
-
|
|
283
|
+
process.exit(1);
|
|
280
284
|
}
|
|
281
285
|
let puiblishingId = publishing.ok;
|
|
282
286
|
// upload test stats
|
|
@@ -308,7 +312,7 @@ export async function publish(options = {}) {
|
|
|
308
312
|
let res = await actor.startFileUpload(puiblishingId, file, BigInt(chunkCount), firstChunk);
|
|
309
313
|
if ('err' in res) {
|
|
310
314
|
console.log(chalk.red('Error: ') + res.err);
|
|
311
|
-
|
|
315
|
+
process.exit(1);
|
|
312
316
|
}
|
|
313
317
|
let fileId = res.ok;
|
|
314
318
|
for (let i = 1; i < chunkCount; i++) {
|
|
@@ -317,7 +321,7 @@ export async function publish(options = {}) {
|
|
|
317
321
|
let res = await actor.uploadFileChunk(puiblishingId, fileId, BigInt(i), chunk);
|
|
318
322
|
if ('err' in res) {
|
|
319
323
|
console.log(chalk.red('Error: ') + res.err);
|
|
320
|
-
|
|
324
|
+
process.exit(1);
|
|
321
325
|
}
|
|
322
326
|
}
|
|
323
327
|
});
|
|
@@ -328,7 +332,7 @@ export async function publish(options = {}) {
|
|
|
328
332
|
let res = await actor.finishPublish(puiblishingId);
|
|
329
333
|
if ('err' in res) {
|
|
330
334
|
console.log(chalk.red('Error: ') + res.err);
|
|
331
|
-
|
|
335
|
+
process.exit(1);
|
|
332
336
|
}
|
|
333
337
|
console.log(chalk.green('Published ') + `${config.package.name}@${config.package.version}`);
|
|
334
338
|
}
|
package/dist/commands/remove.js
CHANGED
|
@@ -6,6 +6,7 @@ import { checkIntegrity } from '../integrity.js';
|
|
|
6
6
|
import { getDepCacheDir, getDepCacheName } from '../cache.js';
|
|
7
7
|
import path from 'node:path';
|
|
8
8
|
import { syncLocalCache } from './install/sync-local-cache.js';
|
|
9
|
+
import { getPackageId } from '../helpers/get-package-id.js';
|
|
9
10
|
export async function remove(name, { dev = false, verbose = false, dryRun = false, lock } = {}) {
|
|
10
11
|
if (!checkConfigFile()) {
|
|
11
12
|
return;
|
|
@@ -15,7 +16,7 @@ export async function remove(name, { dev = false, verbose = false, dryRun = fals
|
|
|
15
16
|
let devDeps = Object.values(config['dev-dependencies'] || {});
|
|
16
17
|
return [...deps, ...devDeps]
|
|
17
18
|
.filter((dep) => {
|
|
18
|
-
let depId = dep.name
|
|
19
|
+
let depId = getPackageId(dep.name, dep.version || '');
|
|
19
20
|
return depId !== exceptPkgId;
|
|
20
21
|
}).map((dep) => {
|
|
21
22
|
return [dep, ...getTransitiveDependenciesOf(dep.name, dep.version, dep.repo)];
|
|
@@ -47,17 +48,17 @@ export async function remove(name, { dev = false, verbose = false, dryRun = fals
|
|
|
47
48
|
return console.log(chalk.red('Error: ') + `No ${dev ? 'dev ' : ''}dependency to remove "${name}"`);
|
|
48
49
|
}
|
|
49
50
|
let version = pkgDetails.version;
|
|
50
|
-
let packageId =
|
|
51
|
+
let packageId = getPackageId(name, version || '');
|
|
51
52
|
// transitive deps ignoring deps of this package
|
|
52
53
|
let transitiveDeps = getTransitiveDependencies(config, packageId);
|
|
53
54
|
let transitiveDepIds = new Set(transitiveDeps.map((dep) => {
|
|
54
|
-
return dep.name
|
|
55
|
+
return getPackageId(dep.name, dep.version || '');
|
|
55
56
|
}));
|
|
56
57
|
// transitive deps of this package (including itself)
|
|
57
58
|
let transitiveDepsOfPackage = [pkgDetails, ...getTransitiveDependenciesOf(name, version)];
|
|
58
59
|
// remove local cache
|
|
59
60
|
for (let dep of transitiveDepsOfPackage) {
|
|
60
|
-
let depId = dep.name
|
|
61
|
+
let depId = getPackageId(dep.name, dep.version || '');
|
|
61
62
|
if (transitiveDepIds.has(depId)) {
|
|
62
63
|
verbose && console.log(`Ignored transitive dependency ${depId} (other deps depend on it)`);
|
|
63
64
|
continue;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type
|
|
1
|
+
type _anon_class_10_1 =
|
|
2
2
|
service {
|
|
3
3
|
getSchema: () -> (BenchSchema) query;
|
|
4
4
|
getStats: () -> (BenchResult) query;
|
|
@@ -23,4 +23,4 @@ type BenchResult =
|
|
|
23
23
|
rts_mutator_instructions: int;
|
|
24
24
|
rts_total_allocation: int;
|
|
25
25
|
};
|
|
26
|
-
service : () ->
|
|
26
|
+
service : () -> _anon_class_10_1
|
|
@@ -16,7 +16,7 @@ export interface BenchSchema {
|
|
|
16
16
|
'rows' : Array<string>,
|
|
17
17
|
'description' : string,
|
|
18
18
|
}
|
|
19
|
-
export interface
|
|
19
|
+
export interface _anon_class_10_1 {
|
|
20
20
|
'getSchema' : ActorMethod<[], BenchSchema>,
|
|
21
21
|
'getStats' : ActorMethod<[], BenchResult>,
|
|
22
22
|
'init' : ActorMethod<[], BenchSchema>,
|
|
@@ -24,6 +24,6 @@ export interface anon_class_10_1 {
|
|
|
24
24
|
'runCellUpdate' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
25
25
|
'runCellUpdateAwait' : ActorMethod<[bigint, bigint], BenchResult>,
|
|
26
26
|
}
|
|
27
|
-
export interface _SERVICE extends
|
|
27
|
+
export interface _SERVICE extends _anon_class_10_1 {}
|
|
28
28
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
29
29
|
export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
|
|
@@ -13,7 +13,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
13
13
|
'rts_mutator_instructions' : IDL.Int,
|
|
14
14
|
'rts_heap_size' : IDL.Int,
|
|
15
15
|
});
|
|
16
|
-
const
|
|
16
|
+
const _anon_class_10_1 = IDL.Service({
|
|
17
17
|
'getSchema' : IDL.Func([], [BenchSchema], ['query']),
|
|
18
18
|
'getStats' : IDL.Func([], [BenchResult], ['query']),
|
|
19
19
|
'init' : IDL.Func([], [BenchSchema], []),
|
|
@@ -21,6 +21,6 @@ export const idlFactory = ({ IDL }) => {
|
|
|
21
21
|
'runCellUpdate' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
|
|
22
22
|
'runCellUpdateAwait' : IDL.Func([IDL.Nat, IDL.Nat], [BenchResult], []),
|
|
23
23
|
});
|
|
24
|
-
return
|
|
24
|
+
return _anon_class_10_1;
|
|
25
25
|
};
|
|
26
26
|
export const init = ({ IDL }) => { return []; };
|
|
@@ -4,6 +4,14 @@ import { Actor, HttpAgent } from "@dfinity/agent";
|
|
|
4
4
|
import { idlFactory } from "./bench.did.js";
|
|
5
5
|
export { idlFactory } from "./bench.did.js";
|
|
6
6
|
|
|
7
|
+
/* CANISTER_ID is replaced by webpack based on node environment
|
|
8
|
+
* Note: canister environment variable will be standardized as
|
|
9
|
+
* process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
|
|
10
|
+
* beginning in dfx 0.15.0
|
|
11
|
+
*/
|
|
12
|
+
export const canisterId =
|
|
13
|
+
process.env.CANISTER_ID_BENCH;
|
|
14
|
+
|
|
7
15
|
export const createActor = (canisterId, options = {}) => {
|
|
8
16
|
const agent = options.agent || new HttpAgent({ ...options.agentOptions });
|
|
9
17
|
|
|
@@ -151,6 +151,7 @@ type PackageVersion = text;
|
|
|
151
151
|
type PackageSummary__1 =
|
|
152
152
|
record {
|
|
153
153
|
config: PackageConfigV3;
|
|
154
|
+
depAlias: text;
|
|
154
155
|
downloadsInLast30Days: nat;
|
|
155
156
|
downloadsInLast7Days: nat;
|
|
156
157
|
downloadsTotal: nat;
|
|
@@ -163,6 +164,7 @@ type PackageSummaryWithChanges__1 =
|
|
|
163
164
|
record {
|
|
164
165
|
changes: PackageChanges;
|
|
165
166
|
config: PackageConfigV3;
|
|
167
|
+
depAlias: text;
|
|
166
168
|
downloadsInLast30Days: nat;
|
|
167
169
|
downloadsInLast7Days: nat;
|
|
168
170
|
downloadsTotal: nat;
|
|
@@ -175,6 +177,7 @@ type PackageSummaryWithChanges =
|
|
|
175
177
|
record {
|
|
176
178
|
changes: PackageChanges;
|
|
177
179
|
config: PackageConfigV3;
|
|
180
|
+
depAlias: text;
|
|
178
181
|
downloadsInLast30Days: nat;
|
|
179
182
|
downloadsInLast7Days: nat;
|
|
180
183
|
downloadsTotal: nat;
|
|
@@ -186,6 +189,7 @@ type PackageSummaryWithChanges =
|
|
|
186
189
|
type PackageSummary =
|
|
187
190
|
record {
|
|
188
191
|
config: PackageConfigV3;
|
|
192
|
+
depAlias: text;
|
|
189
193
|
downloadsInLast30Days: nat;
|
|
190
194
|
downloadsInLast7Days: nat;
|
|
191
195
|
downloadsTotal: nat;
|
|
@@ -224,6 +228,7 @@ type PackageDetails =
|
|
|
224
228
|
benchmarks: Benchmarks__1;
|
|
225
229
|
changes: PackageChanges;
|
|
226
230
|
config: PackageConfigV3;
|
|
231
|
+
depAlias: text;
|
|
227
232
|
dependents: vec PackageSummary__1;
|
|
228
233
|
deps: vec PackageSummary__1;
|
|
229
234
|
devDeps: vec PackageSummary__1;
|
|
@@ -178,6 +178,7 @@ export interface PackageDetails {
|
|
|
178
178
|
'benchmarks' : Benchmarks__1,
|
|
179
179
|
'ownerInfo' : User,
|
|
180
180
|
'owner' : Principal,
|
|
181
|
+
'depAlias' : string,
|
|
181
182
|
'deps' : Array<PackageSummary__1>,
|
|
182
183
|
'quality' : PackageQuality,
|
|
183
184
|
'testStats' : TestStats__1,
|
|
@@ -218,6 +219,7 @@ export interface PackageQuality {
|
|
|
218
219
|
export interface PackageSummary {
|
|
219
220
|
'ownerInfo' : User,
|
|
220
221
|
'owner' : Principal,
|
|
222
|
+
'depAlias' : string,
|
|
221
223
|
'quality' : PackageQuality,
|
|
222
224
|
'downloadsTotal' : bigint,
|
|
223
225
|
'downloadsInLast30Days' : bigint,
|
|
@@ -228,6 +230,7 @@ export interface PackageSummary {
|
|
|
228
230
|
export interface PackageSummaryWithChanges {
|
|
229
231
|
'ownerInfo' : User,
|
|
230
232
|
'owner' : Principal,
|
|
233
|
+
'depAlias' : string,
|
|
231
234
|
'quality' : PackageQuality,
|
|
232
235
|
'downloadsTotal' : bigint,
|
|
233
236
|
'downloadsInLast30Days' : bigint,
|
|
@@ -239,6 +242,7 @@ export interface PackageSummaryWithChanges {
|
|
|
239
242
|
export interface PackageSummaryWithChanges__1 {
|
|
240
243
|
'ownerInfo' : User,
|
|
241
244
|
'owner' : Principal,
|
|
245
|
+
'depAlias' : string,
|
|
242
246
|
'quality' : PackageQuality,
|
|
243
247
|
'downloadsTotal' : bigint,
|
|
244
248
|
'downloadsInLast30Days' : bigint,
|
|
@@ -250,6 +254,7 @@ export interface PackageSummaryWithChanges__1 {
|
|
|
250
254
|
export interface PackageSummary__1 {
|
|
251
255
|
'ownerInfo' : User,
|
|
252
256
|
'owner' : Principal,
|
|
257
|
+
'depAlias' : string,
|
|
253
258
|
'quality' : PackageQuality,
|
|
254
259
|
'downloadsTotal' : bigint,
|
|
255
260
|
'downloadsInLast30Days' : bigint,
|
|
@@ -90,6 +90,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
90
90
|
const PackageSummary = IDL.Record({
|
|
91
91
|
'ownerInfo' : User,
|
|
92
92
|
'owner' : IDL.Principal,
|
|
93
|
+
'depAlias' : IDL.Text,
|
|
93
94
|
'quality' : PackageQuality,
|
|
94
95
|
'downloadsTotal' : IDL.Nat,
|
|
95
96
|
'downloadsInLast30Days' : IDL.Nat,
|
|
@@ -116,6 +117,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
116
117
|
const PackageSummary__1 = IDL.Record({
|
|
117
118
|
'ownerInfo' : User,
|
|
118
119
|
'owner' : IDL.Principal,
|
|
120
|
+
'depAlias' : IDL.Text,
|
|
119
121
|
'quality' : PackageQuality,
|
|
120
122
|
'downloadsTotal' : IDL.Nat,
|
|
121
123
|
'downloadsInLast30Days' : IDL.Nat,
|
|
@@ -156,6 +158,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
156
158
|
const PackageSummaryWithChanges__1 = IDL.Record({
|
|
157
159
|
'ownerInfo' : User,
|
|
158
160
|
'owner' : IDL.Principal,
|
|
161
|
+
'depAlias' : IDL.Text,
|
|
159
162
|
'quality' : PackageQuality,
|
|
160
163
|
'downloadsTotal' : IDL.Nat,
|
|
161
164
|
'downloadsInLast30Days' : IDL.Nat,
|
|
@@ -168,6 +171,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
168
171
|
'benchmarks' : Benchmarks__1,
|
|
169
172
|
'ownerInfo' : User,
|
|
170
173
|
'owner' : IDL.Principal,
|
|
174
|
+
'depAlias' : IDL.Text,
|
|
171
175
|
'deps' : IDL.Vec(PackageSummary__1),
|
|
172
176
|
'quality' : PackageQuality,
|
|
173
177
|
'testStats' : TestStats__1,
|
|
@@ -187,6 +191,7 @@ export const idlFactory = ({ IDL }) => {
|
|
|
187
191
|
const PackageSummaryWithChanges = IDL.Record({
|
|
188
192
|
'ownerInfo' : User,
|
|
189
193
|
'owner' : IDL.Principal,
|
|
194
|
+
'depAlias' : IDL.Text,
|
|
190
195
|
'quality' : PackageQuality,
|
|
191
196
|
'downloadsTotal' : IDL.Nat,
|
|
192
197
|
'downloadsInLast30Days' : IDL.Nat,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDepName(name: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getPackageId(name: string, version: string): string;
|
package/dist/integrity.js
CHANGED
|
@@ -6,6 +6,7 @@ import { bytesToHex } from '@noble/hashes/utils';
|
|
|
6
6
|
import { getDependencyType, getRootDir, readConfig } from './mops.js';
|
|
7
7
|
import { mainActor } from './api/actors.js';
|
|
8
8
|
import { resolvePackages } from './resolve-packages.js';
|
|
9
|
+
import { getPackageId } from './helpers/get-package-id.js';
|
|
9
10
|
export async function checkIntegrity(lock) {
|
|
10
11
|
let force = !!lock;
|
|
11
12
|
if (!lock && !process.env['CI'] && fs.existsSync(path.join(getRootDir(), 'mops.lock'))) {
|
|
@@ -32,7 +33,7 @@ async function getResolvedMopsPackageIds() {
|
|
|
32
33
|
let resolvedPackages = await resolvePackages();
|
|
33
34
|
let packageIds = Object.entries(resolvedPackages)
|
|
34
35
|
.filter(([_, version]) => getDependencyType(version) === 'mops')
|
|
35
|
-
.map(([name, version]) =>
|
|
36
|
+
.map(([name, version]) => getPackageId(name, version));
|
|
36
37
|
return packageIds;
|
|
37
38
|
}
|
|
38
39
|
// get hash of local file from '.mops' dir by fileId
|
package/dist/mops.js
CHANGED
|
@@ -10,11 +10,12 @@ import { decodeFile } from './pem.js';
|
|
|
10
10
|
import { mainActor, storageActor } from './api/actors.js';
|
|
11
11
|
import { getNetwork } from './api/network.js';
|
|
12
12
|
import { getHighestVersion } from './api/getHighestVersion.js';
|
|
13
|
+
import { getPackageId } from './helpers/get-package-id.js';
|
|
13
14
|
if (!globalThis.fetch) {
|
|
14
15
|
globalThis.fetch = fetch;
|
|
15
16
|
}
|
|
16
17
|
// (!) make changes in pair with backend
|
|
17
|
-
export let apiVersion = '1.
|
|
18
|
+
export let apiVersion = '1.3';
|
|
18
19
|
export let globalConfigDir = '';
|
|
19
20
|
export let globalCacheDir = '';
|
|
20
21
|
// OS specific dirs
|
|
@@ -206,7 +207,7 @@ export function writeConfig(config, configFile = getClosestConfigFile()) {
|
|
|
206
207
|
fs.writeFileSync(configFile, text);
|
|
207
208
|
}
|
|
208
209
|
export function formatDir(name, version) {
|
|
209
|
-
return path.join(getRootDir(), '.mops',
|
|
210
|
+
return path.join(getRootDir(), '.mops', getPackageId(name, version));
|
|
210
211
|
}
|
|
211
212
|
export function formatGithubDir(name, repo) {
|
|
212
213
|
const { branch, commitHash } = parseGithubURL(repo);
|
|
@@ -232,13 +233,13 @@ export async function checkApiCompatibility() {
|
|
|
232
233
|
let backendApiVer = await actor.getApiVersion();
|
|
233
234
|
if (backendApiVer.split('.')[0] !== apiVersion.split('.')[0]) {
|
|
234
235
|
console.log(chalk.red('ERR: ') + `CLI incompatible with backend. CLI v${apiVersion}, Backend v${backendApiVer}`);
|
|
235
|
-
console.log('Run ' + chalk.greenBright('
|
|
236
|
+
console.log('Run ' + chalk.greenBright('mops self update') + ' to upgrade cli.');
|
|
236
237
|
return false;
|
|
237
238
|
}
|
|
238
239
|
else if (backendApiVer.split('.')[1] !== apiVersion.split('.')[1]) {
|
|
239
240
|
console.log('-'.repeat(50));
|
|
240
241
|
console.log(chalk.yellow('WARN: ') + `CLI probably incompatible with backend. CLI v${apiVersion}, Backend v${backendApiVer}`);
|
|
241
|
-
console.log('Recommended to run ' + chalk.greenBright('
|
|
242
|
+
console.log('Recommended to run ' + chalk.greenBright('mops self update') + ' to upgrade cli.');
|
|
242
243
|
console.log('-'.repeat(50));
|
|
243
244
|
}
|
|
244
245
|
return true;
|
package/dist/notify-installs.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { getDependencyType } from './mops.js';
|
|
2
2
|
import { mainActor } from './api/actors.js';
|
|
3
|
+
import { getDepName } from './helpers/get-dep-name.js';
|
|
3
4
|
export async function notifyInstalls(installedDeps) {
|
|
4
|
-
let packages = Object.entries(installedDeps)
|
|
5
|
+
let packages = Object.entries(installedDeps)
|
|
6
|
+
.filter(([_, version]) => getDependencyType(version) === 'mops')
|
|
7
|
+
.map(([name, version]) => [getDepName(name), version]);
|
|
5
8
|
if (packages.length) {
|
|
6
9
|
let actor = await mainActor();
|
|
7
10
|
try {
|
|
8
11
|
await actor.notifyInstalls(packages);
|
|
9
12
|
}
|
|
10
13
|
catch (err) {
|
|
11
|
-
//
|
|
14
|
+
// console.error('Failed to notify installs:', err);
|
|
12
15
|
}
|
|
13
16
|
}
|
|
14
17
|
}
|
package/dist/package.json
CHANGED
package/dist/pem.js
CHANGED
|
@@ -22,7 +22,7 @@ function decode(rawKey) {
|
|
|
22
22
|
if (buf.length != 85) {
|
|
23
23
|
throw 'expecting byte length 85 but got ' + buf.length;
|
|
24
24
|
}
|
|
25
|
-
let secretKey = Buffer.concat([buf.subarray(16, 48)
|
|
25
|
+
let secretKey = Buffer.concat([buf.subarray(16, 48)]);
|
|
26
26
|
return Ed25519KeyIdentity.fromSecretKey(secretKey);
|
|
27
27
|
}
|
|
28
28
|
let algorithm = 'aes-256-ctr';
|
package/dist/vessel.js
CHANGED
|
@@ -133,7 +133,7 @@ export const installFromGithub = async (name, repo, { verbose = false, dep = fal
|
|
|
133
133
|
await downloadFromGithub(repo, cacheDir, progress);
|
|
134
134
|
}
|
|
135
135
|
catch (err) {
|
|
136
|
-
deleteSync([cacheDir]);
|
|
136
|
+
deleteSync([cacheDir], { force: true });
|
|
137
137
|
process.exit(1);
|
|
138
138
|
}
|
|
139
139
|
}
|
package/integrity.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {bytesToHex} from '@noble/hashes/utils';
|
|
|
6
6
|
import {getDependencyType, getRootDir, readConfig} from './mops.js';
|
|
7
7
|
import {mainActor} from './api/actors.js';
|
|
8
8
|
import {resolvePackages} from './resolve-packages.js';
|
|
9
|
+
import {getPackageId} from './helpers/get-package-id.js';
|
|
9
10
|
|
|
10
11
|
type LockFileGeneric = {
|
|
11
12
|
version : number;
|
|
@@ -56,7 +57,7 @@ async function getResolvedMopsPackageIds() : Promise<string[]> {
|
|
|
56
57
|
let resolvedPackages = await resolvePackages();
|
|
57
58
|
let packageIds = Object.entries(resolvedPackages)
|
|
58
59
|
.filter(([_, version]) => getDependencyType(version) === 'mops')
|
|
59
|
-
.map(([name, version]) =>
|
|
60
|
+
.map(([name, version]) => getPackageId(name, version));
|
|
60
61
|
return packageIds;
|
|
61
62
|
}
|
|
62
63
|
|
package/mops.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {Config} from './types.js';
|
|
|
13
13
|
import {mainActor, storageActor} from './api/actors.js';
|
|
14
14
|
import {getNetwork} from './api/network.js';
|
|
15
15
|
import {getHighestVersion} from './api/getHighestVersion.js';
|
|
16
|
+
import {getPackageId} from './helpers/get-package-id.js';
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
if (!globalThis.fetch) {
|
|
@@ -20,7 +21,7 @@ if (!globalThis.fetch) {
|
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
// (!) make changes in pair with backend
|
|
23
|
-
export let apiVersion = '1.
|
|
24
|
+
export let apiVersion = '1.3';
|
|
24
25
|
|
|
25
26
|
export let globalConfigDir = '';
|
|
26
27
|
export let globalCacheDir = '';
|
|
@@ -240,7 +241,7 @@ export function writeConfig(config : Config, configFile = getClosestConfigFile()
|
|
|
240
241
|
}
|
|
241
242
|
|
|
242
243
|
export function formatDir(name : string, version : string) {
|
|
243
|
-
return path.join(getRootDir(), '.mops',
|
|
244
|
+
return path.join(getRootDir(), '.mops', getPackageId(name, version));
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
export function formatGithubDir(name : string, repo : string) {
|
|
@@ -269,13 +270,13 @@ export async function checkApiCompatibility() {
|
|
|
269
270
|
let backendApiVer = await actor.getApiVersion();
|
|
270
271
|
if (backendApiVer.split('.')[0] !== apiVersion.split('.')[0]) {
|
|
271
272
|
console.log(chalk.red('ERR: ') + `CLI incompatible with backend. CLI v${apiVersion}, Backend v${backendApiVer}`);
|
|
272
|
-
console.log('Run ' + chalk.greenBright('
|
|
273
|
+
console.log('Run ' + chalk.greenBright('mops self update') + ' to upgrade cli.');
|
|
273
274
|
return false;
|
|
274
275
|
}
|
|
275
276
|
else if (backendApiVer.split('.')[1] !== apiVersion.split('.')[1]) {
|
|
276
277
|
console.log('-'.repeat(50));
|
|
277
278
|
console.log(chalk.yellow('WARN: ') + `CLI probably incompatible with backend. CLI v${apiVersion}, Backend v${backendApiVer}`);
|
|
278
|
-
console.log('Recommended to run ' + chalk.greenBright('
|
|
279
|
+
console.log('Recommended to run ' + chalk.greenBright('mops self update') + ' to upgrade cli.');
|
|
279
280
|
console.log('-'.repeat(50));
|
|
280
281
|
}
|
|
281
282
|
return true;
|
package/notify-installs.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import {getDependencyType} from './mops.js';
|
|
2
2
|
import {mainActor} from './api/actors.js';
|
|
3
|
+
import {getDepName} from './helpers/get-dep-name.js';
|
|
3
4
|
|
|
4
5
|
export async function notifyInstalls(installedDeps : Record<string, string>) {
|
|
5
|
-
let packages = Object.entries(installedDeps)
|
|
6
|
+
let packages = Object.entries(installedDeps)
|
|
7
|
+
.filter(([_, version]) => getDependencyType(version) === 'mops')
|
|
8
|
+
.map(([name, version]) => [getDepName(name), version] as [string, string]);
|
|
9
|
+
|
|
6
10
|
if (packages.length) {
|
|
7
11
|
let actor = await mainActor();
|
|
8
12
|
|
|
@@ -10,7 +14,7 @@ export async function notifyInstalls(installedDeps : Record<string, string>) {
|
|
|
10
14
|
await actor.notifyInstalls(packages);
|
|
11
15
|
}
|
|
12
16
|
catch (err) {
|
|
13
|
-
//
|
|
17
|
+
// console.error('Failed to notify installs:', err);
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "dist/bin/mops.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"bundle:fix": "npx -y rexreplace 'new URL\\(\"\\.\\./templates' 'new URL(\"./templates' bundle/cli.js",
|
|
30
30
|
"bundle:copy": "cp -r commands/bench bundle && cp -r bin declarations templates package.json bundle",
|
|
31
31
|
"bundle:package-json": "tsx bundle-package-json.ts",
|
|
32
|
-
"bundle:tar": "tar -czvf bundle/cli.tgz bundle",
|
|
32
|
+
"bundle:tar": "tar --exclude bundle/cli.tgz -czvf bundle/cli.tgz bundle",
|
|
33
33
|
"copy": "cp -r commands/bench dist/commands && cp -r declarations templates package.json bin dist | true",
|
|
34
34
|
"prepare": "npm run build && npm run copy && npm run fix-dist",
|
|
35
35
|
"fix-dist": "tsx ./fix-dist.ts",
|
package/pem.ts
CHANGED
|
@@ -24,7 +24,7 @@ function decode(rawKey : Buffer) {
|
|
|
24
24
|
if (buf.length != 85) {
|
|
25
25
|
throw 'expecting byte length 85 but got ' + buf.length;
|
|
26
26
|
}
|
|
27
|
-
let secretKey = Buffer.concat([buf.subarray(16, 48)
|
|
27
|
+
let secretKey = Buffer.concat([buf.subarray(16, 48)]);
|
|
28
28
|
return Ed25519KeyIdentity.fromSecretKey(secretKey);
|
|
29
29
|
}
|
|
30
30
|
|
package/vessel.ts
CHANGED
|
@@ -171,7 +171,7 @@ export const installFromGithub = async (name : string, repo : string, {verbose =
|
|
|
171
171
|
await downloadFromGithub(repo, cacheDir, progress);
|
|
172
172
|
}
|
|
173
173
|
catch (err) {
|
|
174
|
-
deleteSync([cacheDir]);
|
|
174
|
+
deleteSync([cacheDir], {force: true});
|
|
175
175
|
process.exit(1);
|
|
176
176
|
}
|
|
177
177
|
}
|
package/.npmrc
DELETED