ic-mops 0.29.0-0 → 0.29.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 +9 -0
- package/commands/add.ts +3 -12
- package/commands/init.ts +16 -9
- package/commands/transfer-ownership.ts +42 -0
- package/commands/update.ts +2 -30
- package/declarations/main/main.did +22 -21
- package/declarations/main/main.did.d.ts +20 -19
- package/declarations/main/main.did.js +25 -24
- package/dist/cli.js +8 -0
- package/dist/commands/add.js +3 -11
- package/dist/commands/init.js +16 -9
- package/dist/commands/transfer-ownership.d.ts +1 -0
- package/dist/commands/transfer-ownership.js +35 -0
- package/dist/commands/update.js +2 -27
- package/dist/declarations/main/main.did +22 -21
- package/dist/declarations/main/main.did.d.ts +20 -19
- package/dist/declarations/main/main.did.js +25 -24
- package/dist/mops.d.ts +2 -4
- package/dist/mops.js +4 -13
- package/dist/package.json +1 -1
- package/dist/vessel.js +10 -10
- package/mops.ts +5 -13
- package/package.json +1 -1
- package/vessel.ts +10 -10
package/vessel.ts
CHANGED
|
@@ -83,9 +83,9 @@ export const readVesselConfig = async (dir: string, {cache = true} = {}): Promis
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
export const downloadFromGithub = async (repo: string, dest: string, onProgress: any) => {
|
|
86
|
-
const {branch, org, gitName
|
|
86
|
+
const {branch, org, gitName} = parseGithubURL(repo);
|
|
87
87
|
|
|
88
|
-
const zipFile = `https://github.com/${org}/${gitName}/archive/${
|
|
88
|
+
const zipFile = `https://github.com/${org}/${gitName}/archive/${branch}.zip`;
|
|
89
89
|
const readStream = got.stream(zipFile);
|
|
90
90
|
|
|
91
91
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -99,7 +99,7 @@ export const downloadFromGithub = async (repo: string, dest: string, onProgress:
|
|
|
99
99
|
|
|
100
100
|
readStream.on('response', (response) => {
|
|
101
101
|
if (response.headers.age > 3600) {
|
|
102
|
-
console.
|
|
102
|
+
console.log(chalk.red('Error: ') + 'Failure - response too old');
|
|
103
103
|
readStream.destroy(); // Destroy the stream to prevent hanging resources.
|
|
104
104
|
reject();
|
|
105
105
|
return;
|
|
@@ -108,7 +108,7 @@ export const downloadFromGithub = async (repo: string, dest: string, onProgress:
|
|
|
108
108
|
// Prevent `onError` being called twice.
|
|
109
109
|
readStream.off('error', reject);
|
|
110
110
|
const tmpDir = path.resolve(process.cwd(), '.mops/_tmp/');
|
|
111
|
-
const tmpFile = path.resolve(tmpDir, `${gitName}@${
|
|
111
|
+
const tmpFile = path.resolve(tmpDir, `${gitName}@${branch}.zip`);
|
|
112
112
|
|
|
113
113
|
try {
|
|
114
114
|
mkdirSync(tmpDir, {recursive: true});
|
|
@@ -147,22 +147,22 @@ export const downloadFromGithub = async (repo: string, dest: string, onProgress:
|
|
|
147
147
|
};
|
|
148
148
|
|
|
149
149
|
export const installFromGithub = async (name: string, repo: string, {verbose = false, dep = false, silent = false} = {}) => {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
const {branch} = parseGithubURL(repo);
|
|
151
|
+
const dir = formatGithubDir(name, repo);
|
|
152
|
+
const cacheName = `github_${name}@${branch}`;
|
|
153
153
|
|
|
154
154
|
if (existsSync(dir)) {
|
|
155
|
-
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${
|
|
155
|
+
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${name}@${branch} (already installed) from Github`);
|
|
156
156
|
}
|
|
157
157
|
else if (isCached(cacheName)) {
|
|
158
158
|
await copyCache(cacheName, dir);
|
|
159
|
-
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${
|
|
159
|
+
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${name}@${branch} (cache) from Github`);
|
|
160
160
|
}
|
|
161
161
|
else {
|
|
162
162
|
mkdirSync(dir, {recursive: true});
|
|
163
163
|
|
|
164
164
|
let progress = (step: number, total: number) => {
|
|
165
|
-
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${
|
|
165
|
+
silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${name}@${branch} ${progressBar(step, total)}`);
|
|
166
166
|
};
|
|
167
167
|
|
|
168
168
|
progress(0, 2 * (1024 ** 2));
|