ic-mops 0.9.0 → 0.9.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/commands/mmf1.js +2 -2
- package/package-lock.json +4844 -0
- package/package.json +1 -1
- package/commands/uninstall.js +0 -55
package/package.json
CHANGED
package/commands/uninstall.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import {checkConfigFile, readConfig} from '../mops.js';
|
|
2
|
-
import fs from 'fs';
|
|
3
|
-
import del from 'del';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import {formatDir, formatGithubDir} from '../mops.js';
|
|
6
|
-
|
|
7
|
-
export async function uninstall(pkg, version) {
|
|
8
|
-
if (!checkConfigFile()) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// TODO: check if deps relate on this package
|
|
13
|
-
const config = readConfig();
|
|
14
|
-
|
|
15
|
-
const pkgDetails = config.dependencies[pkg];
|
|
16
|
-
|
|
17
|
-
if (!pkgDetails) {
|
|
18
|
-
console.log(`No dependency to remove ${pkg} = "${version}"`);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const {repo} = pkgDetails;
|
|
23
|
-
let pkgDir;
|
|
24
|
-
|
|
25
|
-
if (repo) {
|
|
26
|
-
pkgDir = formatGithubDir(pkg, repo);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
pkgDir = formatDir(pkg, version);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (!fs.existsSync(pkgDir)) {
|
|
33
|
-
console.log(`No cache to remove ${pkg} = "${version}"`);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// don't remove if there are dependents
|
|
38
|
-
// let dependents = getDependents(pkg, version);
|
|
39
|
-
// if (dependents.length) {
|
|
40
|
-
// console.log(`Cache left ${pkg} = "${version}" (dependents: ${dependents})`)
|
|
41
|
-
// return;
|
|
42
|
-
// }
|
|
43
|
-
|
|
44
|
-
del.sync([`${pkgDir}/**`]);
|
|
45
|
-
|
|
46
|
-
console.log(chalk.green('Package removed ') + `${pkg} = "${version}"`);
|
|
47
|
-
|
|
48
|
-
// remove dependencies
|
|
49
|
-
// let text = fs.readFileSync(path.join(pkgDir, 'mops.toml')).toString();
|
|
50
|
-
// let config = TOML.parse(text);
|
|
51
|
-
|
|
52
|
-
// for (let [name, version] of Object.entries(config.dependencies)) {
|
|
53
|
-
// remove(name, version);
|
|
54
|
-
// }
|
|
55
|
-
}
|