@archznn/xavva 2.0.2 β 2.0.3
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/README.md +1 -1
- package/package.json +1 -1
- package/src/commands/DeployCommand.ts +1 -0
- package/src/commands/HelpCommand.ts +1 -0
- package/src/commands/ProfilesCommand.ts +32 -0
- package/src/index.ts +4 -2
- package/src/services/DashboardService.ts +2 -1
- package/src/services/ProjectService.ts +38 -0
- package/src/utils/ui.ts +3 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# XAVVA π (Windows Only) `v2.0.
|
|
1
|
+
# XAVVA π (Windows Only) `v2.0.3`
|
|
2
2
|
|
|
3
3
|
Xavva Γ© uma CLI de alto desempenho construΓda com **Bun** para automatizar o ciclo de desenvolvimento de aplicaΓ§Γ΅es Java (Maven/Gradle) rodando no Apache Tomcat. Ela foi desenhada especificamente para desenvolvedores que buscam a velocidade de ambientes modernos (como Node.js/Vite) dentro do ecossistema Java Enterprise.
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -110,6 +110,7 @@ export class DeployCommand implements Command {
|
|
|
110
110
|
|
|
111
111
|
private logConfiguration(config: AppConfig, isWatching: boolean) {
|
|
112
112
|
Logger.config("Runtime", config.project.buildTool.toUpperCase());
|
|
113
|
+
if (config.project.profile) Logger.config("Profile", config.project.profile.toUpperCase());
|
|
113
114
|
Logger.config("Watch Mode", isWatching ? "ON" : "OFF");
|
|
114
115
|
Logger.config("Debug", config.project.debug ? `ON (Port ${config.project.debugPort})` : "OFF");
|
|
115
116
|
|
|
@@ -17,6 +17,7 @@ Comandos principais:
|
|
|
17
17
|
run / debug π Executa classes standalone com Pathing JAR (Windows).
|
|
18
18
|
doctor π©Ί DiagnΓ³stico e reparo de ambiente (DCEVM, JAVA_HOME).
|
|
19
19
|
audit π‘οΈ Auditoria de seguranΓ§a em JARs via OSV.dev.
|
|
20
|
+
profiles π·οΈ Lista perfis de build disponΓveis (Maven Profiles).
|
|
20
21
|
docs π Mapeamento estΓ‘tico de Endpoints e JSPs.
|
|
21
22
|
build / start Comandos granulares de compilaΓ§Γ£o ou startup.
|
|
22
23
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Command } from "./Command";
|
|
2
|
+
import type { AppConfig, CLIArguments } from "../types/config";
|
|
3
|
+
import { ProjectService } from "../services/ProjectService";
|
|
4
|
+
import { Logger } from "../utils/ui";
|
|
5
|
+
|
|
6
|
+
export class ProfilesCommand implements Command {
|
|
7
|
+
constructor(private projectService: ProjectService) {}
|
|
8
|
+
|
|
9
|
+
async execute(config: AppConfig, args?: CLIArguments): Promise<void> {
|
|
10
|
+
Logger.section("Project Profiles");
|
|
11
|
+
|
|
12
|
+
Logger.info("Build Tool", config.project.buildTool.toUpperCase());
|
|
13
|
+
|
|
14
|
+
const profiles = this.projectService.getAvailableProfiles();
|
|
15
|
+
|
|
16
|
+
if (profiles.length === 0) {
|
|
17
|
+
Logger.warn("Nenhum perfil especΓfico encontrado no arquivo de configuraΓ§Γ£o.");
|
|
18
|
+
Logger.log(` ${Logger.C.dim}Dica: Perfis Maven sΓ£o definidos em <profiles> no pom.xml.${Logger.C.reset}`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
Logger.log(`
|
|
23
|
+
${Logger.C.cyan}Perfis detectados:${Logger.C.reset}`);
|
|
24
|
+
profiles.forEach(p => {
|
|
25
|
+
const active = config.project.profile === p ? ` ${Logger.C.green}(Ativo)${Logger.C.reset}` : "";
|
|
26
|
+
Logger.log(` ${Logger.C.bold}β${Logger.C.reset} ${p}${active}`);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
Logger.newline();
|
|
30
|
+
Logger.log(` ${Logger.C.dim}Para usar um perfil: xavva build -P nome-do-perfil${Logger.C.reset}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { RunCommand } from "./commands/RunCommand";
|
|
|
10
10
|
import { LogsCommand } from "./commands/LogsCommand";
|
|
11
11
|
import { DocsCommand } from "./commands/DocsCommand";
|
|
12
12
|
import { AuditCommand } from "./commands/AuditCommand";
|
|
13
|
+
import { ProfilesCommand } from "./commands/ProfilesCommand";
|
|
13
14
|
|
|
14
15
|
import { ProjectService } from "./services/ProjectService";
|
|
15
16
|
import { TomcatService } from "./services/TomcatService";
|
|
@@ -32,11 +33,11 @@ async function main() {
|
|
|
32
33
|
process.exit(0);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
const commandNames = ["deploy", "build", "start", "dev", "doctor", "run", "debug", "logs", "docs", "audit"];
|
|
36
|
+
const commandNames = ["deploy", "build", "start", "dev", "doctor", "run", "debug", "logs", "docs", "audit", "profiles"];
|
|
36
37
|
const commandName = positionals.find(p => commandNames.includes(p)) || "deploy";
|
|
37
38
|
|
|
38
39
|
if (!values.help && !values.tui) {
|
|
39
|
-
Logger.banner(commandName);
|
|
40
|
+
Logger.banner(commandName, config.project.profile);
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
if (values.help) {
|
|
@@ -71,6 +72,7 @@ async function main() {
|
|
|
71
72
|
registry.register("logs", logsCmd);
|
|
72
73
|
registry.register("docs", new DocsCommand());
|
|
73
74
|
registry.register("audit", new AuditCommand(auditService));
|
|
75
|
+
registry.register("profiles", new ProfilesCommand(projectService));
|
|
74
76
|
registry.register("deploy", deployCmd);
|
|
75
77
|
registry.register("dev", deployCmd);
|
|
76
78
|
|
|
@@ -92,8 +92,9 @@ export class DashboardService {
|
|
|
92
92
|
const name = (process.cwd().split(/[/\\]/).pop() || "PROJECT").toUpperCase();
|
|
93
93
|
const mem = Math.round((os.totalmem() - os.freemem()) / 1024 / 1024 / 1024 * 10) / 10;
|
|
94
94
|
const totalMem = Math.round(os.totalmem() / 1024 / 1024 / 1024);
|
|
95
|
+
const profile = this.config.project.profile ? ` ${Logger.C.dim}β’${Logger.C.reset} ${Logger.C.yellow}β¦ ${this.config.project.profile.toUpperCase()}${Logger.C.reset}` : "";
|
|
95
96
|
|
|
96
|
-
output += `${Logger.C.bold}${Logger.C.cyan} X A V V A 2.0 ${Logger.C.reset} ${Logger.C.dim}β${Logger.C.reset} ${Logger.C.white}${Logger.C.bold}${name}${Logger.C.reset}\x1B[K\n`;
|
|
97
|
+
output += `${Logger.C.bold}${Logger.C.cyan} X A V V A 2.0 ${Logger.C.reset} ${Logger.C.dim}β${Logger.C.reset} ${Logger.C.white}${Logger.C.bold}${name}${Logger.C.reset}${profile}\x1B[K\n`;
|
|
97
98
|
output += `${Logger.C.dim} STATUS: ${this.statusColor}${this.status.padEnd(10)}${Logger.C.reset} ${Logger.C.dim}β MEM: ${Logger.C.yellow}${mem}G/${totalMem}G${Logger.C.reset} ${Logger.C.dim}β BRANCH: ${Logger.C.magenta}${this.gitContext?.branch || "unknown"}${Logger.C.reset}\x1B[K\n`;
|
|
98
99
|
output += `${Logger.C.dim}ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ${Logger.C.reset}\x1B[K\n`;
|
|
99
100
|
|
|
@@ -88,6 +88,44 @@ export class ProjectService {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
getAvailableProfiles(): string[] {
|
|
92
|
+
const results: string[] = [];
|
|
93
|
+
const root = process.cwd();
|
|
94
|
+
|
|
95
|
+
if (this.config.buildTool === 'maven') {
|
|
96
|
+
const pomPath = path.join(root, "pom.xml");
|
|
97
|
+
if (existsSync(pomPath)) {
|
|
98
|
+
try {
|
|
99
|
+
const content = require("fs").readFileSync(pomPath, "utf8");
|
|
100
|
+
// Regex simples para capturar IDs de profiles no pom.xml
|
|
101
|
+
const profileRegex = /<profile>[\s\S]*?<id>(.*?)<\/id>/g;
|
|
102
|
+
let match;
|
|
103
|
+
while ((match = profileRegex.exec(content)) !== null) {
|
|
104
|
+
results.push(match[1]);
|
|
105
|
+
}
|
|
106
|
+
} catch (e) {}
|
|
107
|
+
}
|
|
108
|
+
} else if (this.config.buildTool === 'gradle') {
|
|
109
|
+
const gradlePath = path.join(root, "build.gradle");
|
|
110
|
+
const gradleKtsPath = path.join(root, "build.gradle.kts");
|
|
111
|
+
const targetPath = existsSync(gradlePath) ? gradlePath : existsSync(gradleKtsPath) ? gradleKtsPath : null;
|
|
112
|
+
|
|
113
|
+
if (targetPath) {
|
|
114
|
+
try {
|
|
115
|
+
const content = require("fs").readFileSync(targetPath, "utf8");
|
|
116
|
+
// Em Gradle, perfis costumam ser tratados via propriedades ou tasks de ambiente
|
|
117
|
+
// Vamos procurar por padrΓ΅es comuns como "if (project.hasProperty('profile'))"
|
|
118
|
+
// ou simplesmente sugerir o uso de -P
|
|
119
|
+
if (content.includes("project.hasProperty('profile')") || content.includes("-Pprofile")) {
|
|
120
|
+
results.push("(Detectado uso dinΓ’mico de -Pprofile)");
|
|
121
|
+
}
|
|
122
|
+
} catch (e) {}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return results;
|
|
127
|
+
}
|
|
128
|
+
|
|
91
129
|
findAllClassPaths(): string[] {
|
|
92
130
|
const results: string[] = [];
|
|
93
131
|
const root = process.cwd();
|
package/src/utils/ui.ts
CHANGED
|
@@ -61,7 +61,7 @@ export class Logger {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
static banner(command?: string) {
|
|
64
|
+
static banner(command?: string, profile?: string) {
|
|
65
65
|
console.clear();
|
|
66
66
|
const git = this.getGitContext();
|
|
67
67
|
const name = (process.cwd().split(/[/\\]/).pop() || "PROJECT").toUpperCase();
|
|
@@ -74,8 +74,9 @@ export class Logger {
|
|
|
74
74
|
console.log("");
|
|
75
75
|
console.log(` ${this.C.bold}${this.C.cyan}X A V V A${this.C.reset} ${this.C.dim}β${this.C.reset} ${this.C.bold}${this.C.white}${name}${this.C.reset}`);
|
|
76
76
|
|
|
77
|
+
const profileInfo = profile ? ` ${this.C.dim}β’${this.C.reset} ${this.C.yellow}β¦ ${profile.toUpperCase()}${this.C.reset}` : "";
|
|
77
78
|
const gitInfo = git.branch ? `${this.C.magenta}πΏ ${git.branch}${this.C.reset} ${this.C.dim}β’${this.C.reset} ${this.C.yellow}${git.hash}${this.C.reset}` : "";
|
|
78
|
-
console.log(` ${this.C.dim}π¦ ${version}${gitInfo ? ` ${this.C.dim}β’${this.C.reset} ${gitInfo}` : ""}${this.C.reset}`);
|
|
79
|
+
console.log(` ${this.C.dim}π¦ ${version}${profileInfo}${gitInfo ? ` ${this.C.dim}β’${this.C.reset} ${gitInfo}` : ""}${this.C.reset}`);
|
|
79
80
|
|
|
80
81
|
console.log(` ${modeColor}${this.C.bold}β¬’ ${modeIcon} ${mode} MODE${this.C.reset}`);
|
|
81
82
|
console.log(` ${this.C.dim}βββββββββββββββββββββββββββββββββββββββββββββββββ${this.C.reset}`);
|