@elliemae/ds-codemods 3.22.0-next.28 → 3.22.0-next.29
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.
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import fse from 'fs-extra';
|
|
4
|
+
import path from 'path';
|
|
2
5
|
import depcheck from 'depcheck';
|
|
3
6
|
import {
|
|
4
7
|
brightYellowStr,
|
|
@@ -9,6 +12,14 @@ import {
|
|
|
9
12
|
} from '../../../utils/CLI_COLORS.mjs';
|
|
10
13
|
import { generatePathFromCurrentFolder } from '../../../utils/index.mjs';
|
|
11
14
|
|
|
15
|
+
function generateFolderIfNotExistSync(finalDir) {
|
|
16
|
+
if (!fs.existsSync(finalDir)) {
|
|
17
|
+
fs.mkdirSync(finalDir, { recursive: true });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const overWriteFile = fse.outputFileSync;
|
|
22
|
+
|
|
12
23
|
const logUnusedDep = (unused) => {
|
|
13
24
|
console.log(brightYellowStr('### Found unused dependencies :>>'));
|
|
14
25
|
console.log('```');
|
|
@@ -21,7 +32,7 @@ const logUnusedDevDep = (unused) => {
|
|
|
21
32
|
console.log(unused.devDependencies);
|
|
22
33
|
console.log('```');
|
|
23
34
|
};
|
|
24
|
-
const logMissing = (unused) => {
|
|
35
|
+
const logMissing = (unused, pathToRoot) => {
|
|
25
36
|
const missingString = [...Object.keys(unused.missing)].map((pack) => `\t${pack}`).join(',\n');
|
|
26
37
|
console.log(brightRedStr('### Found missing dependencies :>>'));
|
|
27
38
|
console.log('```');
|
|
@@ -29,6 +40,9 @@ const logMissing = (unused) => {
|
|
|
29
40
|
console.log(missingString);
|
|
30
41
|
console.log('}');
|
|
31
42
|
console.log('```');
|
|
43
|
+
console.log(path.cmd());
|
|
44
|
+
generateFolderIfNotExistSync('./r');
|
|
45
|
+
overWriteFile(`./r/${pathToRoot}_txt.txt`, missingString);
|
|
32
46
|
};
|
|
33
47
|
|
|
34
48
|
export const checkMissingPackages = async (options) => {
|
|
@@ -80,9 +94,14 @@ export const checkMissingPackages = async (options) => {
|
|
|
80
94
|
const hasErrors = unusedDep || unusedDevDep || missing;
|
|
81
95
|
console.log(boldBrightCyanStr(`# Dependencies results for ${pathToRoot}`));
|
|
82
96
|
console.log(boldBrightCyanStr(`[${pathToRoot}](${pathToRoot}package.json)`));
|
|
97
|
+
|
|
98
|
+
const root = process.cwd().split('/packages')[0];
|
|
99
|
+
console.log(">>>>>>>>>>", process)
|
|
100
|
+
console.log(process.cwd(), projectFolderPath);
|
|
101
|
+
|
|
83
102
|
if (unusedDep) logUnusedDep(unused);
|
|
84
103
|
if (unusedDevDep) logUnusedDevDep(unused);
|
|
85
|
-
if (missing) logMissing(unused);
|
|
104
|
+
if (missing) logMissing(unused, pathToRoot);
|
|
86
105
|
if (!hasErrors) console.log(greenStr(`no problems found!`));
|
|
87
106
|
});
|
|
88
107
|
};
|