ic-mops 0.19.1 → 0.20.1
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/.gitignore +3 -0
- package/{cache.js → cache.ts} +8 -8
- package/{cli.js → cli.ts} +5 -5
- package/commands/{add.js → add.ts} +16 -8
- package/commands/{bump.js → bump.ts} +5 -5
- package/commands/{docs.js → docs.ts} +10 -10
- package/commands/{import-identity.js → import-identity.ts} +7 -7
- package/commands/{init.js → init.ts} +20 -17
- package/commands/{install-all.js → install-all.ts} +1 -1
- package/commands/{install.js → install.ts} +11 -11
- package/commands/{mmf1.js → mmf1.ts} +20 -18
- package/commands/{publish.js → publish.ts} +29 -16
- package/commands/{remove.js → remove.ts} +23 -16
- package/commands/{search.js → search.ts} +2 -2
- package/commands/self-update.ts +6 -0
- package/commands/{sources.js → sources.ts} +30 -24
- package/commands/{template.js → template.ts} +2 -2
- package/commands/{test.js → test.ts} +24 -19
- package/commands/{user.js → user.ts} +7 -2
- package/declarations/main/index.js +0 -2
- package/declarations/main/main.did +4 -1
- package/declarations/main/main.did.d.ts +4 -4
- package/declarations/main/main.did.js +20 -20
- package/declarations/storage/index.d.ts +50 -0
- package/declarations/storage/index.js +3 -11
- package/dist/cache.d.ts +5 -0
- package/dist/cache.js +46 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +265 -0
- package/dist/commands/add.d.ts +4 -0
- package/dist/commands/add.js +82 -0
- package/dist/commands/bump.d.ts +1 -0
- package/dist/commands/bump.js +50 -0
- package/dist/commands/docs.d.ts +3 -0
- package/dist/commands/docs.js +78 -0
- package/dist/commands/import-identity.d.ts +1 -0
- package/dist/commands/import-identity.js +47 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +82 -0
- package/dist/commands/install-all.d.ts +4 -0
- package/dist/commands/install-all.js +29 -0
- package/dist/commands/install.d.ts +5 -0
- package/dist/commands/install.js +110 -0
- package/dist/commands/mmf1.d.ts +21 -0
- package/dist/commands/mmf1.js +93 -0
- package/dist/commands/publish.d.ts +3 -0
- package/dist/commands/publish.js +254 -0
- package/dist/commands/remove.d.ts +5 -0
- package/dist/commands/remove.js +83 -0
- package/dist/commands/search.d.ts +1 -0
- package/dist/commands/search.js +36 -0
- package/dist/commands/self-update.d.ts +3 -0
- package/dist/commands/self-update.js +5 -0
- package/dist/commands/sources.d.ts +3 -0
- package/dist/commands/sources.js +124 -0
- package/dist/commands/template.d.ts +1 -0
- package/dist/commands/template.js +28 -0
- package/dist/commands/test.d.ts +4 -0
- package/dist/commands/test.js +201 -0
- package/dist/commands/user.d.ts +2 -0
- package/dist/commands/user.js +23 -0
- package/dist/commands/whoami.d.ts +1 -0
- package/dist/commands/whoami.js +11 -0
- package/dist/declarations/main/index.d.ts +50 -0
- package/dist/declarations/main/index.js +41 -0
- package/dist/declarations/main/main.did +222 -0
- package/dist/declarations/main/main.did.d.ts +198 -0
- package/dist/declarations/main/main.did.js +218 -0
- package/dist/declarations/storage/index.d.ts +50 -0
- package/dist/declarations/storage/index.js +30 -0
- package/dist/declarations/storage/storage.did +46 -0
- package/dist/declarations/storage/storage.did.d.ts +37 -0
- package/dist/declarations/storage/storage.did.js +38 -0
- package/dist/mops.d.ts +33 -0
- package/dist/mops.js +259 -0
- package/dist/package.json +79 -0
- package/dist/parallel.d.ts +1 -0
- package/dist/parallel.js +24 -0
- package/dist/pem.d.ts +5 -0
- package/dist/pem.js +49 -0
- package/dist/templates/mops-test.yml +30 -0
- package/dist/types.d.ts +27 -0
- package/dist/types.js +1 -0
- package/dist/vessel.d.ts +19 -0
- package/dist/vessel.js +154 -0
- package/global.d.ts +2 -0
- package/{mops.js → mops.ts} +56 -45
- package/package.json +44 -19
- package/{parallel.js → parallel.ts} +2 -2
- package/{pem.js → pem.ts} +12 -11
- package/templates/mops-test.yml +1 -1
- package/tsconfig.json +16 -0
- package/types.ts +29 -0
- package/{vessel.js → vessel.ts} +37 -25
- package/commands/self-update.js +0 -6
- /package/commands/{whoami.js → whoami.ts} +0 -0
package/{vessel.js → vessel.ts}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {existsSync, mkdirSync, createWriteStream, readFileSync, writeFileSync} from 'fs';
|
|
2
|
-
import
|
|
1
|
+
import {existsSync, mkdirSync, createWriteStream, readFileSync, writeFileSync} from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {deleteSync} from 'del';
|
|
3
4
|
import {execaCommand} from 'execa';
|
|
4
5
|
import chalk from 'chalk';
|
|
5
6
|
import logUpdate from 'log-update';
|
|
6
|
-
import {formatGithubDir, parseGithubURL, progressBar} from './mops.js';
|
|
7
|
-
import path from 'path';
|
|
8
7
|
import got from 'got';
|
|
9
8
|
import decompress from 'decompress';
|
|
10
9
|
import {pipeline} from 'stream';
|
|
10
|
+
import {formatGithubDir, parseGithubURL, progressBar} from './mops.js';
|
|
11
11
|
import {addCache, copyCache, isCached} from './cache.js';
|
|
12
12
|
|
|
13
|
-
const dhallFileToJson = async (filePath) => {
|
|
13
|
+
const dhallFileToJson = async (filePath: string) => {
|
|
14
14
|
if (existsSync(filePath)) {
|
|
15
15
|
let cwd = new URL(path.dirname(import.meta.url)).pathname;
|
|
16
16
|
let res;
|
|
@@ -33,34 +33,46 @@ const dhallFileToJson = async (filePath) => {
|
|
|
33
33
|
return null;
|
|
34
34
|
};
|
|
35
35
|
|
|
36
|
-
export
|
|
37
|
-
|
|
36
|
+
export type VesselConfig = {
|
|
37
|
+
dependencies: VesselDependencies;
|
|
38
|
+
'dev-dependencies': VesselDependencies;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type VesselDependencies = Array<{
|
|
42
|
+
name: string;
|
|
43
|
+
version?: string; // mops package
|
|
44
|
+
repo?: string; // github package
|
|
45
|
+
path?: string; // local package
|
|
46
|
+
}>;
|
|
47
|
+
|
|
48
|
+
export const readVesselConfig = async (dir: string, {cache = true} = {}): Promise<VesselConfig | null> => {
|
|
49
|
+
const cachedFile = (dir || process.cwd()) + '/vessel.json';
|
|
38
50
|
|
|
39
51
|
if (existsSync(cachedFile)) {
|
|
40
|
-
let cachedConfig = readFileSync(cachedFile);
|
|
52
|
+
let cachedConfig = readFileSync(cachedFile).toString();
|
|
41
53
|
return JSON.parse(cachedConfig);
|
|
42
54
|
}
|
|
43
55
|
|
|
44
56
|
const [vessel, packageSetArray] = await Promise.all([
|
|
45
|
-
dhallFileToJson((
|
|
46
|
-
dhallFileToJson((
|
|
57
|
+
dhallFileToJson((dir || process.cwd()) + '/vessel.dhall'),
|
|
58
|
+
dhallFileToJson((dir || process.cwd()) + '/package-set.dhall')
|
|
47
59
|
]);
|
|
48
60
|
|
|
49
61
|
if (!vessel || !packageSetArray) {
|
|
50
62
|
return null;
|
|
51
63
|
}
|
|
52
64
|
|
|
53
|
-
let repos = {};
|
|
65
|
+
let repos: Record<string, string> = {};
|
|
54
66
|
for (const {name, repo, version} of packageSetArray) {
|
|
55
67
|
const {org, gitName} = parseGithubURL(repo);
|
|
56
68
|
repos[name] = `https://github.com/${org}/${gitName}#${version}`;
|
|
57
69
|
}
|
|
58
70
|
|
|
59
|
-
let config = {
|
|
60
|
-
|
|
61
|
-
dependencies: vessel.dependencies.map((name) => {
|
|
71
|
+
let config: VesselConfig = {
|
|
72
|
+
dependencies: vessel.dependencies.map((name: string) => {
|
|
62
73
|
return {name, repo: repos[name], version: ''};
|
|
63
74
|
}),
|
|
75
|
+
'dev-dependencies': [],
|
|
64
76
|
};
|
|
65
77
|
|
|
66
78
|
if (cache === true) {
|
|
@@ -70,7 +82,7 @@ export const readVesselConfig = async (configFile, {cache = true} = {cache: true
|
|
|
70
82
|
return config;
|
|
71
83
|
};
|
|
72
84
|
|
|
73
|
-
export const downloadFromGithub = async (repo, dest, onProgress
|
|
85
|
+
export const downloadFromGithub = async (repo: string, dest: string, onProgress: any) => {
|
|
74
86
|
const {branch, org, gitName} = parseGithubURL(repo);
|
|
75
87
|
|
|
76
88
|
const zipFile = `https://github.com/${org}/${gitName}/archive/${branch}.zip`;
|
|
@@ -103,7 +115,7 @@ export const downloadFromGithub = async (repo, dest, onProgress = null) => {
|
|
|
103
115
|
|
|
104
116
|
pipeline(readStream, createWriteStream(tmpFile), (err) => {
|
|
105
117
|
if (err) {
|
|
106
|
-
|
|
118
|
+
deleteSync([tmpDir]);
|
|
107
119
|
reject(err);
|
|
108
120
|
}
|
|
109
121
|
else {
|
|
@@ -115,17 +127,17 @@ export const downloadFromGithub = async (repo, dest, onProgress = null) => {
|
|
|
115
127
|
},
|
|
116
128
|
};
|
|
117
129
|
decompress(tmpFile, dest, options).then((unzippedFiles) => {
|
|
118
|
-
|
|
130
|
+
deleteSync([tmpDir]);
|
|
119
131
|
resolve(unzippedFiles);
|
|
120
132
|
}).catch(err => {
|
|
121
|
-
|
|
133
|
+
deleteSync([tmpDir]);
|
|
122
134
|
reject(err);
|
|
123
135
|
});
|
|
124
136
|
}
|
|
125
137
|
});
|
|
126
138
|
}
|
|
127
139
|
catch (err) {
|
|
128
|
-
|
|
140
|
+
deleteSync([tmpDir]);
|
|
129
141
|
reject(err);
|
|
130
142
|
}
|
|
131
143
|
});
|
|
@@ -134,9 +146,7 @@ export const downloadFromGithub = async (repo, dest, onProgress = null) => {
|
|
|
134
146
|
return promise;
|
|
135
147
|
};
|
|
136
148
|
|
|
137
|
-
export const installFromGithub = async (name, repo,
|
|
138
|
-
const {verbose, dep, silent} = options;
|
|
139
|
-
|
|
149
|
+
export const installFromGithub = async (name: string, repo: string, {verbose = false, dep = false, silent = false} = {}) => {
|
|
140
150
|
const {branch} = parseGithubURL(repo);
|
|
141
151
|
const dir = formatGithubDir(name, repo);
|
|
142
152
|
const cacheName = `github_${name}@${branch}`;
|
|
@@ -151,7 +161,7 @@ export const installFromGithub = async (name, repo, options = {}) => {
|
|
|
151
161
|
else {
|
|
152
162
|
mkdirSync(dir, {recursive: true});
|
|
153
163
|
|
|
154
|
-
let progress = (step, total) => {
|
|
164
|
+
let progress = (step: number, total: number) => {
|
|
155
165
|
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${name}@${branch} ${progressBar(step, total)}`);
|
|
156
166
|
};
|
|
157
167
|
|
|
@@ -161,7 +171,7 @@ export const installFromGithub = async (name, repo, options = {}) => {
|
|
|
161
171
|
await downloadFromGithub(repo, dir, progress);
|
|
162
172
|
}
|
|
163
173
|
catch (err) {
|
|
164
|
-
|
|
174
|
+
deleteSync([dir]);
|
|
165
175
|
throw err;
|
|
166
176
|
}
|
|
167
177
|
|
|
@@ -177,7 +187,9 @@ export const installFromGithub = async (name, repo, options = {}) => {
|
|
|
177
187
|
|
|
178
188
|
if (config) {
|
|
179
189
|
for (const {name, repo} of config.dependencies) {
|
|
180
|
-
|
|
190
|
+
if (repo) {
|
|
191
|
+
await installFromGithub(name, repo, {verbose, silent, dep: true});
|
|
192
|
+
}
|
|
181
193
|
}
|
|
182
194
|
}
|
|
183
195
|
};
|
package/commands/self-update.js
DELETED
|
File without changes
|