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/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, commitHash} = parseGithubURL(repo);
86
+ const {branch, org, gitName} = parseGithubURL(repo);
87
87
 
88
- const zipFile = `https://github.com/${org}/${gitName}/archive/${commitHash || branch}.zip`;
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.error(chalk.red('Error: ') + 'Failure - response too old');
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}@${commitHash || branch}.zip`);
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
- let {branch, commitHash} = parseGithubURL(repo);
151
- let dir = formatGithubDir(name, repo);
152
- let cacheName = `_github/${name}#${branch}` + (commitHash ? `@${commitHash}` : '');
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'} ${repo} (local cache) from Github`);
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'} ${repo} (global cache) from Github`);
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'} ${repo} ${progressBar(step, total)}`);
165
+ silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${name}@${branch} ${progressBar(step, total)}`);
166
166
  };
167
167
 
168
168
  progress(0, 2 * (1024 ** 2));