ic-mops 0.44.1 → 0.44.2-pre.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 +2 -0
- package/cli.ts +4 -1
- package/declarations/bench/index.js +8 -0
- package/dist/cli.js +4 -1
- package/dist/declarations/bench/index.js +8 -0
- package/dist/package.json +34 -34
- package/dist/pem.js +1 -1
- package/package.json +34 -34
- package/pem.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/CHANGELOG.md
CHANGED
package/cli.ts
CHANGED
|
@@ -168,12 +168,15 @@ program
|
|
|
168
168
|
program
|
|
169
169
|
.command('sources')
|
|
170
170
|
.description('for dfx packtool')
|
|
171
|
+
.option('--no-install', 'Do not install dependencies before running sources')
|
|
171
172
|
.option('--verbose')
|
|
172
173
|
.action(async (options) => {
|
|
173
174
|
if (!checkConfigFile()) {
|
|
174
175
|
process.exit(1);
|
|
175
176
|
}
|
|
176
|
-
|
|
177
|
+
if (options.install) {
|
|
178
|
+
await installAll({silent: true, lock: 'ignore', threads: 6});
|
|
179
|
+
}
|
|
177
180
|
await toolchain.ensureToolchainInited({strict: false});
|
|
178
181
|
let sourcesArr = await sources(options);
|
|
179
182
|
console.log(sourcesArr.join('\n'));
|
|
@@ -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
|
|
package/dist/cli.js
CHANGED
|
@@ -144,12 +144,15 @@ program
|
|
|
144
144
|
program
|
|
145
145
|
.command('sources')
|
|
146
146
|
.description('for dfx packtool')
|
|
147
|
+
.option('--no-install', 'Do not install dependencies before running sources')
|
|
147
148
|
.option('--verbose')
|
|
148
149
|
.action(async (options) => {
|
|
149
150
|
if (!checkConfigFile()) {
|
|
150
151
|
process.exit(1);
|
|
151
152
|
}
|
|
152
|
-
|
|
153
|
+
if (options.install) {
|
|
154
|
+
await installAll({ silent: true, lock: 'ignore', threads: 6 });
|
|
155
|
+
}
|
|
153
156
|
await toolchain.ensureToolchainInited({ strict: false });
|
|
154
157
|
let sourcesArr = await sources(options);
|
|
155
158
|
console.log(sourcesArr.join('\n'));
|
|
@@ -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
|
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.2-pre.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "bin/mops.js",
|
|
@@ -24,69 +24,69 @@
|
|
|
24
24
|
"node": ">=18.0.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@dfinity/agent": "
|
|
28
|
-
"@dfinity/candid": "
|
|
29
|
-
"@dfinity/identity": "
|
|
30
|
-
"@dfinity/identity-secp256k1": "
|
|
31
|
-
"@dfinity/principal": "
|
|
32
|
-
"@iarna/toml": "
|
|
27
|
+
"@dfinity/agent": "1.4.0",
|
|
28
|
+
"@dfinity/candid": "1.4.0",
|
|
29
|
+
"@dfinity/identity": "1.4.0",
|
|
30
|
+
"@dfinity/identity-secp256k1": "1.4.0",
|
|
31
|
+
"@dfinity/principal": "1.4.0",
|
|
32
|
+
"@iarna/toml": "2.2.5",
|
|
33
33
|
"@noble/hashes": "1.3.2",
|
|
34
|
-
"as-table": "
|
|
34
|
+
"as-table": "1.0.55",
|
|
35
35
|
"buffer": "6.0.3",
|
|
36
36
|
"cacheable-request": "10.2.12",
|
|
37
|
-
"camelcase": "
|
|
38
|
-
"chalk": "
|
|
37
|
+
"camelcase": "7.0.1",
|
|
38
|
+
"chalk": "5.3.0",
|
|
39
39
|
"chokidar": "3.6.0",
|
|
40
40
|
"commander": "12.0.0",
|
|
41
|
-
"debounce": "
|
|
41
|
+
"debounce": "1.2.1",
|
|
42
42
|
"decomp-tarxz": "0.1.1",
|
|
43
|
-
"decompress": "
|
|
43
|
+
"decompress": "4.2.1",
|
|
44
44
|
"del": "7.1.0",
|
|
45
45
|
"dhall-to-json-cli": "1.7.6",
|
|
46
46
|
"eslint": "8.57.0",
|
|
47
47
|
"execa": "8.0.1",
|
|
48
48
|
"fs-extra": "11.2.0",
|
|
49
|
-
"get-folder-size": "
|
|
50
|
-
"glob": "
|
|
51
|
-
"globby": "
|
|
49
|
+
"get-folder-size": "4.0.0",
|
|
50
|
+
"glob": "10.3.3",
|
|
51
|
+
"globby": "13.2.2",
|
|
52
52
|
"got": "13.0.0",
|
|
53
53
|
"log-update": "6.0.0",
|
|
54
54
|
"markdown-table": "3.0.3",
|
|
55
|
-
"mdast-util-from-markdown": "
|
|
56
|
-
"mdast-util-to-markdown": "
|
|
57
|
-
"minimatch": "
|
|
58
|
-
"ncp": "
|
|
59
|
-
"node-fetch": "
|
|
55
|
+
"mdast-util-from-markdown": "2.0.0",
|
|
56
|
+
"mdast-util-to-markdown": "2.1.0",
|
|
57
|
+
"minimatch": "9.0.3",
|
|
58
|
+
"ncp": "2.0.0",
|
|
59
|
+
"node-fetch": "3.3.2",
|
|
60
60
|
"octokit": "3.1.2",
|
|
61
|
-
"pem-file": "
|
|
61
|
+
"pem-file": "1.0.1",
|
|
62
62
|
"pic-ic": "0.3.2",
|
|
63
|
-
"prompts": "
|
|
63
|
+
"prompts": "2.4.2",
|
|
64
64
|
"semver": "7.6.0",
|
|
65
|
-
"stream-to-promise": "
|
|
65
|
+
"stream-to-promise": "3.0.0",
|
|
66
66
|
"string-width": "7.1.0",
|
|
67
67
|
"tar": "6.2.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@tsconfig/strictest": "2.0.2",
|
|
71
|
-
"@types/debounce": "
|
|
72
|
-
"@types/decompress": "
|
|
71
|
+
"@types/debounce": "1.2.1",
|
|
72
|
+
"@types/decompress": "4.2.4",
|
|
73
73
|
"@types/fs-extra": "11.0.4",
|
|
74
|
-
"@types/glob": "
|
|
75
|
-
"@types/ncp": "
|
|
74
|
+
"@types/glob": "8.1.0",
|
|
75
|
+
"@types/ncp": "2.0.5",
|
|
76
76
|
"@types/node": "20.11.24",
|
|
77
|
-
"@types/prompts": "
|
|
77
|
+
"@types/prompts": "2.4.4",
|
|
78
78
|
"@types/semver": "7.5.8",
|
|
79
|
-
"@types/stream-to-promise": "
|
|
80
|
-
"@types/tar": "
|
|
79
|
+
"@types/stream-to-promise": "2.2.1",
|
|
80
|
+
"@types/tar": "6.1.5",
|
|
81
81
|
"bun": "1.0.35",
|
|
82
82
|
"esbuild": "0.20.1",
|
|
83
83
|
"tsx": "4.7.1",
|
|
84
84
|
"typescript": "5.4.3"
|
|
85
85
|
},
|
|
86
86
|
"overrides": {
|
|
87
|
-
"@dfinity/agent": "
|
|
88
|
-
"@dfinity/identity": "
|
|
89
|
-
"@dfinity/principal": "
|
|
90
|
-
"@dfinity/candid": "
|
|
87
|
+
"@dfinity/agent": "1.4.0",
|
|
88
|
+
"@dfinity/identity": "1.4.0",
|
|
89
|
+
"@dfinity/principal": "1.4.0",
|
|
90
|
+
"@dfinity/candid": "1.4.0"
|
|
91
91
|
}
|
|
92
92
|
}
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ic-mops",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.2-pre.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"mops": "dist/bin/mops.js",
|
|
@@ -39,69 +39,69 @@
|
|
|
39
39
|
"esbuild": "esbuild"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@dfinity/agent": "
|
|
43
|
-
"@dfinity/candid": "
|
|
44
|
-
"@dfinity/identity": "
|
|
45
|
-
"@dfinity/identity-secp256k1": "
|
|
46
|
-
"@dfinity/principal": "
|
|
47
|
-
"@iarna/toml": "
|
|
42
|
+
"@dfinity/agent": "1.4.0",
|
|
43
|
+
"@dfinity/candid": "1.4.0",
|
|
44
|
+
"@dfinity/identity": "1.4.0",
|
|
45
|
+
"@dfinity/identity-secp256k1": "1.4.0",
|
|
46
|
+
"@dfinity/principal": "1.4.0",
|
|
47
|
+
"@iarna/toml": "2.2.5",
|
|
48
48
|
"@noble/hashes": "1.3.2",
|
|
49
|
-
"as-table": "
|
|
49
|
+
"as-table": "1.0.55",
|
|
50
50
|
"buffer": "6.0.3",
|
|
51
51
|
"cacheable-request": "10.2.12",
|
|
52
|
-
"camelcase": "
|
|
53
|
-
"chalk": "
|
|
52
|
+
"camelcase": "7.0.1",
|
|
53
|
+
"chalk": "5.3.0",
|
|
54
54
|
"chokidar": "3.6.0",
|
|
55
55
|
"commander": "12.0.0",
|
|
56
|
-
"debounce": "
|
|
56
|
+
"debounce": "1.2.1",
|
|
57
57
|
"decomp-tarxz": "0.1.1",
|
|
58
|
-
"decompress": "
|
|
58
|
+
"decompress": "4.2.1",
|
|
59
59
|
"del": "7.1.0",
|
|
60
60
|
"dhall-to-json-cli": "1.7.6",
|
|
61
61
|
"eslint": "8.57.0",
|
|
62
62
|
"execa": "8.0.1",
|
|
63
63
|
"fs-extra": "11.2.0",
|
|
64
|
-
"get-folder-size": "
|
|
65
|
-
"glob": "
|
|
66
|
-
"globby": "
|
|
64
|
+
"get-folder-size": "4.0.0",
|
|
65
|
+
"glob": "10.3.3",
|
|
66
|
+
"globby": "13.2.2",
|
|
67
67
|
"got": "13.0.0",
|
|
68
68
|
"log-update": "6.0.0",
|
|
69
69
|
"markdown-table": "3.0.3",
|
|
70
|
-
"mdast-util-from-markdown": "
|
|
71
|
-
"mdast-util-to-markdown": "
|
|
72
|
-
"minimatch": "
|
|
73
|
-
"ncp": "
|
|
74
|
-
"node-fetch": "
|
|
70
|
+
"mdast-util-from-markdown": "2.0.0",
|
|
71
|
+
"mdast-util-to-markdown": "2.1.0",
|
|
72
|
+
"minimatch": "9.0.3",
|
|
73
|
+
"ncp": "2.0.0",
|
|
74
|
+
"node-fetch": "3.3.2",
|
|
75
75
|
"octokit": "3.1.2",
|
|
76
|
-
"pem-file": "
|
|
76
|
+
"pem-file": "1.0.1",
|
|
77
77
|
"pic-ic": "0.3.2",
|
|
78
|
-
"prompts": "
|
|
78
|
+
"prompts": "2.4.2",
|
|
79
79
|
"semver": "7.6.0",
|
|
80
|
-
"stream-to-promise": "
|
|
80
|
+
"stream-to-promise": "3.0.0",
|
|
81
81
|
"string-width": "7.1.0",
|
|
82
82
|
"tar": "6.2.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@tsconfig/strictest": "2.0.2",
|
|
86
|
-
"@types/debounce": "
|
|
87
|
-
"@types/decompress": "
|
|
86
|
+
"@types/debounce": "1.2.1",
|
|
87
|
+
"@types/decompress": "4.2.4",
|
|
88
88
|
"@types/fs-extra": "11.0.4",
|
|
89
|
-
"@types/glob": "
|
|
90
|
-
"@types/ncp": "
|
|
89
|
+
"@types/glob": "8.1.0",
|
|
90
|
+
"@types/ncp": "2.0.5",
|
|
91
91
|
"@types/node": "20.11.24",
|
|
92
|
-
"@types/prompts": "
|
|
92
|
+
"@types/prompts": "2.4.4",
|
|
93
93
|
"@types/semver": "7.5.8",
|
|
94
|
-
"@types/stream-to-promise": "
|
|
95
|
-
"@types/tar": "
|
|
94
|
+
"@types/stream-to-promise": "2.2.1",
|
|
95
|
+
"@types/tar": "6.1.5",
|
|
96
96
|
"bun": "1.0.35",
|
|
97
97
|
"esbuild": "0.20.1",
|
|
98
98
|
"tsx": "4.7.1",
|
|
99
99
|
"typescript": "5.4.3"
|
|
100
100
|
},
|
|
101
101
|
"overrides": {
|
|
102
|
-
"@dfinity/agent": "
|
|
103
|
-
"@dfinity/identity": "
|
|
104
|
-
"@dfinity/principal": "
|
|
105
|
-
"@dfinity/candid": "
|
|
102
|
+
"@dfinity/agent": "1.4.0",
|
|
103
|
+
"@dfinity/identity": "1.4.0",
|
|
104
|
+
"@dfinity/principal": "1.4.0",
|
|
105
|
+
"@dfinity/candid": "1.4.0"
|
|
106
106
|
}
|
|
107
107
|
}
|
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/.npmrc
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
|
-
import { createLogUpdate } from 'log-update';
|
|
4
|
-
import { checkConfigFile, readConfig } from '../mops.js';
|
|
5
|
-
import { install } from './install.js';
|
|
6
|
-
import { installFromGithub } from '../vessel.js';
|
|
7
|
-
import { notifyInstalls } from '../notify-installs.js';
|
|
8
|
-
import { checkIntegrity } from '../integrity.js';
|
|
9
|
-
import { installLocal } from './install-local.js';
|
|
10
|
-
import { checkRequirements } from '../check-requirements.js';
|
|
11
|
-
export async function installAll({ verbose = false, silent = false, lock } = {}) {
|
|
12
|
-
if (!checkConfigFile()) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
let config = readConfig();
|
|
16
|
-
let deps = Object.values(config.dependencies || {});
|
|
17
|
-
let devDeps = Object.values(config['dev-dependencies'] || {});
|
|
18
|
-
let allDeps = [...deps, ...devDeps];
|
|
19
|
-
let installedPackages = {};
|
|
20
|
-
for (let { name, repo, path, version } of allDeps) {
|
|
21
|
-
if (repo) {
|
|
22
|
-
await installFromGithub(name, repo, { verbose, silent });
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
let res = await (path ? installLocal(name, path, { silent, verbose }) : install(name, version, { silent, verbose }));
|
|
26
|
-
if (res === false) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
installedPackages = { ...installedPackages, ...res };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
|
|
33
|
-
if (!silent && lock !== 'ignore') {
|
|
34
|
-
logUpdate('Checking integrity...');
|
|
35
|
-
}
|
|
36
|
-
await Promise.all([
|
|
37
|
-
notifyInstalls(Object.keys(installedPackages)),
|
|
38
|
-
checkIntegrity(lock),
|
|
39
|
-
]);
|
|
40
|
-
if (!silent) {
|
|
41
|
-
logUpdate.clear();
|
|
42
|
-
await checkRequirements();
|
|
43
|
-
console.log(chalk.green('Packages installed'));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { createLogUpdate } from 'log-update';
|
|
3
|
-
import { checkConfigFile, getRootDir, readConfig } from '../mops.js';
|
|
4
|
-
import { installFromGithub } from '../vessel.js';
|
|
5
|
-
import { install } from './install.js';
|
|
6
|
-
// skip install and just find non-local dependencies to install
|
|
7
|
-
// pkgPath should be relative to the current root dir or absolute
|
|
8
|
-
export async function installLocal(pkg, pkgPath = '', { verbose = false, silent = false } = {}) {
|
|
9
|
-
if (!checkConfigFile()) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
if (!silent) {
|
|
13
|
-
let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
|
|
14
|
-
logUpdate(`Local dependency ${pkg} = "${pkgPath}"`);
|
|
15
|
-
if (verbose) {
|
|
16
|
-
silent || logUpdate.done();
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
logUpdate.clear();
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
// install dependencies
|
|
23
|
-
let ok = true;
|
|
24
|
-
let rootDir = getRootDir();
|
|
25
|
-
let dir = path.resolve(rootDir, pkgPath);
|
|
26
|
-
let config = readConfig(path.join(dir, 'mops.toml'));
|
|
27
|
-
let deps = Object.values(config.dependencies || {});
|
|
28
|
-
let installedDeps = {};
|
|
29
|
-
for (const { name, repo, version, path: depPath } of deps) {
|
|
30
|
-
if (repo) {
|
|
31
|
-
await installFromGithub(name, repo, { silent, verbose });
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
let res = await (depPath ? installLocal(name, path.resolve(pkgPath, depPath), { silent, verbose }) : install(name, version, { silent, verbose }));
|
|
35
|
-
if (res) {
|
|
36
|
-
installedDeps = { ...installedDeps, ...res };
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
ok = false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (!ok) {
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
return installedDeps;
|
|
47
|
-
}
|
package/dist/commands/install.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import { createLogUpdate } from 'log-update';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import { checkConfigFile, formatDir, progressBar, readConfig } from '../mops.js';
|
|
6
|
-
import { getHighestVersion } from '../api/getHighestVersion.js';
|
|
7
|
-
import { storageActor } from '../api/actors.js';
|
|
8
|
-
import { parallel } from '../parallel.js';
|
|
9
|
-
import { installFromGithub } from '../vessel.js';
|
|
10
|
-
import { addCache, copyCache, isCached } from '../cache.js';
|
|
11
|
-
import { downloadFile, getPackageFilesInfo } from '../api/downloadPackageFiles.js';
|
|
12
|
-
import { installLocal } from './install-local.js';
|
|
13
|
-
export async function install(pkg, version = '', { verbose = false, silent = false, dep = false } = {}) {
|
|
14
|
-
if (!checkConfigFile()) {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
|
|
18
|
-
// progress
|
|
19
|
-
let total = Infinity;
|
|
20
|
-
let step = 0;
|
|
21
|
-
let progress = () => {
|
|
22
|
-
step++;
|
|
23
|
-
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} ${progressBar(step, total)}`);
|
|
24
|
-
};
|
|
25
|
-
progress();
|
|
26
|
-
if (!version) {
|
|
27
|
-
let versionRes = await getHighestVersion(pkg);
|
|
28
|
-
if ('err' in versionRes) {
|
|
29
|
-
console.log(chalk.red('Error: ') + versionRes.err);
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
version = versionRes.ok;
|
|
33
|
-
}
|
|
34
|
-
let dir = formatDir(pkg, version);
|
|
35
|
-
let alreadyInstalled = false;
|
|
36
|
-
// already installed
|
|
37
|
-
if (fs.existsSync(dir)) {
|
|
38
|
-
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (local cache)`);
|
|
39
|
-
alreadyInstalled = true;
|
|
40
|
-
}
|
|
41
|
-
// copy from cache
|
|
42
|
-
else if (isCached(`${pkg}@${version}`)) {
|
|
43
|
-
await copyCache(`${pkg}@${version}`, dir);
|
|
44
|
-
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (global cache)`);
|
|
45
|
-
}
|
|
46
|
-
// download
|
|
47
|
-
else {
|
|
48
|
-
let threads = 16;
|
|
49
|
-
// GitHub Actions fails with "fetch failed" if there are multiple concurrent actions
|
|
50
|
-
if (process.env.GITHUB_ENV) {
|
|
51
|
-
threads = 4;
|
|
52
|
-
}
|
|
53
|
-
try {
|
|
54
|
-
let { storageId, fileIds } = await getPackageFilesInfo(pkg, version);
|
|
55
|
-
total = fileIds.length + 2;
|
|
56
|
-
let filesData = new Map;
|
|
57
|
-
let storage = await storageActor(storageId);
|
|
58
|
-
await parallel(threads, fileIds, async (fileId) => {
|
|
59
|
-
let { path, data } = await downloadFile(storage, fileId);
|
|
60
|
-
filesData.set(path, data);
|
|
61
|
-
progress();
|
|
62
|
-
});
|
|
63
|
-
// write files to disk
|
|
64
|
-
for (let [filePath, data] of filesData.entries()) {
|
|
65
|
-
fs.mkdirSync(path.join(dir, path.dirname(filePath)), { recursive: true });
|
|
66
|
-
fs.writeFileSync(path.join(dir, filePath), Buffer.from(data));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
console.error(chalk.red('Error: ') + err);
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
// add to cache
|
|
74
|
-
await addCache(`${pkg}@${version}`, dir);
|
|
75
|
-
progress();
|
|
76
|
-
}
|
|
77
|
-
if (verbose) {
|
|
78
|
-
silent || logUpdate.done();
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
logUpdate.clear();
|
|
82
|
-
}
|
|
83
|
-
// install dependencies
|
|
84
|
-
let ok = true;
|
|
85
|
-
let config = readConfig(path.join(dir, 'mops.toml'));
|
|
86
|
-
let deps = Object.values(config.dependencies || {});
|
|
87
|
-
let installedDeps = {};
|
|
88
|
-
for (const { name, repo, version, path: depPath } of deps) {
|
|
89
|
-
if (repo) {
|
|
90
|
-
await installFromGithub(name, repo, { silent, verbose });
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
let res = await (depPath ? installLocal(name, depPath, { silent, verbose }) : install(name, version, { silent, verbose }));
|
|
94
|
-
if (res) {
|
|
95
|
-
installedDeps = { ...installedDeps, ...res };
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
ok = false;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (!alreadyInstalled) {
|
|
103
|
-
installedDeps = { ...installedDeps, [pkg]: version };
|
|
104
|
-
}
|
|
105
|
-
if (!ok) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
return installedDeps;
|
|
109
|
-
}
|
package/dist/remove-scripts.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/remove-scripts.js
DELETED