docuapi 1.0.1 → 1.0.2
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/bin/index.js +44 -2
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -25,9 +25,51 @@ const path = require("path");
|
|
|
25
25
|
|
|
26
26
|
const projectRoot = process.cwd();
|
|
27
27
|
// process.cwd() - CWD -> current working directory
|
|
28
|
-
|
|
29
28
|
// Coletando a pasta em que o usuário rodou o comando
|
|
30
29
|
|
|
31
|
-
|
|
32
30
|
console.log("📁 Analisando projeto em:");
|
|
33
31
|
console.log(projectRoot);
|
|
32
|
+
|
|
33
|
+
//--------------------------------------------------
|
|
34
|
+
|
|
35
|
+
if(fs.existsSync(path.join(process.cwd(), "package.json"))){
|
|
36
|
+
console.log("Projeto é Node")
|
|
37
|
+
}else {
|
|
38
|
+
console.log("Package.json não encontrado.\nVerifique se você está rodando o comando na raiz do projeto.")
|
|
39
|
+
process.exit(1)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const packageJsonPath = path.join(projectRoot, "package.json");
|
|
43
|
+
|
|
44
|
+
console.log(`caminho da pasta: ${packageJsonPath}`)
|
|
45
|
+
|
|
46
|
+
const packageJsonRaw = fs.readFileSync(packageJsonPath, "utf-8");
|
|
47
|
+
|
|
48
|
+
console.log(packageJsonRaw)
|
|
49
|
+
|
|
50
|
+
const packageJson = JSON.parse(packageJsonRaw);
|
|
51
|
+
|
|
52
|
+
console.log(`O projeto ${packageJson.name} na versão ${packageJson.version}, tem as seguintes dependencias:`)
|
|
53
|
+
console.log(packageJson.dependencies)
|
|
54
|
+
|
|
55
|
+
// const IGNORE_DIRS = ["node_modules", ".git", ".vscode"];
|
|
56
|
+
|
|
57
|
+
// function scanDir(dirPath) {
|
|
58
|
+
// const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
59
|
+
|
|
60
|
+
// for (const entry of entries) {
|
|
61
|
+
// if (IGNORE_DIRS.includes(entry.name)) continue;
|
|
62
|
+
|
|
63
|
+
// const fullPath = path.join(dirPath, entry.name);
|
|
64
|
+
|
|
65
|
+
// if (entry.isDirectory()) {
|
|
66
|
+
// console.log("📂 Pasta:", fullPath);
|
|
67
|
+
// scanDir(fullPath);
|
|
68
|
+
// } else {
|
|
69
|
+
// console.log("📄 Arquivo:", fullPath);
|
|
70
|
+
// }
|
|
71
|
+
// }
|
|
72
|
+
// }
|
|
73
|
+
|
|
74
|
+
// console.log("\n🌳 Estrutura do projeto:\n");
|
|
75
|
+
// scanDir(projectRoot);
|