@elliemae/ds-codemods 2.0.0-rc.6 → 2.0.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-codemods",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Code Mods",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -30,13 +30,16 @@
|
|
|
30
30
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"arg": "
|
|
34
|
-
"
|
|
33
|
+
"arg": "^5.0.1",
|
|
34
|
+
"chalk": "4.1.2",
|
|
35
|
+
"depcheck": "1.4.2",
|
|
36
|
+
"esm": "^3.2.25",
|
|
35
37
|
"fs": "0.0.1-security",
|
|
36
|
-
"fs-extra": "
|
|
37
|
-
"glob": "
|
|
38
|
-
"inquirer": "
|
|
39
|
-
"
|
|
38
|
+
"fs-extra": "^10.0.0",
|
|
39
|
+
"glob": "^7.2.0",
|
|
40
|
+
"inquirer": "^8.2.0",
|
|
41
|
+
"pacote": "12.0.2",
|
|
42
|
+
"path": "^0.12.7"
|
|
40
43
|
},
|
|
41
44
|
"publishConfig": {
|
|
42
45
|
"access": "public"
|
|
@@ -1,6 +1,30 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
1
2
|
import depcheck from 'depcheck';
|
|
2
3
|
import chalk from 'chalk';
|
|
3
4
|
import { generatePathFromCurrentFolder } from '../../../utils';
|
|
5
|
+
|
|
6
|
+
const logUnusedDep = (unused) => {
|
|
7
|
+
console.log(chalk.yellowBright('### Found unused dependencies :>>'));
|
|
8
|
+
console.log('```');
|
|
9
|
+
console.log(unused.dependencies);
|
|
10
|
+
console.log('```');
|
|
11
|
+
};
|
|
12
|
+
const logUnusedDevDep = (unused) => {
|
|
13
|
+
console.log(chalk.magentaBright('### Found unused dev dependencies :>>'));
|
|
14
|
+
console.log('```');
|
|
15
|
+
console.log(unused.devDependencies);
|
|
16
|
+
console.log('```');
|
|
17
|
+
};
|
|
18
|
+
const logMissing = (unused) => {
|
|
19
|
+
const missingString = [...Object.keys(unused.missing)].map((pack) => `\t${pack}`).join(',\n');
|
|
20
|
+
console.log(chalk.redBright('### Found missing dependencies :>>'));
|
|
21
|
+
console.log('```');
|
|
22
|
+
console.log('{');
|
|
23
|
+
console.log(missingString);
|
|
24
|
+
console.log('}');
|
|
25
|
+
console.log('```');
|
|
26
|
+
};
|
|
27
|
+
|
|
4
28
|
export const checkMissingPackages = async (options) => {
|
|
5
29
|
const { projectFolderPath, ignorePackagesGlobPattern, ignoreFilesGlobPattern } = options;
|
|
6
30
|
const ignorePatterns = ignorePackagesGlobPattern
|
|
@@ -42,22 +66,17 @@ export const checkMissingPackages = async (options) => {
|
|
|
42
66
|
ignoreMatches,
|
|
43
67
|
};
|
|
44
68
|
const pathToRoot = generatePathFromCurrentFolder(projectFolderPath);
|
|
45
|
-
|
|
69
|
+
|
|
46
70
|
depcheck(pathToRoot, depCheckOptions).then((unused) => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (
|
|
57
|
-
noError = false;
|
|
58
|
-
console.log(chalk.redBright('Found missing dependencies :>> '), unused.missing);
|
|
59
|
-
}
|
|
60
|
-
if (noError) console.log(chalk.bold.greenBright(`no errors found!`));
|
|
61
|
-
console.log('\n');
|
|
71
|
+
const unusedDep = Array.isArray(unused.dependencies) && unused.dependencies.length > 0;
|
|
72
|
+
const unusedDevDep = Array.isArray(unused.devDependencies) && unused.devDependencies.length > 0;
|
|
73
|
+
const missing = Object.keys(unused.missing).length > 0;
|
|
74
|
+
const hasErrors = unusedDep || unusedDevDep || missing;
|
|
75
|
+
console.log(chalk.bold.cyanBright(`# Dependencies results for ${pathToRoot}`));
|
|
76
|
+
console.log(chalk.bold.cyanBright(`[${pathToRoot}](${pathToRoot}package.json)`));
|
|
77
|
+
if (unusedDep) logUnusedDep(unused);
|
|
78
|
+
if (unusedDevDep) logUnusedDevDep(unused);
|
|
79
|
+
if (missing) logMissing(unused);
|
|
80
|
+
if (!hasErrors) console.log(chalk.bold.green(`no problems found!`));
|
|
62
81
|
});
|
|
63
82
|
};
|