ic-mops 0.37.3 → 0.37.5

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.
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import fs from 'node:fs';
4
4
  import {execaCommand} from 'execa';
5
5
  import {PocketIc} from 'pic-ic';
6
- import {getRootDir} from '../mops.js';
6
+ import {getRootDir, readConfig} from '../mops.js';
7
7
  import {createActor, idlFactory} from '../declarations/bench/index.js';
8
8
  import {toolchain} from './toolchain/index.js';
9
9
 
@@ -29,6 +29,11 @@ export class BenchReplica {
29
29
  }
30
30
  else {
31
31
  let pocketIcBin = await toolchain.bin('pocket-ic');
32
+ let config = readConfig();
33
+ if (config.toolchain?.['pocket-ic'] !== '1.0.0') {
34
+ console.error('Currently only pocket-ic 1.0.0 is supported');
35
+ process.exit(1);
36
+ }
32
37
  this.pocketIc = await PocketIc.create(pocketIcBin);
33
38
  }
34
39
  }
@@ -29,7 +29,7 @@ export async function publish(options: {docs?: boolean, test?: boolean} = {}) {
29
29
 
30
30
  // validate
31
31
  for (let key of Object.keys(config)) {
32
- if (!['package', 'dependencies', 'dev-dependencies', 'scripts'].includes(key)) {
32
+ if (!['package', 'dependencies', 'dev-dependencies', 'toolchain'].includes(key)) {
33
33
  console.log(chalk.red('Error: ') + `Unknown config section [${key}]`);
34
34
  process.exit(1);
35
35
  }
@@ -134,7 +134,18 @@ async function init({reset = false, silent = false} = {}) {
134
134
 
135
135
  async function download(tool: Tool, version: string, {silent = false, verbose = false} = {}) {
136
136
  let toolUtils = getToolUtils(tool);
137
+ let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
138
+
139
+ silent || logUpdate('Installing', tool, version);
140
+
137
141
  await toolUtils.download(version, {silent, verbose});
142
+
143
+ if (verbose) {
144
+ logUpdate.done();
145
+ }
146
+ else if (!silent) {
147
+ logUpdate.clear();
148
+ }
138
149
  }
139
150
 
140
151
  async function installAll({silent = false, verbose = false} = {}) {
@@ -161,16 +172,13 @@ async function installAll({silent = false, verbose = false} = {}) {
161
172
  log('Installing toolchain...');
162
173
 
163
174
  if (config.toolchain?.moc) {
164
- log('Installing moc', config.toolchain.moc);
165
- await download('moc', config.toolchain.moc, {verbose});
175
+ await download('moc', config.toolchain.moc, {silent, verbose});
166
176
  }
167
177
  if (config.toolchain?.wasmtime) {
168
- log('Installing wasmtime', config.toolchain.wasmtime);
169
- await download('wasmtime', config.toolchain.wasmtime, {verbose});
178
+ await download('wasmtime', config.toolchain.wasmtime, {silent, verbose});
170
179
  }
171
180
  if (config.toolchain?.['pocket-ic']) {
172
- log('Installing pocket-ic', config.toolchain['pocket-ic']);
173
- await download('pocket-ic', config.toolchain['pocket-ic'], {verbose});
181
+ await download('pocket-ic', config.toolchain['pocket-ic'], {silent, verbose});
174
182
  }
175
183
 
176
184
  if (!silent) {
@@ -16,16 +16,16 @@ export let getLatestReleaseTag = async () => {
16
16
  export let getReleases = async () => {
17
17
  // return toolchainUtils.getReleases(repo);
18
18
  return [
19
- // {
20
- // tag_name: '2.0.1',
21
- // published_at: new Date('2023-11-23'),
22
- // draft: false,
23
- // },
24
- // {
25
- // tag_name: '2.0.0',
26
- // published_at: new Date('2023-11-21'),
27
- // draft: false,
28
- // },
19
+ {
20
+ tag_name: '2.0.1',
21
+ published_at: new Date('2023-11-23'),
22
+ draft: false,
23
+ },
24
+ {
25
+ tag_name: '2.0.0',
26
+ published_at: new Date('2023-11-21'),
27
+ draft: false,
28
+ },
29
29
  {
30
30
  tag_name: '1.0.0',
31
31
  published_at: new Date('2023-10-12'),
@@ -44,10 +44,6 @@ export let download = async (version: string, {silent = false, verbose = false}
44
44
  console.error('version is not defined');
45
45
  process.exit(1);
46
46
  }
47
- if (version !== '1.0.0') {
48
- console.error('Currently only pocket-ic 1.0.0 is supported');
49
- process.exit(1);
50
- }
51
47
  if (isCached(version)) {
52
48
  if (verbose) {
53
49
  console.log(`pocket-ic ${version} is already installed`);
@@ -59,8 +55,8 @@ export let download = async (version: string, {silent = false, verbose = false}
59
55
  let arch = 'x86_64';
60
56
 
61
57
  let hashes: Record<string, string> = {
62
- // '2.0.1': '69e1408347723dbaa7a6cd2faa9b65c42abbe861',
63
- // '2.0.0': '29ec86dc9f9ca4691d4d4386c8b2aa41e14d9d16',
58
+ '2.0.1': '69e1408347723dbaa7a6cd2faa9b65c42abbe861',
59
+ '2.0.0': '29ec86dc9f9ca4691d4d4386c8b2aa41e14d9d16',
64
60
  '1.0.0': '307d5847c1d2fe1f5e19181c7d0fcec23f4658b3',
65
61
  };
66
62
 
@@ -3,7 +3,7 @@ import path from 'node:path';
3
3
  import fs from 'node:fs';
4
4
  import { execaCommand } from 'execa';
5
5
  import { PocketIc } from 'pic-ic';
6
- import { getRootDir } from '../mops.js';
6
+ import { getRootDir, readConfig } from '../mops.js';
7
7
  import { createActor, idlFactory } from '../declarations/bench/index.js';
8
8
  import { toolchain } from './toolchain/index.js';
9
9
  export class BenchReplica {
@@ -23,6 +23,11 @@ export class BenchReplica {
23
23
  }
24
24
  else {
25
25
  let pocketIcBin = await toolchain.bin('pocket-ic');
26
+ let config = readConfig();
27
+ if (config.toolchain?.['pocket-ic'] !== '1.0.0') {
28
+ console.error('Currently only pocket-ic 1.0.0 is supported');
29
+ process.exit(1);
30
+ }
26
31
  this.pocketIc = await PocketIc.create(pocketIcBin);
27
32
  }
28
33
  }
@@ -22,7 +22,7 @@ export async function publish(options = {}) {
22
22
  console.log(`Publishing ${config.package?.name}@${config.package?.version}`);
23
23
  // validate
24
24
  for (let key of Object.keys(config)) {
25
- if (!['package', 'dependencies', 'dev-dependencies', 'scripts'].includes(key)) {
25
+ if (!['package', 'dependencies', 'dev-dependencies', 'toolchain'].includes(key)) {
26
26
  console.log(chalk.red('Error: ') + `Unknown config section [${key}]`);
27
27
  process.exit(1);
28
28
  }
@@ -115,7 +115,15 @@ async function init({ reset = false, silent = false } = {}) {
115
115
  }
116
116
  async function download(tool, version, { silent = false, verbose = false } = {}) {
117
117
  let toolUtils = getToolUtils(tool);
118
+ let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
119
+ silent || logUpdate('Installing', tool, version);
118
120
  await toolUtils.download(version, { silent, verbose });
121
+ if (verbose) {
122
+ logUpdate.done();
123
+ }
124
+ else if (!silent) {
125
+ logUpdate.clear();
126
+ }
119
127
  }
120
128
  async function installAll({ silent = false, verbose = false } = {}) {
121
129
  let config = readConfig();
@@ -136,16 +144,13 @@ async function installAll({ silent = false, verbose = false } = {}) {
136
144
  };
137
145
  log('Installing toolchain...');
138
146
  if (config.toolchain?.moc) {
139
- log('Installing moc', config.toolchain.moc);
140
- await download('moc', config.toolchain.moc, { verbose });
147
+ await download('moc', config.toolchain.moc, { silent, verbose });
141
148
  }
142
149
  if (config.toolchain?.wasmtime) {
143
- log('Installing wasmtime', config.toolchain.wasmtime);
144
- await download('wasmtime', config.toolchain.wasmtime, { verbose });
150
+ await download('wasmtime', config.toolchain.wasmtime, { silent, verbose });
145
151
  }
146
152
  if (config.toolchain?.['pocket-ic']) {
147
- log('Installing pocket-ic', config.toolchain['pocket-ic']);
148
- await download('pocket-ic', config.toolchain['pocket-ic'], { verbose });
153
+ await download('pocket-ic', config.toolchain['pocket-ic'], { silent, verbose });
149
154
  }
150
155
  if (!silent) {
151
156
  logUpdate.clear();
@@ -11,16 +11,16 @@ export let getLatestReleaseTag = async () => {
11
11
  export let getReleases = async () => {
12
12
  // return toolchainUtils.getReleases(repo);
13
13
  return [
14
- // {
15
- // tag_name: '2.0.1',
16
- // published_at: new Date('2023-11-23'),
17
- // draft: false,
18
- // },
19
- // {
20
- // tag_name: '2.0.0',
21
- // published_at: new Date('2023-11-21'),
22
- // draft: false,
23
- // },
14
+ {
15
+ tag_name: '2.0.1',
16
+ published_at: new Date('2023-11-23'),
17
+ draft: false,
18
+ },
19
+ {
20
+ tag_name: '2.0.0',
21
+ published_at: new Date('2023-11-21'),
22
+ draft: false,
23
+ },
24
24
  {
25
25
  tag_name: '1.0.0',
26
26
  published_at: new Date('2023-10-12'),
@@ -37,10 +37,6 @@ export let download = async (version, { silent = false, verbose = false } = {})
37
37
  console.error('version is not defined');
38
38
  process.exit(1);
39
39
  }
40
- if (version !== '1.0.0') {
41
- console.error('Currently only pocket-ic 1.0.0 is supported');
42
- process.exit(1);
43
- }
44
40
  if (isCached(version)) {
45
41
  if (verbose) {
46
42
  console.log(`pocket-ic ${version} is already installed`);
@@ -50,8 +46,8 @@ export let download = async (version, { silent = false, verbose = false } = {})
50
46
  let platfrom = process.platform == 'darwin' ? 'darwin' : 'linux';
51
47
  let arch = 'x86_64';
52
48
  let hashes = {
53
- // '2.0.1': '69e1408347723dbaa7a6cd2faa9b65c42abbe861',
54
- // '2.0.0': '29ec86dc9f9ca4691d4d4386c8b2aa41e14d9d16',
49
+ '2.0.1': '69e1408347723dbaa7a6cd2faa9b65c42abbe861',
50
+ '2.0.0': '29ec86dc9f9ca4691d4d4386c8b2aa41e14d9d16',
55
51
  '1.0.0': '307d5847c1d2fe1f5e19181c7d0fcec23f4658b3',
56
52
  };
57
53
  let url = `https://download.dfinity.systems/ic/${hashes[version]}/openssl-static-binaries/${arch}-${platfrom}/pocket-ic.gz`;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.37.3",
3
+ "version": "0.37.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.37.3",
3
+ "version": "0.37.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",