ic-mops 0.6.0 → 0.6.2

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/commands/init.js CHANGED
@@ -4,6 +4,7 @@ import fs from 'fs';
4
4
  import {checkApiCompatibility, mainActor, readDfxJson, writeConfig} from '../mops.js';
5
5
  import {installAll} from './install-all.js';
6
6
  import {readVesselConfig} from '../vessel.js';
7
+ import {execSync} from 'child_process';
7
8
 
8
9
  export async function init(name = '') {
9
10
  let configFile = path.join(process.cwd(), 'mops.toml');
@@ -64,6 +65,16 @@ export async function init(name = '') {
64
65
 
65
66
  let dfxJson = readDfxJson();
66
67
  let dfxVersion = dfxJson?.dfx || '';
68
+ if (!dfxVersion) {
69
+ try {
70
+ let res = execSync('dfx --version').toString();
71
+ let match = res.match(/\d+\.\d+\.\d+/);
72
+ if (match) {
73
+ dfxVersion = match[0];
74
+ }
75
+ }
76
+ catch {}
77
+ }
67
78
 
68
79
  let actor = await mainActor();
69
80
  let defaultPackages = await actor.getDefaultPackages(dfxVersion);
@@ -39,6 +39,7 @@ export async function install(pkg, version = '', {verbose, silent, dep} = {}) {
39
39
  }
40
40
  // copy from cache
41
41
  else if (isCached(`${pkg}@${version}`)) {
42
+ actor.notifyInstall(pkg, version);
42
43
  await copyCache(`${pkg}@${version}`, dir);
43
44
  silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (cache)`);
44
45
  }
@@ -58,6 +58,7 @@ type PackageDetails =
58
58
  record {
59
59
  config: PackageConfigV2__1;
60
60
  downloadsInLast30Days: nat;
61
+ downloadsInLast7Days: nat;
61
62
  downloadsTotal: nat;
62
63
  owner: principal;
63
64
  publication: PackagePublication;
@@ -118,6 +119,7 @@ service : {
118
119
  getFileIds: (PackageName__1, Ver) -> (Result_5) query;
119
120
  getHighestVersion: (PackageName__1) -> (Result_4) query;
120
121
  getMostDownloadedPackages: () -> (vec PackageDetails) query;
122
+ getMostDownloadedPackagesIn7Days: () -> (vec PackageDetails) query;
121
123
  getPackageDetails: (PackageName__1, Ver) -> (Result_3) query;
122
124
  getRecentlyUpdatedPackages: () -> (vec PackageDetails) query;
123
125
  getStoragesStats: () -> (vec record {
@@ -48,6 +48,7 @@ export interface PackageDetails {
48
48
  'owner' : Principal,
49
49
  'downloadsTotal' : bigint,
50
50
  'downloadsInLast30Days' : bigint,
51
+ 'downloadsInLast7Days' : bigint,
51
52
  'config' : PackageConfigV2__1,
52
53
  'publication' : PackagePublication,
53
54
  }
@@ -93,6 +94,7 @@ export interface _SERVICE {
93
94
  'getFileIds' : ActorMethod<[PackageName__1, Ver], Result_5>,
94
95
  'getHighestVersion' : ActorMethod<[PackageName__1], Result_4>,
95
96
  'getMostDownloadedPackages' : ActorMethod<[], Array<PackageDetails>>,
97
+ 'getMostDownloadedPackagesIn7Days' : ActorMethod<[], Array<PackageDetails>>,
96
98
  'getPackageDetails' : ActorMethod<[PackageName__1, Ver], Result_3>,
97
99
  'getRecentlyUpdatedPackages' : ActorMethod<[], Array<PackageDetails>>,
98
100
  'getStoragesStats' : ActorMethod<[], Array<[StorageId, StorageStats]>>,
@@ -44,6 +44,7 @@ export const idlFactory = ({ IDL }) => {
44
44
  'owner' : IDL.Principal,
45
45
  'downloadsTotal' : IDL.Nat,
46
46
  'downloadsInLast30Days' : IDL.Nat,
47
+ 'downloadsInLast7Days' : IDL.Nat,
47
48
  'config' : PackageConfigV2__1,
48
49
  'publication' : PackagePublication,
49
50
  });
@@ -90,6 +91,11 @@ export const idlFactory = ({ IDL }) => {
90
91
  [IDL.Vec(PackageDetails)],
91
92
  ['query'],
92
93
  ),
94
+ 'getMostDownloadedPackagesIn7Days' : IDL.Func(
95
+ [],
96
+ [IDL.Vec(PackageDetails)],
97
+ ['query'],
98
+ ),
93
99
  'getPackageDetails' : IDL.Func(
94
100
  [PackageName__1, Ver],
95
101
  [Result_3],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "cli.js"