web-architect-cli 1.0.8 → 1.0.9
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 +173 -125
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
|
|
4
3
|
if (process.platform === "win32") {
|
|
5
4
|
try {
|
|
6
5
|
require("child_process").execSync("chcp 65001", { stdio: 'ignore' });
|
|
@@ -34,7 +33,6 @@ console.log(' 🤖 SMART COMMIT - ANÁLISE DINÂMICA');
|
|
|
34
33
|
console.log('=============================================');
|
|
35
34
|
|
|
36
35
|
try {
|
|
37
|
-
// 1. Pega os arquivos alterados (git status --porcelain)
|
|
38
36
|
const statusOutput = execSync('git status --porcelain').toString();
|
|
39
37
|
|
|
40
38
|
if (!statusOutput.trim()) {
|
|
@@ -42,7 +40,6 @@ try {
|
|
|
42
40
|
process.exit(0);
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
// 2. Processa a lista de arquivos
|
|
46
43
|
const linhas = statusOutput.split('\\n').filter(l => l.trim());
|
|
47
44
|
const arquivos = linhas.map(l => {
|
|
48
45
|
const tipo = l.substring(0, 2).trim();
|
|
@@ -53,7 +50,6 @@ try {
|
|
|
53
50
|
const qtd = arquivos.length;
|
|
54
51
|
const nomesArquivos = arquivos.map(a => a.arquivo).join(', ');
|
|
55
52
|
|
|
56
|
-
// Separa título e corpo se for muito longo
|
|
57
53
|
let tituloSugerido = '';
|
|
58
54
|
let corpoSugerido = '';
|
|
59
55
|
|
|
@@ -90,21 +86,16 @@ try {
|
|
|
90
86
|
} else {
|
|
91
87
|
console.log(\` [2] (Opção igual a 1 pois são poucos arquivos)\`);
|
|
92
88
|
}
|
|
93
|
-
|
|
94
89
|
console.log(' [3] Manual (Digitar sua própria mensagem)');
|
|
95
90
|
|
|
96
91
|
rl.question('\\n👉 Escolha (1-3): ', (msgOpcao) => {
|
|
97
|
-
let comandoGit = '';
|
|
98
|
-
|
|
99
92
|
if (msgOpcao.trim() === '3') {
|
|
100
93
|
rl.question('✍️ Digite a mensagem: ', (manualMsg) => {
|
|
101
94
|
executarCommit(tipo, manualMsg, '');
|
|
102
95
|
});
|
|
103
96
|
} else if (msgOpcao.trim() === '2' && corpoSugerido) {
|
|
104
|
-
// Commit com Título + Corpo (Description)
|
|
105
97
|
executarCommit(tipo, tituloSugerido, corpoSugerido);
|
|
106
98
|
} else {
|
|
107
|
-
// Commit Simples
|
|
108
99
|
executarCommit(tipo, tituloSugerido, '');
|
|
109
100
|
}
|
|
110
101
|
});
|
|
@@ -117,16 +108,11 @@ try {
|
|
|
117
108
|
|
|
118
109
|
function executarCommit(tipo, titulo, corpo) {
|
|
119
110
|
const msgFinal = \`\${tipo}: \${titulo}\`;
|
|
120
|
-
|
|
121
111
|
console.log('\\n⏳ Executando git add .');
|
|
122
112
|
execSync('git add .');
|
|
123
|
-
|
|
124
113
|
console.log(\`⏳ Commitando: "\${msgFinal}"\`);
|
|
125
|
-
|
|
126
114
|
try {
|
|
127
|
-
// Se tiver corpo, usamos -m duas vezes ou uma string multilinha
|
|
128
115
|
if (corpo) {
|
|
129
|
-
// Estratégia segura para multiline no terminal
|
|
130
116
|
execSync(\`git commit -m "\${msgFinal}" -m "\${corpo}"\`, { stdio: 'inherit' });
|
|
131
117
|
} else {
|
|
132
118
|
execSync(\`git commit -m "\${msgFinal}"\`, { stdio: 'inherit' });
|
|
@@ -140,53 +126,109 @@ function executarCommit(tipo, titulo, corpo) {
|
|
|
140
126
|
`;
|
|
141
127
|
|
|
142
128
|
// ==========================================
|
|
143
|
-
// 2.
|
|
129
|
+
// 2. SCRIPT DE VERIFICAÇÃO INTERATIVA (NOVO)
|
|
144
130
|
// ==========================================
|
|
145
|
-
const
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
|
149
|
-
<%@ taglib prefix="snk" uri="/WEB-INF/tld/sankhyaUtil.tld" %>
|
|
150
|
-
<html>
|
|
151
|
-
<head>
|
|
152
|
-
<meta charset="UTF-8">
|
|
153
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
154
|
-
<title>Meu modelo</title>
|
|
155
|
-
<script src="\${BASE_FOLDER}/src/assets/js/tailwindcss.js"></script>
|
|
156
|
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
157
|
-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
|
158
|
-
<link rel="stylesheet" href="\${BASE_FOLDER}/src/assets/css/style.css">
|
|
159
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@jtandrelevicius/utils-js-library@latest/index.js"></script>
|
|
160
|
-
<snk:load/>
|
|
161
|
-
</head>
|
|
162
|
-
<body>
|
|
163
|
-
<header class="header"></header>
|
|
164
|
-
<main class="main"></main>
|
|
165
|
-
<script type="module" src="\${BASE_FOLDER}/src/main.js"></script>
|
|
166
|
-
</body>
|
|
167
|
-
</html>`;
|
|
131
|
+
const CONTEUDO_VERIFY_JS = `const { ESLint } = require("eslint");
|
|
132
|
+
const fs = require('fs');
|
|
133
|
+
const readline = require('readline');
|
|
168
134
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
135
|
+
async function verificarCodigo() {
|
|
136
|
+
console.log('\\n🔎 [Check] Iniciando análise de código e segurança...');
|
|
137
|
+
|
|
138
|
+
const eslint = new ESLint({ fix: true });
|
|
139
|
+
|
|
140
|
+
const results = await eslint.lintFiles(["src/**/*.js"]);
|
|
141
|
+
|
|
142
|
+
const arquivosComProblemas = results.filter(r => r.messages.length > 0);
|
|
143
|
+
|
|
144
|
+
if (arquivosComProblemas.length === 0) {
|
|
145
|
+
console.log('✅ [Check] Nenhum problema encontrado. Código limpo!');
|
|
146
|
+
process.exit(0);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const rl = readline.createInterface({
|
|
150
|
+
input: process.stdin,
|
|
151
|
+
output: process.stdout
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const question = (str) => new Promise(resolve => rl.question(str, resolve));
|
|
155
|
+
|
|
156
|
+
for (const result of arquivosComProblemas) {
|
|
157
|
+
const nomeArquivo = result.filePath.split('src')[1] || result.filePath;
|
|
158
|
+
|
|
159
|
+
console.log(\`\\n--------------------------------------------------\`);
|
|
160
|
+
console.log(\`⚠️ Problemas encontrados em: src\${nomeArquivo}\`);
|
|
161
|
+
console.log(\`--------------------------------------------------\`);
|
|
162
|
+
|
|
163
|
+
result.messages.forEach(msg => {
|
|
164
|
+
console.log(\` 🔴 [Linha \${msg.line}] \${msg.message} (\${msg.ruleId})\`);
|
|
165
|
+
try {
|
|
166
|
+
const fileContent = fs.readFileSync(result.filePath, 'utf-8').split('\\n');
|
|
167
|
+
if (fileContent[msg.line - 1]) {
|
|
168
|
+
console.log(\` Como está: "\${fileContent[msg.line - 1].trim()}"\`);
|
|
169
|
+
}
|
|
170
|
+
} catch(e) {}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
if (result.output && result.output !== result.source) {
|
|
174
|
+
console.log(\`\\n✨ O sistema pode corrigir isso automaticamente (Formatação/Segurança/Boas Práticas).\`);
|
|
175
|
+
console.log(\` (Isso aplicará as correções recomendadas pelo padrão do projeto)\`);
|
|
176
|
+
|
|
177
|
+
const resposta = await question('👉 Deseja aplicar as correções neste arquivo? (s/n): ');
|
|
178
|
+
|
|
179
|
+
if (resposta.toLowerCase() === 's') {
|
|
180
|
+
await ESLint.outputFixes([result]);
|
|
181
|
+
console.log('✅ Correções aplicadas!');
|
|
182
|
+
} else {
|
|
183
|
+
console.log('⏭️ Ignorando alterações.');
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
console.log('\\nℹ️ Esses erros precisam de correção manual.');
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
console.log('\\n🏁 Verificação concluída.');
|
|
191
|
+
rl.close();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
verificarCodigo().catch((error) => {
|
|
195
|
+
console.error('Erro na verificação:', error);
|
|
196
|
+
process.exit(1);
|
|
197
|
+
});
|
|
198
|
+
`;
|
|
186
199
|
|
|
200
|
+
// ==========================================
|
|
201
|
+
// 3. CONFIGURAÇÃO ESLINT
|
|
202
|
+
// ==========================================
|
|
203
|
+
const CONTEUDO_ESLINT = `module.exports = {
|
|
204
|
+
"env": {
|
|
205
|
+
"browser": true,
|
|
206
|
+
"es2021": true,
|
|
207
|
+
"jquery": true
|
|
208
|
+
},
|
|
209
|
+
"extends": "eslint:recommended",
|
|
210
|
+
"parserOptions": {
|
|
211
|
+
"ecmaVersion": 12,
|
|
212
|
+
"sourceType": "module"
|
|
213
|
+
},
|
|
214
|
+
"rules": {
|
|
215
|
+
"no-unused-vars": "warn",
|
|
216
|
+
"no-console": "off",
|
|
217
|
+
"eqeqeq": "warn",
|
|
218
|
+
"curly": "error",
|
|
219
|
+
"no-eval": "error",
|
|
220
|
+
"no-implied-eval": "error",
|
|
221
|
+
"no-alert": "warn"
|
|
222
|
+
}
|
|
223
|
+
};`;
|
|
224
|
+
|
|
225
|
+
// ==========================================
|
|
226
|
+
// 4. TEMPLATE WEB
|
|
227
|
+
// ==========================================
|
|
187
228
|
const CONTEUDO_BUILD_JS = `const fs = require('fs');
|
|
188
229
|
const archiver = require('archiver');
|
|
189
230
|
const path = require('path');
|
|
231
|
+
const { execSync } = require('child_process');
|
|
190
232
|
|
|
191
233
|
const CONFIG = {
|
|
192
234
|
MODO_AUTOMATICO: true,
|
|
@@ -202,6 +244,15 @@ let isBuilding = false;
|
|
|
202
244
|
function gerarZip() {
|
|
203
245
|
if (isBuilding) return;
|
|
204
246
|
isBuilding = true;
|
|
247
|
+
|
|
248
|
+
try {
|
|
249
|
+
execSync('node verify.js', { stdio: 'inherit' });
|
|
250
|
+
} catch (e) {
|
|
251
|
+
console.log('❌ Build cancelado durante a verificação.');
|
|
252
|
+
isBuilding = false;
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
|
|
205
256
|
console.log('📦 [Build] Compactando arquivos...');
|
|
206
257
|
|
|
207
258
|
const output = fs.createWriteStream(path.join(__dirname, CONFIG.NOME_ZIP));
|
|
@@ -239,7 +290,8 @@ if (CONFIG.MODO_AUTOMATICO) {
|
|
|
239
290
|
|
|
240
291
|
pathsToWatch.forEach(targetPath => {
|
|
241
292
|
fs.watch(targetPath, { recursive: true }, (eventType, filename) => {
|
|
242
|
-
|
|
293
|
+
// Ignora o proprio zip e arquivos temporarios para evitar loop
|
|
294
|
+
if (filename && !filename.includes(CONFIG.NOME_ZIP) && !filename.includes('.tmp')) {
|
|
243
295
|
clearTimeout(debounceTimeout);
|
|
244
296
|
debounceTimeout = setTimeout(() => {
|
|
245
297
|
console.log(\`📝 Alteração detectada: \${filename}\`);
|
|
@@ -251,9 +303,48 @@ if (CONFIG.MODO_AUTOMATICO) {
|
|
|
251
303
|
}
|
|
252
304
|
`;
|
|
253
305
|
|
|
254
|
-
|
|
255
|
-
//
|
|
256
|
-
|
|
306
|
+
const CONTEUDO_INDEX_JSP = `<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored ="false"%>
|
|
307
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
308
|
+
<%@ page import="java.util.*" %>
|
|
309
|
+
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
|
|
310
|
+
<%@ taglib prefix="snk" uri="/WEB-INF/tld/sankhyaUtil.tld" %>
|
|
311
|
+
<html>
|
|
312
|
+
<head>
|
|
313
|
+
<meta charset="UTF-8">
|
|
314
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
315
|
+
<title>Meu modelo</title>
|
|
316
|
+
<script src="\${BASE_FOLDER}/src/assets/js/tailwindcss.js"></script>
|
|
317
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
318
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
|
319
|
+
<link rel="stylesheet" href="\${BASE_FOLDER}/src/assets/css/style.css">
|
|
320
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@jtandrelevicius/utils-js-library@latest/index.js"></script>
|
|
321
|
+
<snk:load/>
|
|
322
|
+
</head>
|
|
323
|
+
<body>
|
|
324
|
+
<header class="header"></header>
|
|
325
|
+
<main class="main"></main>
|
|
326
|
+
<script type="module" src="\${BASE_FOLDER}/src/main.js"></script>
|
|
327
|
+
</body>
|
|
328
|
+
</html>`;
|
|
329
|
+
|
|
330
|
+
const CONTEUDO_INDEX_HTML = `<!DOCTYPE html>
|
|
331
|
+
<html lang="pt-BR">
|
|
332
|
+
<head>
|
|
333
|
+
<meta charset="UTF-8">
|
|
334
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
335
|
+
<title>Meu modelo</title>
|
|
336
|
+
<script src="src/assets/js/tailwindcss.js"></script>
|
|
337
|
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
338
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
|
339
|
+
<link rel="stylesheet" href="./src/assets/css/style.css">
|
|
340
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@jtandrelevicius/utils-js-library@latest/index.js"></script>
|
|
341
|
+
<body>
|
|
342
|
+
<header class="header"></header>
|
|
343
|
+
<main class="main"></main>
|
|
344
|
+
<script type="module" src="src/main.js"></script>
|
|
345
|
+
</body>
|
|
346
|
+
</html>`;
|
|
347
|
+
|
|
257
348
|
const CONTEUDO_GITIGNORE_HTML = `node_modules/\n*.zip\n.DS_Store\n`;
|
|
258
349
|
const CONTEUDO_GITIGNORE_GERAL = `node_modules/\n*.zip\n.DS_Store\n`;
|
|
259
350
|
const CONTEUDO_GITIGNORE_JAVA = `node_modules/\nout/\n.idea/workspace.xml\n.idea/usage.statistics.xml\n*.iws\n.DS_Store\n`;
|
|
@@ -274,10 +365,9 @@ function criarArquivo(caminho, conteudo) {
|
|
|
274
365
|
}
|
|
275
366
|
|
|
276
367
|
// ==========================================
|
|
277
|
-
//
|
|
368
|
+
// 5. FUNÇÕES DE CRIAÇÃO
|
|
278
369
|
// ==========================================
|
|
279
370
|
|
|
280
|
-
// --- MODELO 1: HTML5 (Web) ---
|
|
281
371
|
function criarProjetoHTML5(raiz, nomeProjeto) {
|
|
282
372
|
const pastas = [
|
|
283
373
|
'src/assets/css',
|
|
@@ -294,8 +384,13 @@ function criarProjetoHTML5(raiz, nomeProjeto) {
|
|
|
294
384
|
|
|
295
385
|
criarArquivo(path.join(raiz, 'index.jsp'), CONTEUDO_INDEX_JSP);
|
|
296
386
|
criarArquivo(path.join(raiz, 'index.html'), CONTEUDO_INDEX_HTML);
|
|
387
|
+
|
|
297
388
|
criarArquivo(path.join(raiz, 'build.js'), CONTEUDO_BUILD_JS);
|
|
298
|
-
criarArquivo(path.join(raiz, 'commit.js'), CONTEUDO_COMMIT_JS);
|
|
389
|
+
criarArquivo(path.join(raiz, 'commit.js'), CONTEUDO_COMMIT_JS);
|
|
390
|
+
|
|
391
|
+
criarArquivo(path.join(raiz, 'verify.js'), CONTEUDO_VERIFY_JS);
|
|
392
|
+
criarArquivo(path.join(raiz, '.eslintrc.js'), CONTEUDO_ESLINT);
|
|
393
|
+
|
|
299
394
|
criarArquivo(path.join(raiz, '.gitignore'), CONTEUDO_GITIGNORE_HTML);
|
|
300
395
|
criarArquivo(path.join(raiz, '.gitattributes'), CONTEUDO_GITATTRIBUTES);
|
|
301
396
|
criarArquivo(path.join(raiz, 'README.md'), `# ${nomeProjeto}\n\nProjeto Web (HTML5/JSP) gerado automaticamente.`);
|
|
@@ -307,8 +402,9 @@ function criarProjetoHTML5(raiz, nomeProjeto) {
|
|
|
307
402
|
main: "src/main.js",
|
|
308
403
|
scripts: {
|
|
309
404
|
"build": "node build.js",
|
|
310
|
-
"start": "node build.js",
|
|
311
|
-
"commit": "node commit.js"
|
|
405
|
+
"start": "node build.js",
|
|
406
|
+
"commit": "node commit.js",
|
|
407
|
+
"check": "node verify.js"
|
|
312
408
|
},
|
|
313
409
|
author: "",
|
|
314
410
|
license: "ISC"
|
|
@@ -328,25 +424,16 @@ function criarProjetoHTML5(raiz, nomeProjeto) {
|
|
|
328
424
|
try {
|
|
329
425
|
logPasso('Git', 'Inicializando repositório...');
|
|
330
426
|
execSync('git init', { cwd: raiz, stdio: 'ignore' });
|
|
331
|
-
|
|
332
|
-
|
|
427
|
+
|
|
428
|
+
logPasso('NPM', 'Instalando dependências (ESLint, etc)...');
|
|
429
|
+
|
|
430
|
+
execSync('npm install archiver eslint', { cwd: raiz, stdio: 'ignore' });
|
|
431
|
+
|
|
333
432
|
} catch (e) { console.error('Erro na configuração:', e.message); }
|
|
334
433
|
}
|
|
335
434
|
|
|
336
|
-
// --- MODELO 2: PERSONALIZACAO (Banco) ---
|
|
337
435
|
function criarProjetoPersonalizacao(raiz, nomeProjeto) {
|
|
338
|
-
const pastas = [
|
|
339
|
-
'doc',
|
|
340
|
-
'src/Dashboard',
|
|
341
|
-
'src/Function',
|
|
342
|
-
'src/Procedure',
|
|
343
|
-
'src/Relatorio',
|
|
344
|
-
'src/SQL',
|
|
345
|
-
'src/Tela',
|
|
346
|
-
'src/Trigger',
|
|
347
|
-
'src/View'
|
|
348
|
-
];
|
|
349
|
-
|
|
436
|
+
const pastas = ['doc','src/Dashboard','src/Function','src/Procedure','src/Relatorio','src/SQL','src/Tela','src/Trigger','src/View'];
|
|
350
437
|
pastas.forEach(p => criarPasta(path.join(raiz, p)));
|
|
351
438
|
|
|
352
439
|
criarArquivo(path.join(raiz, 'commit.js'), CONTEUDO_COMMIT_JS);
|
|
@@ -357,9 +444,7 @@ function criarProjetoPersonalizacao(raiz, nomeProjeto) {
|
|
|
357
444
|
const packageJson = {
|
|
358
445
|
name: nomeProjeto,
|
|
359
446
|
version: "1.0.0",
|
|
360
|
-
scripts: {
|
|
361
|
-
"commit": "node commit.js"
|
|
362
|
-
}
|
|
447
|
+
scripts: { "commit": "node commit.js" }
|
|
363
448
|
};
|
|
364
449
|
criarArquivo(path.join(raiz, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
365
450
|
|
|
@@ -370,22 +455,10 @@ function criarProjetoPersonalizacao(raiz, nomeProjeto) {
|
|
|
370
455
|
} catch (e) { console.error('Erro no git init:', e.message); }
|
|
371
456
|
}
|
|
372
457
|
|
|
373
|
-
// --- MODELO 3: JAVA (IntelliJ) ---
|
|
374
458
|
function criarProjetoJava(raiz, nomeProjeto) {
|
|
375
459
|
const nomePacote = nomeProjeto.replace(/-/g, '').toLowerCase();
|
|
376
460
|
const basePath = `src/br/com/sankhya/${nomePacote}`;
|
|
377
|
-
|
|
378
|
-
const pastas = [
|
|
379
|
-
'.idea',
|
|
380
|
-
'doc',
|
|
381
|
-
'out',
|
|
382
|
-
`${basePath}/business/agendador`,
|
|
383
|
-
`${basePath}/business/botao`,
|
|
384
|
-
`${basePath}/business/evento`,
|
|
385
|
-
`${basePath}/business/regra`,
|
|
386
|
-
`${basePath}/domain/model`,
|
|
387
|
-
`${basePath}/domain/repository`
|
|
388
|
-
];
|
|
461
|
+
const pastas = ['.idea','doc','out',`${basePath}/business/agendador`,`${basePath}/business/botao`,`${basePath}/business/evento`,`${basePath}/business/regra`,`${basePath}/domain/model`,`${basePath}/domain/repository`];
|
|
389
462
|
|
|
390
463
|
pastas.forEach(p => criarPasta(path.join(raiz, p)));
|
|
391
464
|
|
|
@@ -396,42 +469,17 @@ function criarProjetoJava(raiz, nomeProjeto) {
|
|
|
396
469
|
const packageJson = {
|
|
397
470
|
name: nomeProjeto,
|
|
398
471
|
version: "1.0.0",
|
|
399
|
-
scripts: {
|
|
400
|
-
"commit": "node commit.js"
|
|
401
|
-
}
|
|
472
|
+
scripts: { "commit": "node commit.js" }
|
|
402
473
|
};
|
|
403
474
|
criarArquivo(path.join(raiz, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
404
475
|
|
|
405
|
-
const modulesXml = `<?xml version="1.0" encoding="UTF-8"
|
|
406
|
-
<project version="4">
|
|
407
|
-
<component name="ProjectModuleManager">
|
|
408
|
-
<modules>
|
|
409
|
-
<module fileurl="file://$PROJECT_DIR$/${nomeProjeto}.iml" filepath="$PROJECT_DIR$/${nomeProjeto}.iml" />
|
|
410
|
-
</modules>
|
|
411
|
-
</component>
|
|
412
|
-
</project>`;
|
|
476
|
+
const modulesXml = `<?xml version="1.0" encoding="UTF-8"?><project version="4"><component name="ProjectModuleManager"><modules><module fileurl="file://$PROJECT_DIR$/${nomeProjeto}.iml" filepath="$PROJECT_DIR$/${nomeProjeto}.iml" /></modules></component></project>`;
|
|
413
477
|
criarArquivo(path.join(raiz, '.idea/modules.xml'), modulesXml);
|
|
414
478
|
|
|
415
|
-
const miscXml = `<?xml version="1.0" encoding="UTF-8"
|
|
416
|
-
<project version="4">
|
|
417
|
-
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
|
418
|
-
<output url="file://$PROJECT_DIR$/out" />
|
|
419
|
-
</component>
|
|
420
|
-
</project>`;
|
|
479
|
+
const miscXml = `<?xml version="1.0" encoding="UTF-8"?><project version="4"><component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"><output url="file://$PROJECT_DIR$/out" /></component></project>`;
|
|
421
480
|
criarArquivo(path.join(raiz, '.idea/misc.xml'), miscXml);
|
|
422
481
|
|
|
423
|
-
const imlContent = `<?xml version="1.0" encoding="UTF-8"
|
|
424
|
-
<module type="JAVA_MODULE" version="4">
|
|
425
|
-
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
426
|
-
<exclude-output />
|
|
427
|
-
<content url="file://$MODULE_DIR$">
|
|
428
|
-
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
|
429
|
-
</content>
|
|
430
|
-
<orderEntry type="inheritedJdk" />
|
|
431
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
432
|
-
<orderEntry type="library" name="libs-java" level="application" />
|
|
433
|
-
</component>
|
|
434
|
-
</module>`;
|
|
482
|
+
const imlContent = `<?xml version="1.0" encoding="UTF-8"?><module type="JAVA_MODULE" version="4"><component name="NewModuleRootManager" inherit-compiler-output="true"><exclude-output /><content url="file://$MODULE_DIR$"><sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /></content><orderEntry type="inheritedJdk" /><orderEntry type="sourceFolder" forTests="false" /><orderEntry type="library" name="libs-java" level="application" /></component></module>`;
|
|
435
483
|
criarArquivo(path.join(raiz, `${nomeProjeto}.iml`), imlContent);
|
|
436
484
|
|
|
437
485
|
console.log(`\n⚙️ CONFIGURANDO AMBIENTE JAVA (IntelliJ)...`);
|
|
@@ -444,7 +492,7 @@ function criarProjetoJava(raiz, nomeProjeto) {
|
|
|
444
492
|
}
|
|
445
493
|
|
|
446
494
|
// ==========================================
|
|
447
|
-
//
|
|
495
|
+
// MENU PRINCIPAL
|
|
448
496
|
// ==========================================
|
|
449
497
|
function iniciar() {
|
|
450
498
|
console.clear();
|