ic-mops 0.32.2 → 0.33.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/.npmrc ADDED
@@ -0,0 +1 @@
1
+ save-exact = true
package/cli.ts CHANGED
@@ -49,6 +49,7 @@ program
49
49
  .description('Install the package and save it to mops.toml')
50
50
  .option('--dev')
51
51
  .option('--verbose')
52
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
52
53
  .action(async (pkg, options) => {
53
54
  if (!checkConfigFile()) {
54
55
  process.exit(1);
@@ -64,6 +65,7 @@ program
64
65
  .option('--dev', 'Remove from dev-dependencies instead of dependencies')
65
66
  .option('--verbose', 'Show more information')
66
67
  .option('--dry-run', 'Do not actually remove anything')
68
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
67
69
  .action(async (pkg, options) => {
68
70
  if (!checkConfigFile()) {
69
71
  process.exit(1);
@@ -77,6 +79,7 @@ program
77
79
  .alias('i')
78
80
  .description('Install all dependencies specified in mops.toml')
79
81
  .option('--verbose')
82
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'check', 'ignore']))
80
83
  .action(async (pkg, options) => {
81
84
  if (!checkConfigFile()) {
82
85
  process.exit(1);
@@ -151,7 +154,7 @@ program
151
154
  if (!checkConfigFile()) {
152
155
  process.exit(1);
153
156
  }
154
- await installAll({silent: true});
157
+ await installAll({silent: true, lockfile: 'ignore'});
155
158
  let sourcesArr = await sources(options);
156
159
  console.log(sourcesArr.join('\n'));
157
160
  });
@@ -313,8 +316,9 @@ program
313
316
  program
314
317
  .command('sync')
315
318
  .description('Add missing packages and remove unused packages')
316
- .action(async () => {
317
- await sync();
319
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
320
+ .action(async (options) => {
321
+ await sync(options);
318
322
  });
319
323
 
320
324
  // outdated
@@ -329,8 +333,9 @@ program
329
333
  program
330
334
  .command('update [pkg]')
331
335
  .description('Update dependencies specified in mops.toml')
332
- .action(async (pkg) => {
333
- await update(pkg);
336
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
337
+ .action(async (pkg, options) => {
338
+ await update(pkg, options);
334
339
  });
335
340
 
336
341
  // transfer-ownership
package/commands/add.ts CHANGED
@@ -5,8 +5,16 @@ import {checkConfigFile, getGithubCommit, getHighestVersion, parseGithubURL, rea
5
5
  import {installFromGithub} from '../vessel.js';
6
6
  import {install} from './install.js';
7
7
  import {notifyInstalls} from '../notify-installs.js';
8
+ // import {checkIntegrity} from '../integrity.js';
8
9
 
9
- export async function add(name: string, {verbose = false, dev = false} = {}) {
10
+ type AddOptions = {
11
+ verbose?: boolean;
12
+ dev?: boolean;
13
+ lockfile?: 'save' | 'ignore';
14
+ };
15
+
16
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
+ export async function add(name: string, {verbose = false, dev = false, lockfile}: AddOptions = {}) {
10
18
  if (!checkConfigFile()) {
11
19
  return;
12
20
  }
@@ -99,7 +107,12 @@ export async function add(name: string, {verbose = false, dev = false} = {}) {
99
107
  }
100
108
 
101
109
  writeConfig(config);
102
- await notifyInstalls(Object.keys(installedPackages));
110
+
111
+ // logUpdate('Checking integrity...');
112
+ await Promise.all([
113
+ notifyInstalls(Object.keys(installedPackages)),
114
+ // checkIntegrity(lockfile),
115
+ ]);
103
116
 
104
117
  logUpdate.clear();
105
118
  console.log(chalk.green('Package installed ') + `${pkgDetails.name} = "${pkgDetails.repo || pkgDetails.path || pkgDetails.version}"`);
@@ -4,8 +4,15 @@ import {checkConfigFile, readConfig} from '../mops.js';
4
4
  import {install} from './install.js';
5
5
  import {installFromGithub} from '../vessel.js';
6
6
  import {notifyInstalls} from '../notify-installs.js';
7
+ import {checkIntegrity} from '../integrity.js';
7
8
 
8
- export async function installAll({verbose = false, silent = false} = {}) {
9
+ type InstallAllOptions = {
10
+ verbose?: boolean;
11
+ silent?: boolean;
12
+ lockfile?: 'save' | 'check' | 'ignore';
13
+ }
14
+
15
+ export async function installAll({verbose = false, silent = false, lockfile}: InstallAllOptions = {}) {
9
16
  if (!checkConfigFile()) {
10
17
  return;
11
18
  }
@@ -29,7 +36,13 @@ export async function installAll({verbose = false, silent = false} = {}) {
29
36
  }
30
37
  }
31
38
 
32
- await notifyInstalls(Object.keys(installedPackages));
39
+ if (!silent && lockfile !== 'ignore') {
40
+ logUpdate('Checking integrity...');
41
+ }
42
+ await Promise.all([
43
+ notifyInstalls(Object.keys(installedPackages)),
44
+ checkIntegrity(lockfile),
45
+ ]);
33
46
 
34
47
  if (!silent) {
35
48
  logUpdate.clear();
@@ -137,8 +137,8 @@ export async function install(pkg: string, version = '', {verbose = false, silen
137
137
  installedDeps = {...installedDeps, [pkg]: version};
138
138
  }
139
139
 
140
- if (ok) {
141
- return installedDeps;
140
+ if (!ok) {
141
+ return false;
142
142
  }
143
- return false;
143
+ return installedDeps;
144
144
  }
@@ -3,8 +3,17 @@ import {deleteSync} from 'del';
3
3
  import chalk from 'chalk';
4
4
  import {formatDir, formatGithubDir, checkConfigFile, readConfig, writeConfig} from '../mops.js';
5
5
  import {Config, Dependency} from '../types.js';
6
+ // import {checkIntegrity} from '../integrity.js';
6
7
 
7
- export async function remove(name: string, {dev = false, verbose = false, dryRun = false} = {}) {
8
+ type RemoveOptions = {
9
+ verbose?: boolean;
10
+ dev?: boolean;
11
+ dryRun?: boolean;
12
+ lockfile?: 'save' | 'ignore';
13
+ };
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
+ export async function remove(name: string, {dev = false, verbose = false, dryRun = false, lockfile}: RemoveOptions = {}) {
8
17
  if (!checkConfigFile()) {
9
18
  return;
10
19
  }
@@ -91,5 +100,7 @@ export async function remove(name: string, {dev = false, verbose = false, dryRun
91
100
  }
92
101
  dryRun || writeConfig(config);
93
102
 
103
+ // await checkIntegrity(lockfile);
104
+
94
105
  console.log(chalk.green('Package removed ') + `${name} = "${version}"`);
95
106
  }
package/commands/sync.ts CHANGED
@@ -5,6 +5,40 @@ import chalk from 'chalk';
5
5
  import {checkConfigFile, getRootDir, readConfig} from '../mops.js';
6
6
  import {add} from './add.js';
7
7
  import {remove} from './remove.js';
8
+ import {checkIntegrity} from '../integrity.js';
9
+
10
+ type SyncOptions = {
11
+ lockfile?: 'save' | 'ignore';
12
+ };
13
+
14
+ export async function sync({lockfile}: SyncOptions = {}) {
15
+ if (!checkConfigFile()) {
16
+ return;
17
+ }
18
+
19
+ let missing = await getMissingPackages();
20
+ let unused = await getUnusedPackages();
21
+
22
+ missing.length && console.log(`${chalk.yellow('Missing packages:')} ${missing.join(', ')}`);
23
+ unused.length && console.log(`${chalk.yellow('Unused packages:')} ${unused.join(', ')}`);
24
+
25
+ let config = readConfig();
26
+ let deps = new Set(Object.keys(config.dependencies || {}));
27
+ let devDeps = new Set(Object.keys(config['dev-dependencies'] || {}));
28
+
29
+ // add missing packages
30
+ for (let pkg of missing) {
31
+ await add(pkg, {lockfile: 'ignore'});
32
+ }
33
+
34
+ // remove unused packages
35
+ for (let pkg of unused) {
36
+ let dev = devDeps.has(pkg) && !deps.has(pkg);
37
+ await remove(pkg, {dev, lockfile: 'ignore'});
38
+ }
39
+
40
+ await checkIntegrity(lockfile);
41
+ }
8
42
 
9
43
  let ignore = [
10
44
  '**/node_modules/**',
@@ -71,31 +105,4 @@ async function getUnusedPackages(): Promise<string[]> {
71
105
  allDeps.delete(pkg);
72
106
  }
73
107
  return [...allDeps];
74
- }
75
-
76
- export async function sync() {
77
- if (!checkConfigFile()) {
78
- return;
79
- }
80
-
81
- let missing = await getMissingPackages();
82
- let unused = await getUnusedPackages();
83
-
84
- missing.length && console.log(`${chalk.yellow('Missing packages:')} ${missing.join(', ')}`);
85
- unused.length && console.log(`${chalk.yellow('Unused packages:')} ${unused.join(', ')}`);
86
-
87
- let config = readConfig();
88
- let deps = new Set(Object.keys(config.dependencies || {}));
89
- let devDeps = new Set(Object.keys(config['dev-dependencies'] || {}));
90
-
91
- // add missing packages
92
- for (let pkg of missing) {
93
- await add(pkg);
94
- }
95
-
96
- // remove unused packages
97
- for (let pkg of unused) {
98
- let dev = devDeps.has(pkg) && !deps.has(pkg);
99
- await remove(pkg, {dev});
100
- }
101
108
  }
@@ -147,7 +147,13 @@ export async function testWithReporter(reporter: Reporter, filter = '', mode: Te
147
147
  return;
148
148
  }
149
149
  // run
150
- let proc = spawn('wasmtime', ['--max-wasm-stack=2000000', wasmFile]);
150
+ let proc = spawn('wasmtime', [
151
+ '--max-wasm-stack=2000000',
152
+ '--enable-cranelift-nan-canonicalization',
153
+ '--wasm-features',
154
+ 'multi-memory,bulk-memory',
155
+ wasmFile,
156
+ ]);
151
157
  await pipeMMF(proc, mmf);
152
158
  }).finally(() => {
153
159
  fs.rmSync(wasmFile, {force: true});
@@ -2,8 +2,15 @@ import chalk from 'chalk';
2
2
  import {checkConfigFile, getGithubCommit, parseGithubURL, readConfig} from '../mops.js';
3
3
  import {add} from './add.js';
4
4
  import {getAvailableUpdates} from './available-updates.js';
5
+ import {checkIntegrity} from '../integrity.js';
5
6
 
6
- export async function update(pkg?: string) {
7
+ type UpdateOptions = {
8
+ verbose?: boolean;
9
+ dev?: boolean;
10
+ lockfile?: 'save' | 'ignore';
11
+ };
12
+
13
+ export async function update(pkg?: string, {lockfile}: UpdateOptions = {}) {
7
14
  if (!checkConfigFile()) {
8
15
  return;
9
16
  }
@@ -48,4 +55,6 @@ export async function update(pkg?: string) {
48
55
  await add(`${dep[0]}@${dep[2]}`, {dev});
49
56
  }
50
57
  }
58
+
59
+ await checkIntegrity(lockfile);
51
60
  }
@@ -73,6 +73,14 @@ type Script =
73
73
  name: text;
74
74
  value: text;
75
75
  };
76
+ type Result_8 =
77
+ variant {
78
+ err: Err;
79
+ ok: vec record {
80
+ FileId;
81
+ blob;
82
+ };
83
+ };
76
84
  type Result_7 =
77
85
  variant {
78
86
  err: Err;
@@ -145,6 +153,7 @@ type PackageSummary__1 =
145
153
  owner: principal;
146
154
  ownerInfo: User;
147
155
  publication: PackagePublication;
156
+ quality: PackageQuality;
148
157
  };
149
158
  type PackageSummaryWithChanges__1 =
150
159
  record {
@@ -156,6 +165,7 @@ type PackageSummaryWithChanges__1 =
156
165
  owner: principal;
157
166
  ownerInfo: User;
158
167
  publication: PackagePublication;
168
+ quality: PackageQuality;
159
169
  };
160
170
  type PackageSummaryWithChanges =
161
171
  record {
@@ -167,6 +177,7 @@ type PackageSummaryWithChanges =
167
177
  owner: principal;
168
178
  ownerInfo: User;
169
179
  publication: PackagePublication;
180
+ quality: PackageQuality;
170
181
  };
171
182
  type PackageSummary =
172
183
  record {
@@ -177,6 +188,18 @@ type PackageSummary =
177
188
  owner: principal;
178
189
  ownerInfo: User;
179
190
  publication: PackagePublication;
191
+ quality: PackageQuality;
192
+ };
193
+ type PackageQuality =
194
+ record {
195
+ depsStatus: DepsStatus;
196
+ hasDescription: bool;
197
+ hasDocumentation: bool;
198
+ hasKeywords: bool;
199
+ hasLicense: bool;
200
+ hasReleaseNotes: bool;
201
+ hasRepository: bool;
202
+ hasTests: bool;
180
203
  };
181
204
  type PackagePublication =
182
205
  record {
@@ -207,6 +230,7 @@ type PackageDetails =
207
230
  owner: principal;
208
231
  ownerInfo: User;
209
232
  publication: PackagePublication;
233
+ quality: PackageQuality;
210
234
  testStats: TestStats__1;
211
235
  versionHistory: vec PackageSummaryWithChanges__1;
212
236
  };
@@ -281,6 +305,12 @@ type DownloadsSnapshot =
281
305
  endTime: Time;
282
306
  startTime: Time;
283
307
  };
308
+ type DepsStatus =
309
+ variant {
310
+ allLatest;
311
+ tooOld;
312
+ updatesAvailable;
313
+ };
284
314
  type DependencyV2 =
285
315
  record {
286
316
  name: PackageName__1;
@@ -296,6 +326,7 @@ type DepChange =
296
326
  service : {
297
327
  backup: () -> ();
298
328
  claimAirdrop: (principal) -> (text);
329
+ computeHashesForExistingFiles: () -> ();
299
330
  diff: (text, text) -> (PackageChanges__1) query;
300
331
  finishPublish: (PublishingId) -> (Result);
301
332
  getAirdropAmount: () -> (nat) query;
@@ -311,6 +342,15 @@ service : {
311
342
  (vec DownloadsSnapshot__1) query;
312
343
  getDownloadTrendByPackageName: (PackageName) ->
313
344
  (vec DownloadsSnapshot__1) query;
345
+ getFileHashes: (PackageName, PackageVersion) -> (Result_8);
346
+ getFileHashesByPackageIds: (vec PackageId) ->
347
+ (vec record {
348
+ PackageId;
349
+ vec record {
350
+ FileId;
351
+ blob;
352
+ };
353
+ });
314
354
  getFileIds: (PackageName, PackageVersion) -> (Result_7) query;
315
355
  getHighestSemverBatch:
316
356
  (vec record {
@@ -11,6 +11,9 @@ export interface DependencyV2 {
11
11
  'repo' : string,
12
12
  'version' : string,
13
13
  }
14
+ export type DepsStatus = { 'allLatest' : null } |
15
+ { 'tooOld' : null } |
16
+ { 'updatesAvailable' : null };
14
17
  export interface DownloadsSnapshot {
15
18
  'startTime' : Time,
16
19
  'endTime' : Time,
@@ -76,6 +79,7 @@ export interface PackageDetails {
76
79
  'ownerInfo' : User,
77
80
  'owner' : Principal,
78
81
  'deps' : Array<PackageSummary__1>,
82
+ 'quality' : PackageQuality,
79
83
  'testStats' : TestStats__1,
80
84
  'downloadsTotal' : bigint,
81
85
  'downloadsInLast30Days' : bigint,
@@ -101,9 +105,20 @@ export interface PackagePublication {
101
105
  'time' : Time,
102
106
  'user' : Principal,
103
107
  }
108
+ export interface PackageQuality {
109
+ 'depsStatus' : DepsStatus,
110
+ 'hasDescription' : boolean,
111
+ 'hasKeywords' : boolean,
112
+ 'hasLicense' : boolean,
113
+ 'hasDocumentation' : boolean,
114
+ 'hasTests' : boolean,
115
+ 'hasRepository' : boolean,
116
+ 'hasReleaseNotes' : boolean,
117
+ }
104
118
  export interface PackageSummary {
105
119
  'ownerInfo' : User,
106
120
  'owner' : Principal,
121
+ 'quality' : PackageQuality,
107
122
  'downloadsTotal' : bigint,
108
123
  'downloadsInLast30Days' : bigint,
109
124
  'downloadsInLast7Days' : bigint,
@@ -113,6 +128,7 @@ export interface PackageSummary {
113
128
  export interface PackageSummaryWithChanges {
114
129
  'ownerInfo' : User,
115
130
  'owner' : Principal,
131
+ 'quality' : PackageQuality,
116
132
  'downloadsTotal' : bigint,
117
133
  'downloadsInLast30Days' : bigint,
118
134
  'downloadsInLast7Days' : bigint,
@@ -123,6 +139,7 @@ export interface PackageSummaryWithChanges {
123
139
  export interface PackageSummaryWithChanges__1 {
124
140
  'ownerInfo' : User,
125
141
  'owner' : Principal,
142
+ 'quality' : PackageQuality,
126
143
  'downloadsTotal' : bigint,
127
144
  'downloadsInLast30Days' : bigint,
128
145
  'downloadsInLast7Days' : bigint,
@@ -133,6 +150,7 @@ export interface PackageSummaryWithChanges__1 {
133
150
  export interface PackageSummary__1 {
134
151
  'ownerInfo' : User,
135
152
  'owner' : Principal,
153
+ 'quality' : PackageQuality,
136
154
  'downloadsTotal' : bigint,
137
155
  'downloadsInLast30Days' : bigint,
138
156
  'downloadsInLast7Days' : bigint,
@@ -173,6 +191,8 @@ export type Result_6 = { 'ok' : Array<[PackageName, PackageVersion]> } |
173
191
  { 'err' : Err };
174
192
  export type Result_7 = { 'ok' : Array<FileId> } |
175
193
  { 'err' : Err };
194
+ export type Result_8 = { 'ok' : Array<[FileId, Uint8Array | number[]]> } |
195
+ { 'err' : Err };
176
196
  export interface Script { 'value' : string, 'name' : string }
177
197
  export type SemverPart = { 'major' : null } |
178
198
  { 'minor' : null } |
@@ -233,6 +253,7 @@ export interface User__1 {
233
253
  export interface _SERVICE {
234
254
  'backup' : ActorMethod<[], undefined>,
235
255
  'claimAirdrop' : ActorMethod<[Principal], string>,
256
+ 'computeHashesForExistingFiles' : ActorMethod<[], undefined>,
236
257
  'diff' : ActorMethod<[string, string], PackageChanges__1>,
237
258
  'finishPublish' : ActorMethod<[PublishingId], Result>,
238
259
  'getAirdropAmount' : ActorMethod<[], bigint>,
@@ -251,6 +272,11 @@ export interface _SERVICE {
251
272
  [PackageName],
252
273
  Array<DownloadsSnapshot__1>
253
274
  >,
275
+ 'getFileHashes' : ActorMethod<[PackageName, PackageVersion], Result_8>,
276
+ 'getFileHashesByPackageIds' : ActorMethod<
277
+ [Array<PackageId>],
278
+ Array<[PackageId, Array<[FileId, Uint8Array | number[]]>]>
279
+ >,
254
280
  'getFileIds' : ActorMethod<[PackageName, PackageVersion], Result_7>,
255
281
  'getHighestSemverBatch' : ActorMethod<
256
282
  [Array<[PackageName, PackageVersion, SemverPart]>],
@@ -28,6 +28,10 @@ export const idlFactory = ({ IDL }) => {
28
28
  'downloads' : IDL.Nat,
29
29
  });
30
30
  const FileId = IDL.Text;
31
+ const Result_8 = IDL.Variant({
32
+ 'ok' : IDL.Vec(IDL.Tuple(FileId, IDL.Vec(IDL.Nat8))),
33
+ 'err' : Err,
34
+ });
31
35
  const Result_7 = IDL.Variant({ 'ok' : IDL.Vec(FileId), 'err' : Err });
32
36
  const SemverPart = IDL.Variant({
33
37
  'major' : IDL.Null,
@@ -51,6 +55,21 @@ export const idlFactory = ({ IDL }) => {
51
55
  'githubVerified' : IDL.Bool,
52
56
  'github' : IDL.Text,
53
57
  });
58
+ const DepsStatus = IDL.Variant({
59
+ 'allLatest' : IDL.Null,
60
+ 'tooOld' : IDL.Null,
61
+ 'updatesAvailable' : IDL.Null,
62
+ });
63
+ const PackageQuality = IDL.Record({
64
+ 'depsStatus' : DepsStatus,
65
+ 'hasDescription' : IDL.Bool,
66
+ 'hasKeywords' : IDL.Bool,
67
+ 'hasLicense' : IDL.Bool,
68
+ 'hasDocumentation' : IDL.Bool,
69
+ 'hasTests' : IDL.Bool,
70
+ 'hasRepository' : IDL.Bool,
71
+ 'hasReleaseNotes' : IDL.Bool,
72
+ });
54
73
  const Script = IDL.Record({ 'value' : IDL.Text, 'name' : IDL.Text });
55
74
  const PackageName__1 = IDL.Text;
56
75
  const DependencyV2 = IDL.Record({
@@ -84,6 +103,7 @@ export const idlFactory = ({ IDL }) => {
84
103
  const PackageSummary = IDL.Record({
85
104
  'ownerInfo' : User,
86
105
  'owner' : IDL.Principal,
106
+ 'quality' : PackageQuality,
87
107
  'downloadsTotal' : IDL.Nat,
88
108
  'downloadsInLast30Days' : IDL.Nat,
89
109
  'downloadsInLast7Days' : IDL.Nat,
@@ -93,6 +113,7 @@ export const idlFactory = ({ IDL }) => {
93
113
  const PackageSummary__1 = IDL.Record({
94
114
  'ownerInfo' : User,
95
115
  'owner' : IDL.Principal,
116
+ 'quality' : PackageQuality,
96
117
  'downloadsTotal' : IDL.Nat,
97
118
  'downloadsInLast30Days' : IDL.Nat,
98
119
  'downloadsInLast7Days' : IDL.Nat,
@@ -121,6 +142,7 @@ export const idlFactory = ({ IDL }) => {
121
142
  const PackageSummaryWithChanges__1 = IDL.Record({
122
143
  'ownerInfo' : User,
123
144
  'owner' : IDL.Principal,
145
+ 'quality' : PackageQuality,
124
146
  'downloadsTotal' : IDL.Nat,
125
147
  'downloadsInLast30Days' : IDL.Nat,
126
148
  'downloadsInLast7Days' : IDL.Nat,
@@ -132,6 +154,7 @@ export const idlFactory = ({ IDL }) => {
132
154
  'ownerInfo' : User,
133
155
  'owner' : IDL.Principal,
134
156
  'deps' : IDL.Vec(PackageSummary__1),
157
+ 'quality' : PackageQuality,
135
158
  'testStats' : TestStats__1,
136
159
  'downloadsTotal' : IDL.Nat,
137
160
  'downloadsInLast30Days' : IDL.Nat,
@@ -149,6 +172,7 @@ export const idlFactory = ({ IDL }) => {
149
172
  const PackageSummaryWithChanges = IDL.Record({
150
173
  'ownerInfo' : User,
151
174
  'owner' : IDL.Principal,
175
+ 'quality' : PackageQuality,
152
176
  'downloadsTotal' : IDL.Nat,
153
177
  'downloadsInLast30Days' : IDL.Nat,
154
178
  'downloadsInLast7Days' : IDL.Nat,
@@ -235,6 +259,7 @@ export const idlFactory = ({ IDL }) => {
235
259
  return IDL.Service({
236
260
  'backup' : IDL.Func([], [], []),
237
261
  'claimAirdrop' : IDL.Func([IDL.Principal], [IDL.Text], []),
262
+ 'computeHashesForExistingFiles' : IDL.Func([], [], []),
238
263
  'diff' : IDL.Func([IDL.Text, IDL.Text], [PackageChanges__1], ['query']),
239
264
  'finishPublish' : IDL.Func([PublishingId], [Result], []),
240
265
  'getAirdropAmount' : IDL.Func([], [IDL.Nat], ['query']),
@@ -256,6 +281,16 @@ export const idlFactory = ({ IDL }) => {
256
281
  [IDL.Vec(DownloadsSnapshot__1)],
257
282
  ['query'],
258
283
  ),
284
+ 'getFileHashes' : IDL.Func([PackageName, PackageVersion], [Result_8], []),
285
+ 'getFileHashesByPackageIds' : IDL.Func(
286
+ [IDL.Vec(PackageId)],
287
+ [
288
+ IDL.Vec(
289
+ IDL.Tuple(PackageId, IDL.Vec(IDL.Tuple(FileId, IDL.Vec(IDL.Nat8))))
290
+ ),
291
+ ],
292
+ [],
293
+ ),
259
294
  'getFileIds' : IDL.Func(
260
295
  [PackageName, PackageVersion],
261
296
  [Result_7],
package/dist/cli.js CHANGED
@@ -43,6 +43,7 @@ program
43
43
  .description('Install the package and save it to mops.toml')
44
44
  .option('--dev')
45
45
  .option('--verbose')
46
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
46
47
  .action(async (pkg, options) => {
47
48
  if (!checkConfigFile()) {
48
49
  process.exit(1);
@@ -57,6 +58,7 @@ program
57
58
  .option('--dev', 'Remove from dev-dependencies instead of dependencies')
58
59
  .option('--verbose', 'Show more information')
59
60
  .option('--dry-run', 'Do not actually remove anything')
61
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
60
62
  .action(async (pkg, options) => {
61
63
  if (!checkConfigFile()) {
62
64
  process.exit(1);
@@ -69,6 +71,7 @@ program
69
71
  .alias('i')
70
72
  .description('Install all dependencies specified in mops.toml')
71
73
  .option('--verbose')
74
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'check', 'ignore']))
72
75
  .action(async (pkg, options) => {
73
76
  if (!checkConfigFile()) {
74
77
  process.exit(1);
@@ -136,7 +139,7 @@ program
136
139
  if (!checkConfigFile()) {
137
140
  process.exit(1);
138
141
  }
139
- await installAll({ silent: true });
142
+ await installAll({ silent: true, lockfile: 'ignore' });
140
143
  let sourcesArr = await sources(options);
141
144
  console.log(sourcesArr.join('\n'));
142
145
  });
@@ -286,8 +289,9 @@ program
286
289
  program
287
290
  .command('sync')
288
291
  .description('Add missing packages and remove unused packages')
289
- .action(async () => {
290
- await sync();
292
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
293
+ .action(async (options) => {
294
+ await sync(options);
291
295
  });
292
296
  // outdated
293
297
  program
@@ -300,8 +304,9 @@ program
300
304
  program
301
305
  .command('update [pkg]')
302
306
  .description('Update dependencies specified in mops.toml')
303
- .action(async (pkg) => {
304
- await update(pkg);
307
+ .addOption(new Option('--lockfile <lockfile>', 'Lockfile action').choices(['save', 'ignore']))
308
+ .action(async (pkg, options) => {
309
+ await update(pkg, options);
305
310
  });
306
311
  // transfer-ownership
307
312
  program
@@ -1,4 +1,7 @@
1
- export declare function add(name: string, { verbose, dev }?: {
2
- verbose?: boolean | undefined;
3
- dev?: boolean | undefined;
4
- }): Promise<void>;
1
+ type AddOptions = {
2
+ verbose?: boolean;
3
+ dev?: boolean;
4
+ lockfile?: 'save' | 'ignore';
5
+ };
6
+ export declare function add(name: string, { verbose, dev, lockfile }?: AddOptions): Promise<void>;
7
+ export {};
@@ -5,7 +5,8 @@ import { checkConfigFile, getGithubCommit, getHighestVersion, parseGithubURL, re
5
5
  import { installFromGithub } from '../vessel.js';
6
6
  import { install } from './install.js';
7
7
  import { notifyInstalls } from '../notify-installs.js';
8
- export async function add(name, { verbose = false, dev = false } = {}) {
8
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
+ export async function add(name, { verbose = false, dev = false, lockfile } = {}) {
9
10
  if (!checkConfigFile()) {
10
11
  return;
11
12
  }
@@ -88,7 +89,11 @@ export async function add(name, { verbose = false, dev = false } = {}) {
88
89
  throw Error(`Invalid config file: [${depsProp}] not found`);
89
90
  }
90
91
  writeConfig(config);
91
- await notifyInstalls(Object.keys(installedPackages));
92
+ // logUpdate('Checking integrity...');
93
+ await Promise.all([
94
+ notifyInstalls(Object.keys(installedPackages)),
95
+ // checkIntegrity(lockfile),
96
+ ]);
92
97
  logUpdate.clear();
93
98
  console.log(chalk.green('Package installed ') + `${pkgDetails.name} = "${pkgDetails.repo || pkgDetails.path || pkgDetails.version}"`);
94
99
  }
@@ -1,4 +1,7 @@
1
- export declare function installAll({ verbose, silent }?: {
2
- verbose?: boolean | undefined;
3
- silent?: boolean | undefined;
4
- }): Promise<void>;
1
+ type InstallAllOptions = {
2
+ verbose?: boolean;
3
+ silent?: boolean;
4
+ lockfile?: 'save' | 'check' | 'ignore';
5
+ };
6
+ export declare function installAll({ verbose, silent, lockfile }?: InstallAllOptions): Promise<void>;
7
+ export {};