mdsmith 1.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/bin/fundamentos.js +116 -0
- package/bin/index.js +116 -0
- package/bin/versaobeta.js +0 -0
- package/package.json +13 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// npx analyze --help # ajuda
|
|
4
|
+
// npx analyze --tree # mostra estrutura
|
|
5
|
+
// npx analyze --deps # mostra dependências
|
|
6
|
+
// npx analyze --readme # gera README
|
|
7
|
+
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
|
|
10
|
+
const path = require("path");
|
|
11
|
+
|
|
12
|
+
const projectRoot = process.cwd();
|
|
13
|
+
|
|
14
|
+
if(!fs.existsSync(path.join(process.cwd(), "package.json"))){
|
|
15
|
+
console.log("Package.json não encontrado.\nVerifique se você está rodando o comando na raiz do projeto.")
|
|
16
|
+
process.exit(1)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(projectRoot, "package.json"), "utf-8"));
|
|
20
|
+
|
|
21
|
+
const args = process.argv.slice(2)
|
|
22
|
+
|
|
23
|
+
const IGNORE_DIRS = ["node_modules", ".git", ".vscode"];
|
|
24
|
+
|
|
25
|
+
function formatDependencies(deps) {
|
|
26
|
+
if (!deps || Object.keys(deps).length === 0) {
|
|
27
|
+
return "Projeto sem dependências.";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return Object.entries(deps)
|
|
31
|
+
.map(([name, version]) => `- ${name} ${version}`)
|
|
32
|
+
.join("\n");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function scanDir(dirPath, padding) {
|
|
36
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
37
|
+
|
|
38
|
+
let treeContent = ""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
|
|
43
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
44
|
+
|
|
45
|
+
if (entry.isDirectory()) {
|
|
46
|
+
if (IGNORE_DIRS.includes(entry.name)){
|
|
47
|
+
treeContent += `${" ".repeat(padding*2)} 📂 ${entry.name}\n`
|
|
48
|
+
} else {
|
|
49
|
+
treeContent += `${" ".repeat(padding*2)} 📂 ${entry.name}\n`
|
|
50
|
+
padding ++
|
|
51
|
+
treeContent += scanDir(fullPath, padding)
|
|
52
|
+
padding --
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
treeContent += `${" ".repeat(padding*2)} 📄 ${entry.name}\n`
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return treeContent
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function generateReadme(packageJson, tree){
|
|
63
|
+
const content = `
|
|
64
|
+
# ${packageJson.name || "Nome não informado."}
|
|
65
|
+
|
|
66
|
+
${packageJson.description || "Projeto Node.js analisado automaticamente pelo Analyze."}
|
|
67
|
+
|
|
68
|
+
## 🔖 Informações
|
|
69
|
+
- **Versão:** ${packageJson.version || "Versão não informada."}
|
|
70
|
+
- **Gerenciador:** npm
|
|
71
|
+
- **Tipo:** Backend Node.js
|
|
72
|
+
|
|
73
|
+
## 🚀 Dependências
|
|
74
|
+
${formatDependencies(packageJson.dependencies)}
|
|
75
|
+
|
|
76
|
+
## 📁 Estrutura do Projeto
|
|
77
|
+
\`\`\`
|
|
78
|
+
${tree}
|
|
79
|
+
\`\`\`
|
|
80
|
+
|
|
81
|
+
📄 *README gerado automaticamente pelo **Analyze CLI***
|
|
82
|
+
`
|
|
83
|
+
|
|
84
|
+
return content
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if(args.length == 0){
|
|
89
|
+
console.log(`
|
|
90
|
+
Bem vindo ao Analyze!
|
|
91
|
+
Analisador de projetos Node.js
|
|
92
|
+
|
|
93
|
+
Digite analyze --help se quiser ver os comandos disponíveis
|
|
94
|
+
`);
|
|
95
|
+
process.exit(0);
|
|
96
|
+
} else if(args.includes("--help")){
|
|
97
|
+
console.log(`
|
|
98
|
+
npx analyze --help Mostra os comandos possíveis
|
|
99
|
+
npx analyze --tree Mostra a estrutura do projeto
|
|
100
|
+
npx analyze --deps Mostra as dependências
|
|
101
|
+
npx analyze --readme Gera um README automaticamente
|
|
102
|
+
`)
|
|
103
|
+
} else if (args.includes("--tree")){
|
|
104
|
+
console.log("\n🌳 Estrutura do projeto:\n");
|
|
105
|
+
console.log(scanDir(projectRoot, 0))
|
|
106
|
+
} else if (args.includes("--deps")){
|
|
107
|
+
console.log(`O projeto ${packageJson.name} na versão ${packageJson.version}, tem as seguintes dependencias:`)
|
|
108
|
+
const deps = packageJson.dependencies || "Projeto sem depedencias"
|
|
109
|
+
console.log(deps)
|
|
110
|
+
} else if (args.includes("--readme")){
|
|
111
|
+
const content = generateReadme(packageJson, scanDir(projectRoot, 0))
|
|
112
|
+
|
|
113
|
+
fs.writeFileSync("README-ANALYZE.md", content)
|
|
114
|
+
} else {
|
|
115
|
+
console.log("❌ Comando não reconhecido. Use --help para ver as opções.")
|
|
116
|
+
}
|
package/bin/index.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// npx analyze --help # ajuda
|
|
4
|
+
// npx analyze --tree # mostra estrutura
|
|
5
|
+
// npx analyze --deps # mostra dependências
|
|
6
|
+
// npx analyze --readme # gera README
|
|
7
|
+
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
|
|
10
|
+
const path = require("path");
|
|
11
|
+
|
|
12
|
+
const projectRoot = process.cwd();
|
|
13
|
+
|
|
14
|
+
if(!fs.existsSync(path.join(process.cwd(), "package.json"))){
|
|
15
|
+
console.log("Package.json não encontrado.\nVerifique se você está rodando o comando na raiz do projeto.")
|
|
16
|
+
process.exit(1)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const packageJson = JSON.parse(fs.readFileSync(path.join(projectRoot, "package.json"), "utf-8"));
|
|
20
|
+
|
|
21
|
+
const args = process.argv.slice(2)
|
|
22
|
+
|
|
23
|
+
const IGNORE_DIRS = ["node_modules", ".git", ".vscode"];
|
|
24
|
+
|
|
25
|
+
function formatDependencies(deps) {
|
|
26
|
+
if (!deps || Object.keys(deps).length === 0) {
|
|
27
|
+
return "Projeto sem dependências.";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return Object.entries(deps)
|
|
31
|
+
.map(([name, version]) => `- ${name} ${version}`)
|
|
32
|
+
.join("\n");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function scanDir(dirPath, padding) {
|
|
36
|
+
const entries = fs.readdirSync(dirPath, { withFileTypes: true });
|
|
37
|
+
|
|
38
|
+
let treeContent = ""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
for (const entry of entries) {
|
|
42
|
+
|
|
43
|
+
const fullPath = path.join(dirPath, entry.name);
|
|
44
|
+
|
|
45
|
+
if (entry.isDirectory()) {
|
|
46
|
+
if (IGNORE_DIRS.includes(entry.name)){
|
|
47
|
+
treeContent += `${" ".repeat(padding*2)} 📂 ${entry.name}\n`
|
|
48
|
+
} else {
|
|
49
|
+
treeContent += `${" ".repeat(padding*2)} 📂 ${entry.name}\n`
|
|
50
|
+
padding ++
|
|
51
|
+
treeContent += scanDir(fullPath, padding)
|
|
52
|
+
padding --
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
treeContent += `${" ".repeat(padding*2)} 📄 ${entry.name}\n`
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return treeContent
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function generateReadme(packageJson, tree){
|
|
63
|
+
const content = `
|
|
64
|
+
# ${packageJson.name || "Nome não informado."}
|
|
65
|
+
|
|
66
|
+
${packageJson.description || "Projeto Node.js analisado automaticamente pelo Analyze."}
|
|
67
|
+
|
|
68
|
+
## 🔖 Informações
|
|
69
|
+
- **Versão:** ${packageJson.version || "Versão não informada."}
|
|
70
|
+
- **Gerenciador:** npm
|
|
71
|
+
- **Tipo:** Backend Node.js
|
|
72
|
+
|
|
73
|
+
## 🚀 Dependências
|
|
74
|
+
${formatDependencies(packageJson.dependencies)}
|
|
75
|
+
|
|
76
|
+
## 📁 Estrutura do Projeto
|
|
77
|
+
\`\`\`
|
|
78
|
+
${tree}
|
|
79
|
+
\`\`\`
|
|
80
|
+
|
|
81
|
+
📄 *README gerado automaticamente pelo **Analyze CLI***
|
|
82
|
+
`
|
|
83
|
+
|
|
84
|
+
return content
|
|
85
|
+
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if(args.length == 0){
|
|
89
|
+
console.log(`
|
|
90
|
+
Bem vindo ao Analyze!
|
|
91
|
+
Analisador de projetos Node.js
|
|
92
|
+
|
|
93
|
+
Digite analyze --help se quiser ver os comandos disponíveis
|
|
94
|
+
`);
|
|
95
|
+
process.exit(0);
|
|
96
|
+
} else if(args.includes("--help")){
|
|
97
|
+
console.log(`
|
|
98
|
+
npx analyze --help Mostra os comandos possíveis
|
|
99
|
+
npx analyze --tree Mostra a estrutura do projeto
|
|
100
|
+
npx analyze --deps Mostra as dependências
|
|
101
|
+
npx analyze --readme Gera um README automaticamente
|
|
102
|
+
`)
|
|
103
|
+
} else if (args.includes("--tree")){
|
|
104
|
+
console.log("\n🌳 Estrutura do projeto:\n");
|
|
105
|
+
console.log(scanDir(projectRoot, 0))
|
|
106
|
+
} else if (args.includes("--deps")){
|
|
107
|
+
console.log(`O projeto ${packageJson.name} na versão ${packageJson.version}, tem as seguintes dependencias:`)
|
|
108
|
+
const deps = packageJson.dependencies || "Projeto sem depedencias"
|
|
109
|
+
console.log(deps)
|
|
110
|
+
} else if (args.includes("--readme")){
|
|
111
|
+
const content = generateReadme(packageJson, scanDir(projectRoot, 0))
|
|
112
|
+
|
|
113
|
+
fs.writeFileSync("README-ANALYZE.md", content)
|
|
114
|
+
} else {
|
|
115
|
+
console.log("❌ Comando não reconhecido. Use --help para ver as opções.")
|
|
116
|
+
}
|
|
File without changes
|
package/package.json
ADDED