ic-mops 0.26.2 → 0.26.4

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/sync.ts CHANGED
@@ -11,8 +11,6 @@ let ignore = [
11
11
  '**/.vessel/**',
12
12
  '**/.git/**',
13
13
  '**/.mops/**',
14
- '**/test/**',
15
- '**/*.test.mo',
16
14
  ];
17
15
 
18
16
  let mocPath = '';
@@ -67,7 +65,7 @@ async function getMissingPackages(): Promise<string[]> {
67
65
 
68
66
  async function getUnusedPackages(): Promise<string[]> {
69
67
  let config = readConfig();
70
- let allDeps = new Set([...Object.keys(config.dependencies || {})]);
68
+ let allDeps = new Set([...Object.keys(config.dependencies || {}), ...Object.keys(config['dev-dependencies'] || {})]);
71
69
  let used = await getUsedPackages();
72
70
  for (let pkg of used) {
73
71
  allDeps.delete(pkg);
@@ -86,6 +84,10 @@ export async function sync() {
86
84
  missing.length && console.log(`${chalk.yellow('Missing packages:')} ${missing.join(', ')}`);
87
85
  unused.length && console.log(`${chalk.yellow('Unused packages:')} ${unused.join(', ')}`);
88
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
+
89
91
  // add missing packages
90
92
  for (let pkg of missing) {
91
93
  await add(pkg);
@@ -93,6 +95,7 @@ export async function sync() {
93
95
 
94
96
  // remove unused packages
95
97
  for (let pkg of unused) {
96
- await remove(pkg);
98
+ let dev = devDeps.has(pkg) && !deps.has(pkg);
99
+ await remove(pkg, {dev});
97
100
  }
98
101
  }
@@ -130,6 +130,11 @@ type PackagePublication =
130
130
  type PackageName__1 = text;
131
131
  type PackageName = text;
132
132
  type PackageId = text;
133
+ type PackageFileStatsPublic =
134
+ record {
135
+ sourceFiles: nat;
136
+ sourceSize: nat;
137
+ };
133
138
  type PackageDetails =
134
139
  record {
135
140
  config: PackageConfigV2__1;
@@ -140,6 +145,7 @@ type PackageDetails =
140
145
  downloadsInLast30Days: nat;
141
146
  downloadsInLast7Days: nat;
142
147
  downloadsTotal: nat;
148
+ fileStats: PackageFileStatsPublic;
143
149
  owner: principal;
144
150
  ownerInfo: User;
145
151
  publication: PackagePublication;
@@ -62,6 +62,7 @@ export interface PackageDetails {
62
62
  'downloadsTotal' : bigint,
63
63
  'downloadsInLast30Days' : bigint,
64
64
  'downloadTrend' : Array<DownloadsSnapshot>,
65
+ 'fileStats' : PackageFileStatsPublic,
65
66
  'versionHistory' : Array<PackageSummary__1>,
66
67
  'dependents' : Array<PackageSummary__1>,
67
68
  'devDeps' : Array<PackageSummary__1>,
@@ -69,6 +70,10 @@ export interface PackageDetails {
69
70
  'config' : PackageConfigV2__1,
70
71
  'publication' : PackagePublication,
71
72
  }
73
+ export interface PackageFileStatsPublic {
74
+ 'sourceFiles' : bigint,
75
+ 'sourceSize' : bigint,
76
+ }
72
77
  export type PackageId = string;
73
78
  export type PackageName = string;
74
79
  export type PackageName__1 = string;
@@ -93,6 +93,10 @@ export const idlFactory = ({ IDL }) => {
93
93
  'endTime' : Time,
94
94
  'downloads' : IDL.Nat,
95
95
  });
96
+ const PackageFileStatsPublic = IDL.Record({
97
+ 'sourceFiles' : IDL.Nat,
98
+ 'sourceSize' : IDL.Nat,
99
+ });
96
100
  const PackageDetails = IDL.Record({
97
101
  'ownerInfo' : User,
98
102
  'owner' : IDL.Principal,
@@ -101,6 +105,7 @@ export const idlFactory = ({ IDL }) => {
101
105
  'downloadsTotal' : IDL.Nat,
102
106
  'downloadsInLast30Days' : IDL.Nat,
103
107
  'downloadTrend' : IDL.Vec(DownloadsSnapshot),
108
+ 'fileStats' : PackageFileStatsPublic,
104
109
  'versionHistory' : IDL.Vec(PackageSummary__1),
105
110
  'dependents' : IDL.Vec(PackageSummary__1),
106
111
  'devDeps' : IDL.Vec(PackageSummary__1),
@@ -10,8 +10,6 @@ let ignore = [
10
10
  '**/.vessel/**',
11
11
  '**/.git/**',
12
12
  '**/.mops/**',
13
- '**/test/**',
14
- '**/*.test.mo',
15
13
  ];
16
14
  let mocPath = '';
17
15
  function getMocPath() {
@@ -58,7 +56,7 @@ async function getMissingPackages() {
58
56
  }
59
57
  async function getUnusedPackages() {
60
58
  let config = readConfig();
61
- let allDeps = new Set([...Object.keys(config.dependencies || {})]);
59
+ let allDeps = new Set([...Object.keys(config.dependencies || {}), ...Object.keys(config['dev-dependencies'] || {})]);
62
60
  let used = await getUsedPackages();
63
61
  for (let pkg of used) {
64
62
  allDeps.delete(pkg);
@@ -73,12 +71,16 @@ export async function sync() {
73
71
  let unused = await getUnusedPackages();
74
72
  missing.length && console.log(`${chalk.yellow('Missing packages:')} ${missing.join(', ')}`);
75
73
  unused.length && console.log(`${chalk.yellow('Unused packages:')} ${unused.join(', ')}`);
74
+ let config = readConfig();
75
+ let deps = new Set(Object.keys(config.dependencies || {}));
76
+ let devDeps = new Set(Object.keys(config['dev-dependencies'] || {}));
76
77
  // add missing packages
77
78
  for (let pkg of missing) {
78
79
  await add(pkg);
79
80
  }
80
81
  // remove unused packages
81
82
  for (let pkg of unused) {
82
- await remove(pkg);
83
+ let dev = devDeps.has(pkg) && !deps.has(pkg);
84
+ await remove(pkg, { dev });
83
85
  }
84
86
  }
@@ -130,6 +130,11 @@ type PackagePublication =
130
130
  type PackageName__1 = text;
131
131
  type PackageName = text;
132
132
  type PackageId = text;
133
+ type PackageFileStatsPublic =
134
+ record {
135
+ sourceFiles: nat;
136
+ sourceSize: nat;
137
+ };
133
138
  type PackageDetails =
134
139
  record {
135
140
  config: PackageConfigV2__1;
@@ -140,6 +145,7 @@ type PackageDetails =
140
145
  downloadsInLast30Days: nat;
141
146
  downloadsInLast7Days: nat;
142
147
  downloadsTotal: nat;
148
+ fileStats: PackageFileStatsPublic;
143
149
  owner: principal;
144
150
  ownerInfo: User;
145
151
  publication: PackagePublication;
@@ -62,6 +62,7 @@ export interface PackageDetails {
62
62
  'downloadsTotal' : bigint,
63
63
  'downloadsInLast30Days' : bigint,
64
64
  'downloadTrend' : Array<DownloadsSnapshot>,
65
+ 'fileStats' : PackageFileStatsPublic,
65
66
  'versionHistory' : Array<PackageSummary__1>,
66
67
  'dependents' : Array<PackageSummary__1>,
67
68
  'devDeps' : Array<PackageSummary__1>,
@@ -69,6 +70,10 @@ export interface PackageDetails {
69
70
  'config' : PackageConfigV2__1,
70
71
  'publication' : PackagePublication,
71
72
  }
73
+ export interface PackageFileStatsPublic {
74
+ 'sourceFiles' : bigint,
75
+ 'sourceSize' : bigint,
76
+ }
72
77
  export type PackageId = string;
73
78
  export type PackageName = string;
74
79
  export type PackageName__1 = string;
@@ -93,6 +93,10 @@ export const idlFactory = ({ IDL }) => {
93
93
  'endTime' : Time,
94
94
  'downloads' : IDL.Nat,
95
95
  });
96
+ const PackageFileStatsPublic = IDL.Record({
97
+ 'sourceFiles' : IDL.Nat,
98
+ 'sourceSize' : IDL.Nat,
99
+ });
96
100
  const PackageDetails = IDL.Record({
97
101
  'ownerInfo' : User,
98
102
  'owner' : IDL.Principal,
@@ -101,6 +105,7 @@ export const idlFactory = ({ IDL }) => {
101
105
  'downloadsTotal' : IDL.Nat,
102
106
  'downloadsInLast30Days' : IDL.Nat,
103
107
  'downloadTrend' : IDL.Vec(DownloadsSnapshot),
108
+ 'fileStats' : PackageFileStatsPublic,
104
109
  'versionHistory' : IDL.Vec(PackageSummary__1),
105
110
  'dependents' : IDL.Vec(PackageSummary__1),
106
111
  'devDeps' : IDL.Vec(PackageSummary__1),
package/dist/mops.js CHANGED
@@ -16,7 +16,7 @@ if (!global.fetch) {
16
16
  export let apiVersion = '1.2';
17
17
  let networkFile = '';
18
18
  try {
19
- networkFile = new URL('./network.txt', import.meta.url).toString();
19
+ networkFile = new URL('./network.txt', import.meta.url);
20
20
  }
21
21
  catch {
22
22
  networkFile = path.join(__dirname, 'network.txt');
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.26.2",
3
+ "version": "0.26.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/cli.js"
@@ -0,0 +1 @@
1
+ export {};