ic-mops 0.42.0 → 0.43.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/bundle/cli.tgz CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.42.0",
3
+ "version": "0.42.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "bin/mops.js",
package/cache.ts CHANGED
@@ -5,6 +5,10 @@ import getFolderSize from 'get-folder-size';
5
5
 
6
6
  import {getDependencyType, globalCacheDir, parseGithubURL} from './mops.js';
7
7
 
8
+ export let show = () => {
9
+ return globalCacheDir;
10
+ };
11
+
8
12
  export let getDepCacheDir = (cacheName : string) => {
9
13
  return path.join(globalCacheDir, 'packages', cacheName);
10
14
  };
@@ -2,7 +2,7 @@ import path from 'node:path';
2
2
  import {SemVer} from 'semver';
3
3
  import chalk from 'chalk';
4
4
 
5
- import {getDependencyType, readConfig} from './mops.js';
5
+ import {getDependencyType, getRootDir, readConfig} from './mops.js';
6
6
  import {resolvePackages} from './resolve-packages.js';
7
7
  import {getMocVersion} from './helpers/get-moc-version.js';
8
8
 
@@ -18,12 +18,13 @@ export async function checkRequirements({verbose = false} = {}) {
18
18
  let installedMoc = new SemVer(mocVersion);
19
19
  let highestRequiredMoc = new SemVer('0.0.0');
20
20
  let highestRequiredMocPkgId = '';
21
+ let rootDir = getRootDir();
21
22
 
22
23
  let resolvedPackages = await resolvePackages();
23
24
  for (let [name, version] of Object.entries(resolvedPackages)) {
24
25
  if (getDependencyType(version) === 'mops') {
25
26
  let pkgId = `${name}@${version}`;
26
- let depConfig = readConfig(path.join('.mops', pkgId, 'mops.toml'));
27
+ let depConfig = readConfig(path.join(rootDir, '.mops', pkgId, 'mops.toml'));
27
28
  let moc = depConfig.requirements?.moc;
28
29
 
29
30
  if (moc) {
package/cli.ts CHANGED
@@ -13,7 +13,7 @@ import {whoami} from './commands/whoami.js';
13
13
  import {installAll} from './commands/install/install-all.js';
14
14
  import {search} from './commands/search.js';
15
15
  import {add} from './commands/add.js';
16
- import {cacheSize, cleanCache} from './cache.js';
16
+ import {cacheSize, cleanCache, show} from './cache.js';
17
17
  import {test} from './commands/test/test.js';
18
18
  import {template} from './commands/template.js';
19
19
  import {remove} from './commands/remove.js';
@@ -110,8 +110,11 @@ program
110
110
  await add(pkg, options);
111
111
  }
112
112
  else {
113
- await installAll(options);
113
+ let ok = await installAll(options);
114
114
  await toolchain.installAll(options);
115
+ if (!ok) {
116
+ process.exit(1);
117
+ }
115
118
  }
116
119
  });
117
120
 
@@ -196,7 +199,7 @@ program
196
199
  program
197
200
  .command('cache')
198
201
  .description('Manage cache')
199
- .addArgument(new Argument('<sub>').choices(['size', 'clean']))
202
+ .addArgument(new Argument('<sub>').choices(['size', 'clean', 'show']))
200
203
  .action(async (sub) => {
201
204
  if (sub == 'clean') {
202
205
  await cleanCache();
@@ -206,6 +209,9 @@ program
206
209
  let size = await cacheSize();
207
210
  console.log('Cache size is ' + size);
208
211
  }
212
+ else if (sub == 'show') {
213
+ console.log(show());
214
+ }
209
215
  });
210
216
 
211
217
  // test
@@ -15,9 +15,9 @@ type InstallAllOptions = {
15
15
  threads ?: number;
16
16
  }
17
17
 
18
- export async function installAll({verbose = false, silent = false, threads, lock} : InstallAllOptions = {}) {
18
+ export async function installAll({verbose = false, silent = false, threads, lock} : InstallAllOptions = {}) : Promise<boolean> {
19
19
  if (!checkConfigFile()) {
20
- return;
20
+ return false;
21
21
  }
22
22
 
23
23
  let config = readConfig();
@@ -25,9 +25,9 @@ export async function installAll({verbose = false, silent = false, threads, lock
25
25
  let devDeps = Object.values(config['dev-dependencies'] || {});
26
26
  let allDeps = [...deps, ...devDeps];
27
27
 
28
- let res = await installDeps(allDeps, {silent, verbose, threads});
29
- if (!res) {
30
- return;
28
+ let ok = await installDeps(allDeps, {silent, verbose, threads});
29
+ if (!ok) {
30
+ return false;
31
31
  }
32
32
 
33
33
  let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
@@ -36,7 +36,7 @@ export async function installAll({verbose = false, silent = false, threads, lock
36
36
  logUpdate('Checking integrity...');
37
37
  }
38
38
 
39
- let installedPackages = await syncLocalCache();
39
+ let installedPackages = await syncLocalCache({verbose});
40
40
 
41
41
  await Promise.all([
42
42
  notifyInstalls(installedPackages),
@@ -48,4 +48,6 @@ export async function installAll({verbose = false, silent = false, threads, lock
48
48
  await checkRequirements();
49
49
  console.log(chalk.green('Packages installed'));
50
50
  }
51
+
52
+ return true;
51
53
  }
@@ -13,10 +13,10 @@ type InstallDepOptions = {
13
13
 
14
14
  // install dependency
15
15
  // returns false if failed
16
- export async function installDep(dep : Dependency, {verbose, silent, threads} : InstallDepOptions = {}, parentPkgPath ?: string) : Promise<Record<string, string> | false> {
16
+ export async function installDep(dep : Dependency, {verbose, silent, threads} : InstallDepOptions = {}, parentPkgPath ?: string) : Promise<boolean> {
17
17
  if (dep.repo) {
18
18
  await installFromGithub(dep.name, dep.repo, {silent, verbose});
19
- return {};
19
+ return true;
20
20
  }
21
21
  else if (dep.path) {
22
22
  let depPath = dep.path;
@@ -30,5 +30,5 @@ export async function installDep(dep : Dependency, {verbose, silent, threads} :
30
30
  return installMopsDep(dep.name, dep.version, {silent, verbose, threads});
31
31
  }
32
32
 
33
- return {};
33
+ return true;
34
34
  }
@@ -10,22 +10,15 @@ type InstallDepsOptions = {
10
10
  // install all dependencies
11
11
  // returns actual installed dependencies
12
12
  // returns false if failed
13
- export async function installDeps(deps : Dependency[], {verbose, silent, threads} : InstallDepsOptions = {}, parentPkgPath ?: string) : Promise<Record<string, string> | false> {
14
- let installedDeps = {};
13
+ export async function installDeps(deps : Dependency[], {verbose, silent, threads} : InstallDepsOptions = {}, parentPkgPath ?: string) : Promise<boolean> {
15
14
  let ok = true;
15
+
16
16
  for (const dep of deps) {
17
17
  let res = await installDep(dep, {verbose, silent, threads}, parentPkgPath);
18
- if (res) {
19
- installedDeps = {...installedDeps, ...res};
20
- }
21
- else {
18
+ if (!res) {
22
19
  ok = false;
23
20
  }
24
21
  }
25
22
 
26
- if (!ok) {
27
- return false;
28
- }
29
-
30
- return installedDeps;
23
+ return ok;
31
24
  }
@@ -11,7 +11,7 @@ type InstallLocalDepOptions = {
11
11
 
12
12
  // skip install and just find non-local dependencies to install
13
13
  // pkgPath should be relative to the current root dir or absolute
14
- export async function installLocalDep(pkg : string, pkgPath = '', {verbose, silent} : InstallLocalDepOptions = {}) : Promise<Record<string, string> | false> {
14
+ export async function installLocalDep(pkg : string, pkgPath = '', {verbose, silent} : InstallLocalDepOptions = {}) : Promise<boolean> {
15
15
  if (!silent) {
16
16
  let logUpdate = createLogUpdate(process.stdout, {showCursor: true});
17
17
  logUpdate(`Local dependency ${pkg} = "${pkgPath}"`);
@@ -5,7 +5,7 @@ import {Buffer} from 'node:buffer';
5
5
  import {createLogUpdate} from 'log-update';
6
6
  import chalk from 'chalk';
7
7
  import {deleteSync} from 'del';
8
- import {checkConfigFile, formatDir, progressBar, readConfig} from '../../mops.js';
8
+ import {checkConfigFile, progressBar, readConfig} from '../../mops.js';
9
9
  import {getHighestVersion} from '../../api/getHighestVersion.js';
10
10
  import {storageActor} from '../../api/actors.js';
11
11
  import {parallel} from '../../parallel.js';
@@ -20,7 +20,7 @@ type InstallMopsDepOptions = {
20
20
  threads ?: number;
21
21
  };
22
22
 
23
- export async function installMopsDep(pkg : string, version = '', {verbose, silent, dep, threads} : InstallMopsDepOptions = {}) : Promise<Record<string, string> | false> {
23
+ export async function installMopsDep(pkg : string, version = '', {verbose, silent, dep, threads} : InstallMopsDepOptions = {}) : Promise<boolean> {
24
24
  threads = threads || 12;
25
25
 
26
26
  if (!checkConfigFile()) {
@@ -46,19 +46,12 @@ export async function installMopsDep(pkg : string, version = '', {verbose, silen
46
46
  version = versionRes.ok;
47
47
  }
48
48
 
49
- let dir = formatDir(pkg, version);
50
49
  let cacheName = getMopsDepCacheName(pkg, version);
51
50
  let cacheDir = getDepCacheDir(cacheName);
52
- let alreadyInstalled = false;
53
51
 
54
- // already installed
55
- if (fs.existsSync(dir)) {
56
- silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (local cache)`);
57
- alreadyInstalled = true;
58
- }
59
- // copy from cache
60
- else if (isDepCached(cacheName)) {
61
- silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (global cache)`);
52
+ // global cache hit
53
+ if (isDepCached(cacheName)) {
54
+ silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (cache)`);
62
55
  }
63
56
  // download
64
57
  else {
@@ -81,18 +74,26 @@ export async function installMopsDep(pkg : string, version = '', {verbose, silen
81
74
  progress();
82
75
  });
83
76
 
77
+ let onSigInt = () => {
78
+ deleteSync([cacheDir], {force: true});
79
+ process.exit();
80
+ };
81
+ process.on('SIGINT', onSigInt);
82
+
84
83
  // write files to global cache
85
84
  try {
86
- for (let [filePath, data] of filesData.entries()) {
87
- fs.mkdirSync(path.join(cacheDir, path.dirname(filePath)), {recursive: true});
88
- fs.writeFileSync(path.join(cacheDir, filePath), Buffer.from(data));
89
- }
85
+ await Promise.all(Array.from(filesData.entries()).map(async ([filePath, data]) => {
86
+ await fs.promises.mkdir(path.join(cacheDir, path.dirname(filePath)), {recursive: true});
87
+ await fs.promises.writeFile(path.join(cacheDir, filePath), Buffer.from(data));
88
+ }));
90
89
  }
91
90
  catch (err) {
92
91
  console.error(chalk.red('Error: ') + err);
93
92
  deleteSync([cacheDir], {force: true});
94
93
  return false;
95
94
  }
95
+
96
+ process.off('SIGINT', onSigInt);
96
97
  }
97
98
  catch (err) {
98
99
  console.error(chalk.red('Error: ') + err);
@@ -116,11 +117,6 @@ export async function installMopsDep(pkg : string, version = '', {verbose, silen
116
117
  if (!res) {
117
118
  return false;
118
119
  }
119
- let installedDeps = res;
120
120
 
121
- // add self to installed deps
122
- if (!alreadyInstalled) {
123
- installedDeps = {...installedDeps, [pkg]: version};
124
- }
125
- return installedDeps;
121
+ return true;
126
122
  }
@@ -28,7 +28,9 @@ export async function syncLocalCache({verbose = false} = {}) : Promise<Record<st
28
28
  }
29
29
 
30
30
  return Promise.resolve();
31
- }));
31
+ })).catch((errors) => {
32
+ throw errors?.[0];
33
+ });
32
34
 
33
35
  return installedDeps;
34
36
  }
package/dist/cache.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export declare let show: () => string;
1
2
  export declare let getDepCacheDir: (cacheName: string) => string;
2
3
  export declare let isDepCached: (cacheName: string) => boolean;
3
4
  export declare function getDepCacheName(name: string, version: string): string;
package/dist/cache.js CHANGED
@@ -3,6 +3,9 @@ import path from 'node:path';
3
3
  import ncp from 'ncp';
4
4
  import getFolderSize from 'get-folder-size';
5
5
  import { getDependencyType, globalCacheDir, parseGithubURL } from './mops.js';
6
+ export let show = () => {
7
+ return globalCacheDir;
8
+ };
6
9
  export let getDepCacheDir = (cacheName) => {
7
10
  return path.join(globalCacheDir, 'packages', cacheName);
8
11
  };
@@ -1,7 +1,7 @@
1
1
  import path from 'node:path';
2
2
  import { SemVer } from 'semver';
3
3
  import chalk from 'chalk';
4
- import { getDependencyType, readConfig } from './mops.js';
4
+ import { getDependencyType, getRootDir, readConfig } from './mops.js';
5
5
  import { resolvePackages } from './resolve-packages.js';
6
6
  import { getMocVersion } from './helpers/get-moc-version.js';
7
7
  export async function checkRequirements({ verbose = false } = {}) {
@@ -16,11 +16,12 @@ export async function checkRequirements({ verbose = false } = {}) {
16
16
  let installedMoc = new SemVer(mocVersion);
17
17
  let highestRequiredMoc = new SemVer('0.0.0');
18
18
  let highestRequiredMocPkgId = '';
19
+ let rootDir = getRootDir();
19
20
  let resolvedPackages = await resolvePackages();
20
21
  for (let [name, version] of Object.entries(resolvedPackages)) {
21
22
  if (getDependencyType(version) === 'mops') {
22
23
  let pkgId = `${name}@${version}`;
23
- let depConfig = readConfig(path.join('.mops', pkgId, 'mops.toml'));
24
+ let depConfig = readConfig(path.join(rootDir, '.mops', pkgId, 'mops.toml'));
24
25
  let moc = depConfig.requirements?.moc;
25
26
  if (moc) {
26
27
  let requiredMoc = new SemVer(moc);
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import { whoami } from './commands/whoami.js';
12
12
  import { installAll } from './commands/install/install-all.js';
13
13
  import { search } from './commands/search.js';
14
14
  import { add } from './commands/add.js';
15
- import { cacheSize, cleanCache } from './cache.js';
15
+ import { cacheSize, cleanCache, show } from './cache.js';
16
16
  import { test } from './commands/test/test.js';
17
17
  import { template } from './commands/template.js';
18
18
  import { remove } from './commands/remove.js';
@@ -91,8 +91,11 @@ program
91
91
  await add(pkg, options);
92
92
  }
93
93
  else {
94
- await installAll(options);
94
+ let ok = await installAll(options);
95
95
  await toolchain.installAll(options);
96
+ if (!ok) {
97
+ process.exit(1);
98
+ }
96
99
  }
97
100
  });
98
101
  // publish
@@ -169,7 +172,7 @@ program
169
172
  program
170
173
  .command('cache')
171
174
  .description('Manage cache')
172
- .addArgument(new Argument('<sub>').choices(['size', 'clean']))
175
+ .addArgument(new Argument('<sub>').choices(['size', 'clean', 'show']))
173
176
  .action(async (sub) => {
174
177
  if (sub == 'clean') {
175
178
  await cleanCache();
@@ -179,6 +182,9 @@ program
179
182
  let size = await cacheSize();
180
183
  console.log('Cache size is ' + size);
181
184
  }
185
+ else if (sub == 'show') {
186
+ console.log(show());
187
+ }
182
188
  });
183
189
  // test
184
190
  program
@@ -4,5 +4,5 @@ type InstallAllOptions = {
4
4
  lock?: 'check' | 'update' | 'ignore';
5
5
  threads?: number;
6
6
  };
7
- export declare function installAll({ verbose, silent, threads, lock }?: InstallAllOptions): Promise<void>;
7
+ export declare function installAll({ verbose, silent, threads, lock }?: InstallAllOptions): Promise<boolean>;
8
8
  export {};
@@ -9,21 +9,21 @@ import { syncLocalCache } from './sync-local-cache.js';
9
9
  import { notifyInstalls } from '../../notify-installs.js';
10
10
  export async function installAll({ verbose = false, silent = false, threads, lock } = {}) {
11
11
  if (!checkConfigFile()) {
12
- return;
12
+ return false;
13
13
  }
14
14
  let config = readConfig();
15
15
  let deps = Object.values(config.dependencies || {});
16
16
  let devDeps = Object.values(config['dev-dependencies'] || {});
17
17
  let allDeps = [...deps, ...devDeps];
18
- let res = await installDeps(allDeps, { silent, verbose, threads });
19
- if (!res) {
20
- return;
18
+ let ok = await installDeps(allDeps, { silent, verbose, threads });
19
+ if (!ok) {
20
+ return false;
21
21
  }
22
22
  let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
23
23
  if (!silent && lock !== 'ignore') {
24
24
  logUpdate('Checking integrity...');
25
25
  }
26
- let installedPackages = await syncLocalCache();
26
+ let installedPackages = await syncLocalCache({ verbose });
27
27
  await Promise.all([
28
28
  notifyInstalls(installedPackages),
29
29
  checkIntegrity(lock),
@@ -33,4 +33,5 @@ export async function installAll({ verbose = false, silent = false, threads, loc
33
33
  await checkRequirements();
34
34
  console.log(chalk.green('Packages installed'));
35
35
  }
36
+ return true;
36
37
  }
@@ -4,5 +4,5 @@ type InstallDepOptions = {
4
4
  silent?: boolean;
5
5
  threads?: number;
6
6
  };
7
- export declare function installDep(dep: Dependency, { verbose, silent, threads }?: InstallDepOptions, parentPkgPath?: string): Promise<Record<string, string> | false>;
7
+ export declare function installDep(dep: Dependency, { verbose, silent, threads }?: InstallDepOptions, parentPkgPath?: string): Promise<boolean>;
8
8
  export {};
@@ -8,7 +8,7 @@ import { getRootDir } from '../../mops.js';
8
8
  export async function installDep(dep, { verbose, silent, threads } = {}, parentPkgPath) {
9
9
  if (dep.repo) {
10
10
  await installFromGithub(dep.name, dep.repo, { silent, verbose });
11
- return {};
11
+ return true;
12
12
  }
13
13
  else if (dep.path) {
14
14
  let depPath = dep.path;
@@ -21,5 +21,5 @@ export async function installDep(dep, { verbose, silent, threads } = {}, parentP
21
21
  else if (dep.version) {
22
22
  return installMopsDep(dep.name, dep.version, { silent, verbose, threads });
23
23
  }
24
- return {};
24
+ return true;
25
25
  }
@@ -4,5 +4,5 @@ type InstallDepsOptions = {
4
4
  silent?: boolean;
5
5
  threads?: number;
6
6
  };
7
- export declare function installDeps(deps: Dependency[], { verbose, silent, threads }?: InstallDepsOptions, parentPkgPath?: string): Promise<Record<string, string> | false>;
7
+ export declare function installDeps(deps: Dependency[], { verbose, silent, threads }?: InstallDepsOptions, parentPkgPath?: string): Promise<boolean>;
8
8
  export {};
@@ -3,19 +3,12 @@ import { installDep } from './install-dep.js';
3
3
  // returns actual installed dependencies
4
4
  // returns false if failed
5
5
  export async function installDeps(deps, { verbose, silent, threads } = {}, parentPkgPath) {
6
- let installedDeps = {};
7
6
  let ok = true;
8
7
  for (const dep of deps) {
9
8
  let res = await installDep(dep, { verbose, silent, threads }, parentPkgPath);
10
- if (res) {
11
- installedDeps = { ...installedDeps, ...res };
12
- }
13
- else {
9
+ if (!res) {
14
10
  ok = false;
15
11
  }
16
12
  }
17
- if (!ok) {
18
- return false;
19
- }
20
- return installedDeps;
13
+ return ok;
21
14
  }
@@ -2,5 +2,5 @@ type InstallLocalDepOptions = {
2
2
  verbose?: boolean;
3
3
  silent?: boolean;
4
4
  };
5
- export declare function installLocalDep(pkg: string, pkgPath?: string, { verbose, silent }?: InstallLocalDepOptions): Promise<Record<string, string> | false>;
5
+ export declare function installLocalDep(pkg: string, pkgPath?: string, { verbose, silent }?: InstallLocalDepOptions): Promise<boolean>;
6
6
  export {};
@@ -4,5 +4,5 @@ type InstallMopsDepOptions = {
4
4
  dep?: boolean;
5
5
  threads?: number;
6
6
  };
7
- export declare function installMopsDep(pkg: string, version?: string, { verbose, silent, dep, threads }?: InstallMopsDepOptions): Promise<Record<string, string> | false>;
7
+ export declare function installMopsDep(pkg: string, version?: string, { verbose, silent, dep, threads }?: InstallMopsDepOptions): Promise<boolean>;
8
8
  export {};
@@ -5,7 +5,7 @@ import { Buffer } from 'node:buffer';
5
5
  import { createLogUpdate } from 'log-update';
6
6
  import chalk from 'chalk';
7
7
  import { deleteSync } from 'del';
8
- import { checkConfigFile, formatDir, progressBar, readConfig } from '../../mops.js';
8
+ import { checkConfigFile, progressBar, readConfig } from '../../mops.js';
9
9
  import { getHighestVersion } from '../../api/getHighestVersion.js';
10
10
  import { storageActor } from '../../api/actors.js';
11
11
  import { parallel } from '../../parallel.js';
@@ -34,18 +34,11 @@ export async function installMopsDep(pkg, version = '', { verbose, silent, dep,
34
34
  }
35
35
  version = versionRes.ok;
36
36
  }
37
- let dir = formatDir(pkg, version);
38
37
  let cacheName = getMopsDepCacheName(pkg, version);
39
38
  let cacheDir = getDepCacheDir(cacheName);
40
- let alreadyInstalled = false;
41
- // already installed
42
- if (fs.existsSync(dir)) {
43
- silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (local cache)`);
44
- alreadyInstalled = true;
45
- }
46
- // copy from cache
47
- else if (isDepCached(cacheName)) {
48
- silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (global cache)`);
39
+ // global cache hit
40
+ if (isDepCached(cacheName)) {
41
+ silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${pkg}@${version} (cache)`);
49
42
  }
50
43
  // download
51
44
  else {
@@ -63,18 +56,24 @@ export async function installMopsDep(pkg, version = '', { verbose, silent, dep,
63
56
  filesData.set(path, data);
64
57
  progress();
65
58
  });
59
+ let onSigInt = () => {
60
+ deleteSync([cacheDir], { force: true });
61
+ process.exit();
62
+ };
63
+ process.on('SIGINT', onSigInt);
66
64
  // write files to global cache
67
65
  try {
68
- for (let [filePath, data] of filesData.entries()) {
69
- fs.mkdirSync(path.join(cacheDir, path.dirname(filePath)), { recursive: true });
70
- fs.writeFileSync(path.join(cacheDir, filePath), Buffer.from(data));
71
- }
66
+ await Promise.all(Array.from(filesData.entries()).map(async ([filePath, data]) => {
67
+ await fs.promises.mkdir(path.join(cacheDir, path.dirname(filePath)), { recursive: true });
68
+ await fs.promises.writeFile(path.join(cacheDir, filePath), Buffer.from(data));
69
+ }));
72
70
  }
73
71
  catch (err) {
74
72
  console.error(chalk.red('Error: ') + err);
75
73
  deleteSync([cacheDir], { force: true });
76
74
  return false;
77
75
  }
76
+ process.off('SIGINT', onSigInt);
78
77
  }
79
78
  catch (err) {
80
79
  console.error(chalk.red('Error: ') + err);
@@ -94,10 +93,5 @@ export async function installMopsDep(pkg, version = '', { verbose, silent, dep,
94
93
  if (!res) {
95
94
  return false;
96
95
  }
97
- let installedDeps = res;
98
- // add self to installed deps
99
- if (!alreadyInstalled) {
100
- installedDeps = { ...installedDeps, [pkg]: version };
101
- }
102
- return installedDeps;
96
+ return true;
103
97
  }
@@ -21,6 +21,8 @@ export async function syncLocalCache({ verbose = false } = {}) {
21
21
  }
22
22
  }
23
23
  return Promise.resolve();
24
- }));
24
+ })).catch((errors) => {
25
+ throw errors?.[0];
26
+ });
25
27
  return installedDeps;
26
28
  }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "bin/mops.js",
package/dist/vessel.js CHANGED
@@ -8,7 +8,7 @@ import chalk from 'chalk';
8
8
  import { createLogUpdate } from 'log-update';
9
9
  import got from 'got';
10
10
  import decompress from 'decompress';
11
- import { formatGithubDir, parseGithubURL, progressBar } from './mops.js';
11
+ import { parseGithubURL, progressBar } from './mops.js';
12
12
  import { getDepCacheDir, getGithubDepCacheName, isDepCached } from './cache.js';
13
13
  const dhallFileToJson = async (filePath, silent) => {
14
14
  if (existsSync(filePath)) {
@@ -117,15 +117,11 @@ export const downloadFromGithub = async (repo, dest, onProgress) => {
117
117
  return promise;
118
118
  };
119
119
  export const installFromGithub = async (name, repo, { verbose = false, dep = false, silent = false } = {}) => {
120
- let dir = formatGithubDir(name, repo);
121
120
  let cacheName = getGithubDepCacheName(name, repo);
122
121
  let cacheDir = getDepCacheDir(cacheName);
123
122
  let logUpdate = createLogUpdate(process.stdout, { showCursor: true });
124
- if (existsSync(dir)) {
125
- silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${repo} (local cache)`);
126
- }
127
- else if (isDepCached(cacheName)) {
128
- silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${repo} (global cache)`);
123
+ if (isDepCached(cacheName)) {
124
+ silent || logUpdate(`${dep ? 'Dependency' : 'Installing'} ${repo} (cache)`);
129
125
  }
130
126
  else {
131
127
  let progress = (step, total) => {
@@ -147,7 +143,7 @@ export const installFromGithub = async (name, repo, { verbose = false, dep = fal
147
143
  else {
148
144
  logUpdate.clear();
149
145
  }
150
- const config = await readVesselConfig(dir, { silent });
146
+ const config = await readVesselConfig(cacheDir, { silent });
151
147
  if (config) {
152
148
  for (const { name, repo } of config.dependencies) {
153
149
  if (repo) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ic-mops",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "mops": "dist/bin/mops.js",