ic-mops 0.31.1 → 0.32.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/cli.ts +14 -0
- package/commands/bench/bench-canister.mo +87 -0
- package/commands/bench/user-bench.mo +14 -0
- package/commands/bench.ts +335 -0
- package/commands/publish.ts +4 -0
- package/commands/sources.ts +4 -4
- package/declarations/bench/bench.did +26 -0
- package/declarations/bench/bench.did.d.ts +26 -0
- package/declarations/bench/bench.did.js +26 -0
- package/declarations/bench/index.d.ts +50 -0
- package/declarations/bench/index.js +41 -0
- package/dist/cli.js +13 -0
- package/dist/commands/bench/bench-canister.mo +87 -0
- package/dist/commands/bench/user-bench.mo +14 -0
- package/dist/commands/bench.d.ts +11 -0
- package/dist/commands/bench.js +275 -0
- package/dist/commands/publish.js +4 -0
- package/dist/commands/sources.d.ts +2 -1
- package/dist/commands/sources.js +4 -4
- package/dist/declarations/bench/bench.did +26 -0
- package/dist/declarations/bench/bench.did.d.ts +26 -0
- package/dist/declarations/bench/bench.did.js +26 -0
- package/dist/declarations/bench/index.d.ts +50 -0
- package/dist/declarations/bench/index.js +41 -0
- package/dist/helpers/get-dfx-version.d.ts +1 -0
- package/dist/helpers/get-dfx-version.js +9 -0
- package/dist/helpers/get-moc-path.d.ts +1 -0
- package/dist/helpers/get-moc-path.js +11 -0
- package/dist/helpers/get-moc-version.d.ts +1 -0
- package/dist/helpers/get-moc-version.js +7 -0
- package/dist/package.json +81 -80
- package/dist/resolve-packages.js +1 -1
- package/dist/vessel.d.ts +2 -1
- package/dist/vessel.js +9 -7
- package/helpers/get-dfx-version.ts +10 -0
- package/helpers/get-moc-path.ts +12 -0
- package/helpers/get-moc-version.ts +8 -0
- package/package.json +81 -80
- package/resolve-packages.ts +1 -1
- package/tsconfig.json +2 -0
- package/vessel.ts +10 -8
package/dist/package.json
CHANGED
|
@@ -1,82 +1,83 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
2
|
+
"name": "ic-mops",
|
|
3
|
+
"version": "0.32.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"mops": "dist/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"*",
|
|
10
|
+
"!network.txt",
|
|
11
|
+
"!.mops",
|
|
12
|
+
"/templates"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://mops.one",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/ZenVoich/mops.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "Zen Voich <zen.voich@gmail.com>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=16.0.0"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"bundle": "esbuild --bundle --outfile=cli.js --platform=node --packages=external --target=node16 --format=esm ./dist/cli.js",
|
|
27
|
+
"copy": "cp -r commands/bench dist/commands && cp -r declarations templates network.txt package.json dist | true",
|
|
28
|
+
"save-network": "cp -r dist/network.txt . | true",
|
|
29
|
+
"prepare": "npm run save-network && npm run build && npm run copy",
|
|
30
|
+
"check": "tsc --project tsconfig.json --noEmit",
|
|
31
|
+
"tsc": "tsc",
|
|
32
|
+
"esbuild": "esbuild"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@dfinity/agent": "^0.18.1",
|
|
36
|
+
"@dfinity/candid": "^0.18.1",
|
|
37
|
+
"@dfinity/identity": "^0.18.1",
|
|
38
|
+
"@dfinity/identity-secp256k1": "^0.18.1",
|
|
39
|
+
"@dfinity/principal": "^0.18.1",
|
|
40
|
+
"@iarna/toml": "^2.2.5",
|
|
41
|
+
"as-table": "^1.0.55",
|
|
42
|
+
"cacheable-request": "10.2.12",
|
|
43
|
+
"camelcase": "^7.0.1",
|
|
44
|
+
"chalk": "^5.3.0",
|
|
45
|
+
"chokidar": "^3.5.3",
|
|
46
|
+
"commander": "^11.0.0",
|
|
47
|
+
"debounce": "^1.2.1",
|
|
48
|
+
"decompress": "^4.2.1",
|
|
49
|
+
"del": "^7.0.0",
|
|
50
|
+
"dhall-to-json-cli": "^1.7.6",
|
|
51
|
+
"eslint": "^8.45.0",
|
|
52
|
+
"execa": "7.1.1",
|
|
53
|
+
"get-folder-size": "^4.0.0",
|
|
54
|
+
"glob": "^10.3.3",
|
|
55
|
+
"globby": "^13.2.2",
|
|
56
|
+
"got": "13.0.0",
|
|
57
|
+
"log-update": "^5.0.1",
|
|
58
|
+
"markdown-table": "3.0.3",
|
|
59
|
+
"mdast-util-from-markdown": "^2.0.0",
|
|
60
|
+
"mdast-util-to-markdown": "^2.1.0",
|
|
61
|
+
"minimatch": "^9.0.3",
|
|
62
|
+
"ncp": "^2.0.0",
|
|
63
|
+
"node-fetch": "^3.3.2",
|
|
64
|
+
"pem-file": "^1.0.1",
|
|
65
|
+
"prompts": "^2.4.2",
|
|
66
|
+
"stream-to-promise": "^3.0.0",
|
|
67
|
+
"tar": "^6.1.15"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@tsconfig/strictest": "^2.0.1",
|
|
71
|
+
"@types/debounce": "^1.2.1",
|
|
72
|
+
"@types/decompress": "^4.2.4",
|
|
73
|
+
"@types/glob": "^8.1.0",
|
|
74
|
+
"@types/ncp": "^2.0.5",
|
|
75
|
+
"@types/node": "^20.4.4",
|
|
76
|
+
"@types/prompts": "^2.4.4",
|
|
77
|
+
"@types/stream-to-promise": "^2.2.1",
|
|
78
|
+
"@types/tar": "^6.1.5",
|
|
79
|
+
"esbuild": "^0.18.16",
|
|
80
|
+
"tsx": "^3.12.7",
|
|
81
|
+
"typescript": "^5.1.6"
|
|
82
|
+
}
|
|
82
83
|
}
|
package/dist/resolve-packages.js
CHANGED
|
@@ -57,7 +57,7 @@ export async function resolvePackages({ verbose = false } = {}) {
|
|
|
57
57
|
let nestedConfig;
|
|
58
58
|
if (repo) {
|
|
59
59
|
const dir = formatGithubDir(name, repo);
|
|
60
|
-
nestedConfig = await readVesselConfig(dir) || {};
|
|
60
|
+
nestedConfig = await readVesselConfig(dir, { silent: true }) || {};
|
|
61
61
|
}
|
|
62
62
|
else if (!pkgDetails.path && version) {
|
|
63
63
|
const file = formatDir(name, version) + '/mops.toml';
|
package/dist/vessel.d.ts
CHANGED
|
@@ -8,8 +8,9 @@ export type VesselDependencies = Array<{
|
|
|
8
8
|
repo?: string;
|
|
9
9
|
path?: string;
|
|
10
10
|
}>;
|
|
11
|
-
export declare const readVesselConfig: (dir: string, { cache }?: {
|
|
11
|
+
export declare const readVesselConfig: (dir: string, { cache, silent }?: {
|
|
12
12
|
cache?: boolean | undefined;
|
|
13
|
+
silent?: boolean | undefined;
|
|
13
14
|
}) => Promise<VesselConfig | null>;
|
|
14
15
|
export declare const downloadFromGithub: (repo: string, dest: string, onProgress: any) => Promise<unknown>;
|
|
15
16
|
export declare const installFromGithub: (name: string, repo: string, { verbose, dep, silent }?: {
|
package/dist/vessel.js
CHANGED
|
@@ -9,7 +9,7 @@ import decompress from 'decompress';
|
|
|
9
9
|
import { pipeline } from 'stream';
|
|
10
10
|
import { formatGithubDir, parseGithubURL, progressBar } from './mops.js';
|
|
11
11
|
import { addCache, copyCache, isCached } from './cache.js';
|
|
12
|
-
const dhallFileToJson = async (filePath) => {
|
|
12
|
+
const dhallFileToJson = async (filePath, silent) => {
|
|
13
13
|
if (existsSync(filePath)) {
|
|
14
14
|
let cwd = new URL(path.dirname(import.meta.url)).pathname;
|
|
15
15
|
let res;
|
|
@@ -17,7 +17,7 @@ const dhallFileToJson = async (filePath) => {
|
|
|
17
17
|
res = await execaCommand(`dhall-to-json --file ${filePath}`, { preferLocal: true, cwd });
|
|
18
18
|
}
|
|
19
19
|
catch (err) {
|
|
20
|
-
console.error('dhall-to-json error:', err);
|
|
20
|
+
silent || console.error('dhall-to-json error:', err.message?.split('Message:')[0]);
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
if (res.exitCode === 0) {
|
|
@@ -29,15 +29,15 @@ const dhallFileToJson = async (filePath) => {
|
|
|
29
29
|
}
|
|
30
30
|
return null;
|
|
31
31
|
};
|
|
32
|
-
export const readVesselConfig = async (dir, { cache = true } = {}) => {
|
|
32
|
+
export const readVesselConfig = async (dir, { cache = true, silent = false } = {}) => {
|
|
33
33
|
const cachedFile = (dir || process.cwd()) + '/vessel.json';
|
|
34
34
|
if (existsSync(cachedFile)) {
|
|
35
35
|
let cachedConfig = readFileSync(cachedFile).toString();
|
|
36
36
|
return JSON.parse(cachedConfig);
|
|
37
37
|
}
|
|
38
38
|
const [vessel, packageSetArray] = await Promise.all([
|
|
39
|
-
dhallFileToJson((dir || process.cwd()) + '/vessel.dhall'),
|
|
40
|
-
dhallFileToJson((dir || process.cwd()) + '/package-set.dhall')
|
|
39
|
+
dhallFileToJson((dir || process.cwd()) + '/vessel.dhall', silent),
|
|
40
|
+
dhallFileToJson((dir || process.cwd()) + '/package-set.dhall', silent)
|
|
41
41
|
]);
|
|
42
42
|
if (!vessel || !packageSetArray) {
|
|
43
43
|
return null;
|
|
@@ -64,6 +64,8 @@ export const downloadFromGithub = async (repo, dest, onProgress) => {
|
|
|
64
64
|
const readStream = got.stream(zipFile);
|
|
65
65
|
const promise = new Promise((resolve, reject) => {
|
|
66
66
|
readStream.on('error', (err) => {
|
|
67
|
+
console.error(chalk.red(`Error: failed to download from GitHub: ${zipFile}`));
|
|
68
|
+
console.error(err.message);
|
|
67
69
|
reject(err);
|
|
68
70
|
});
|
|
69
71
|
readStream.on('downloadProgress', ({ transferred, total }) => {
|
|
@@ -135,7 +137,7 @@ export const installFromGithub = async (name, repo, { verbose = false, dep = fal
|
|
|
135
137
|
}
|
|
136
138
|
catch (err) {
|
|
137
139
|
deleteSync([dir]);
|
|
138
|
-
|
|
140
|
+
process.exit(1);
|
|
139
141
|
}
|
|
140
142
|
// add to cache
|
|
141
143
|
await addCache(cacheName, dir);
|
|
@@ -143,7 +145,7 @@ export const installFromGithub = async (name, repo, { verbose = false, dep = fal
|
|
|
143
145
|
if (verbose) {
|
|
144
146
|
silent || logUpdate.done();
|
|
145
147
|
}
|
|
146
|
-
const config = await readVesselConfig(dir);
|
|
148
|
+
const config = await readVesselConfig(dir, { silent });
|
|
147
149
|
if (config) {
|
|
148
150
|
for (const { name, repo } of config.dependencies) {
|
|
149
151
|
if (repo) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {execSync} from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
export function getMocPath(): string {
|
|
4
|
+
let mocPath = process.env.DFX_MOC_PATH;
|
|
5
|
+
if (!mocPath) {
|
|
6
|
+
mocPath = execSync('dfx cache show').toString().trim() + '/moc';
|
|
7
|
+
}
|
|
8
|
+
if (!mocPath) {
|
|
9
|
+
mocPath = 'moc';
|
|
10
|
+
}
|
|
11
|
+
return mocPath;
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import {execSync} from 'node:child_process';
|
|
2
|
+
import {getMocPath} from './get-moc-path.js';
|
|
3
|
+
|
|
4
|
+
export function getMocVersion(): string {
|
|
5
|
+
let mocPath = getMocPath();
|
|
6
|
+
let match = execSync(mocPath).toString().trim().match(/Motoko compiler ([^\s]+) .*/);
|
|
7
|
+
return match?.[1] || '';
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,82 +1,83 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
2
|
+
"name": "ic-mops",
|
|
3
|
+
"version": "0.32.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"bin": {
|
|
6
|
+
"mops": "dist/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"*",
|
|
10
|
+
"!network.txt",
|
|
11
|
+
"!.mops",
|
|
12
|
+
"/templates"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://mops.one",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/ZenVoich/mops.git"
|
|
18
|
+
},
|
|
19
|
+
"author": "Zen Voich <zen.voich@gmail.com>",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=16.0.0"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"bundle": "esbuild --bundle --outfile=cli.js --platform=node --packages=external --target=node16 --format=esm ./dist/cli.js",
|
|
27
|
+
"copy": "cp -r commands/bench dist/commands && cp -r declarations templates network.txt package.json dist | true",
|
|
28
|
+
"save-network": "cp -r dist/network.txt . | true",
|
|
29
|
+
"prepare": "npm run save-network && npm run build && npm run copy",
|
|
30
|
+
"check": "tsc --project tsconfig.json --noEmit",
|
|
31
|
+
"tsc": "tsc",
|
|
32
|
+
"esbuild": "esbuild"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@dfinity/agent": "^0.18.1",
|
|
36
|
+
"@dfinity/candid": "^0.18.1",
|
|
37
|
+
"@dfinity/identity": "^0.18.1",
|
|
38
|
+
"@dfinity/identity-secp256k1": "^0.18.1",
|
|
39
|
+
"@dfinity/principal": "^0.18.1",
|
|
40
|
+
"@iarna/toml": "^2.2.5",
|
|
41
|
+
"as-table": "^1.0.55",
|
|
42
|
+
"cacheable-request": "10.2.12",
|
|
43
|
+
"camelcase": "^7.0.1",
|
|
44
|
+
"chalk": "^5.3.0",
|
|
45
|
+
"chokidar": "^3.5.3",
|
|
46
|
+
"commander": "^11.0.0",
|
|
47
|
+
"debounce": "^1.2.1",
|
|
48
|
+
"decompress": "^4.2.1",
|
|
49
|
+
"del": "^7.0.0",
|
|
50
|
+
"dhall-to-json-cli": "^1.7.6",
|
|
51
|
+
"eslint": "^8.45.0",
|
|
52
|
+
"execa": "7.1.1",
|
|
53
|
+
"get-folder-size": "^4.0.0",
|
|
54
|
+
"glob": "^10.3.3",
|
|
55
|
+
"globby": "^13.2.2",
|
|
56
|
+
"got": "13.0.0",
|
|
57
|
+
"log-update": "^5.0.1",
|
|
58
|
+
"markdown-table": "3.0.3",
|
|
59
|
+
"mdast-util-from-markdown": "^2.0.0",
|
|
60
|
+
"mdast-util-to-markdown": "^2.1.0",
|
|
61
|
+
"minimatch": "^9.0.3",
|
|
62
|
+
"ncp": "^2.0.0",
|
|
63
|
+
"node-fetch": "^3.3.2",
|
|
64
|
+
"pem-file": "^1.0.1",
|
|
65
|
+
"prompts": "^2.4.2",
|
|
66
|
+
"stream-to-promise": "^3.0.0",
|
|
67
|
+
"tar": "^6.1.15"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@tsconfig/strictest": "^2.0.1",
|
|
71
|
+
"@types/debounce": "^1.2.1",
|
|
72
|
+
"@types/decompress": "^4.2.4",
|
|
73
|
+
"@types/glob": "^8.1.0",
|
|
74
|
+
"@types/ncp": "^2.0.5",
|
|
75
|
+
"@types/node": "^20.4.4",
|
|
76
|
+
"@types/prompts": "^2.4.4",
|
|
77
|
+
"@types/stream-to-promise": "^2.2.1",
|
|
78
|
+
"@types/tar": "^6.1.5",
|
|
79
|
+
"esbuild": "^0.18.16",
|
|
80
|
+
"tsx": "^3.12.7",
|
|
81
|
+
"typescript": "^5.1.6"
|
|
82
|
+
}
|
|
82
83
|
}
|
package/resolve-packages.ts
CHANGED
|
@@ -71,7 +71,7 @@ export async function resolvePackages({verbose = false} = {}): Promise<Record<st
|
|
|
71
71
|
|
|
72
72
|
if (repo) {
|
|
73
73
|
const dir = formatGithubDir(name, repo);
|
|
74
|
-
nestedConfig = await readVesselConfig(dir) || {};
|
|
74
|
+
nestedConfig = await readVesselConfig(dir, {silent: true}) || {};
|
|
75
75
|
}
|
|
76
76
|
else if (!pkgDetails.path && version) {
|
|
77
77
|
const file = formatDir(name, version) + '/mops.toml';
|
package/tsconfig.json
CHANGED
package/vessel.ts
CHANGED
|
@@ -10,15 +10,15 @@ import {pipeline} from 'stream';
|
|
|
10
10
|
import {formatGithubDir, parseGithubURL, progressBar} from './mops.js';
|
|
11
11
|
import {addCache, copyCache, isCached} from './cache.js';
|
|
12
12
|
|
|
13
|
-
const dhallFileToJson = async (filePath: string) => {
|
|
13
|
+
const dhallFileToJson = async (filePath: string, silent: boolean) => {
|
|
14
14
|
if (existsSync(filePath)) {
|
|
15
15
|
let cwd = new URL(path.dirname(import.meta.url)).pathname;
|
|
16
16
|
let res;
|
|
17
17
|
try {
|
|
18
18
|
res = await execaCommand(`dhall-to-json --file ${filePath}`, {preferLocal:true, cwd});
|
|
19
19
|
}
|
|
20
|
-
catch (err) {
|
|
21
|
-
console.error('dhall-to-json error:', err);
|
|
20
|
+
catch (err: any) {
|
|
21
|
+
silent || console.error('dhall-to-json error:', err.message?.split('Message:')[0]);
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -45,7 +45,7 @@ export type VesselDependencies = Array<{
|
|
|
45
45
|
path?: string; // local package
|
|
46
46
|
}>;
|
|
47
47
|
|
|
48
|
-
export const readVesselConfig = async (dir: string, {cache = true} = {}): Promise<VesselConfig | null> => {
|
|
48
|
+
export const readVesselConfig = async (dir: string, {cache = true, silent = false} = {}): Promise<VesselConfig | null> => {
|
|
49
49
|
const cachedFile = (dir || process.cwd()) + '/vessel.json';
|
|
50
50
|
|
|
51
51
|
if (existsSync(cachedFile)) {
|
|
@@ -54,8 +54,8 @@ export const readVesselConfig = async (dir: string, {cache = true} = {}): Promis
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const [vessel, packageSetArray] = await Promise.all([
|
|
57
|
-
dhallFileToJson((dir || process.cwd()) + '/vessel.dhall'),
|
|
58
|
-
dhallFileToJson((dir || process.cwd()) + '/package-set.dhall')
|
|
57
|
+
dhallFileToJson((dir || process.cwd()) + '/vessel.dhall', silent),
|
|
58
|
+
dhallFileToJson((dir || process.cwd()) + '/package-set.dhall', silent)
|
|
59
59
|
]);
|
|
60
60
|
|
|
61
61
|
if (!vessel || !packageSetArray) {
|
|
@@ -90,6 +90,8 @@ export const downloadFromGithub = async (repo: string, dest: string, onProgress:
|
|
|
90
90
|
|
|
91
91
|
const promise = new Promise((resolve, reject) => {
|
|
92
92
|
readStream.on('error', (err) => {
|
|
93
|
+
console.error(chalk.red(`Error: failed to download from GitHub: ${zipFile}`));
|
|
94
|
+
console.error(err.message);
|
|
93
95
|
reject(err);
|
|
94
96
|
});
|
|
95
97
|
|
|
@@ -172,7 +174,7 @@ export const installFromGithub = async (name: string, repo: string, {verbose = f
|
|
|
172
174
|
}
|
|
173
175
|
catch (err) {
|
|
174
176
|
deleteSync([dir]);
|
|
175
|
-
|
|
177
|
+
process.exit(1);
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
// add to cache
|
|
@@ -183,7 +185,7 @@ export const installFromGithub = async (name: string, repo: string, {verbose = f
|
|
|
183
185
|
silent || logUpdate.done();
|
|
184
186
|
}
|
|
185
187
|
|
|
186
|
-
const config = await readVesselConfig(dir);
|
|
188
|
+
const config = await readVesselConfig(dir, {silent});
|
|
187
189
|
|
|
188
190
|
if (config) {
|
|
189
191
|
for (const {name, repo} of config.dependencies) {
|