aiteam-x 0.14.2 → 0.14.4
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/package.json +1 -1
- package/scripts/cli.mjs +14 -5
package/package.json
CHANGED
package/scripts/cli.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import { fileURLToPath } from "url";
|
|
|
18
18
|
|
|
19
19
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
20
20
|
const REPO = "INOSX/AITeam#main";
|
|
21
|
+
const CLI_VERSION = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf-8")).version;
|
|
21
22
|
|
|
22
23
|
const C = {
|
|
23
24
|
green: (s) => `\x1b[32m${s}\x1b[0m`,
|
|
@@ -54,11 +55,12 @@ function mergePackageJson(templatePath, targetPath) {
|
|
|
54
55
|
const cur = JSON.parse(fs.readFileSync(targetPath, "utf-8"));
|
|
55
56
|
const merged = {
|
|
56
57
|
...cur,
|
|
57
|
-
dependencies: { ...(
|
|
58
|
-
devDependencies: { ...(
|
|
59
|
-
scripts: { ...(
|
|
58
|
+
dependencies: { ...(cur.dependencies ?? {}), ...(tpl.dependencies ?? {}) },
|
|
59
|
+
devDependencies: { ...(cur.devDependencies ?? {}), ...(tpl.devDependencies ?? {}) },
|
|
60
|
+
scripts: { ...(cur.scripts ?? {}), ...(tpl.scripts ?? {}) },
|
|
60
61
|
};
|
|
61
|
-
if (tpl.
|
|
62
|
+
if (tpl.version) merged.version = tpl.version;
|
|
63
|
+
if (tpl.bin) merged.bin = tpl.bin;
|
|
62
64
|
fs.writeFileSync(targetPath, JSON.stringify(merged, null, 2) + "\n", "utf-8");
|
|
63
65
|
console.log(C.dim(" package.json mesclado (deps + scripts adicionados)"));
|
|
64
66
|
}
|
|
@@ -135,8 +137,10 @@ async function main() {
|
|
|
135
137
|
const cwd = process.cwd();
|
|
136
138
|
const absTarget = path.resolve(cwd, targetDir);
|
|
137
139
|
|
|
140
|
+
const banner = `4AITEAM-X — Instalação v${CLI_VERSION}`;
|
|
141
|
+
const pad = Math.max(0, 36 - banner.length);
|
|
138
142
|
console.log("\n" + C.bold(C.cyan("╔══════════════════════════════════════╗")));
|
|
139
|
-
console.log(C.bold(C.cyan("
|
|
143
|
+
console.log(C.bold(C.cyan(`║ ${banner}${" ".repeat(pad)} ║`)));
|
|
140
144
|
console.log(C.bold(C.cyan("╚══════════════════════════════════════╝")) + "\n");
|
|
141
145
|
|
|
142
146
|
const empty = isDirEmpty(absTarget);
|
|
@@ -188,6 +192,11 @@ async function main() {
|
|
|
188
192
|
|
|
189
193
|
if (!empty) {
|
|
190
194
|
console.log(C.bold("2. Mesclando arquivos (existentes preservados)..."));
|
|
195
|
+
const nextDir = path.join(absTarget, ".next");
|
|
196
|
+
if (fs.existsSync(nextDir)) {
|
|
197
|
+
fs.rmSync(nextDir, { recursive: true, force: true });
|
|
198
|
+
console.log(C.dim(" Cache .next removido"));
|
|
199
|
+
}
|
|
191
200
|
copyMerge(tmpDir, absTarget);
|
|
192
201
|
console.log(C.green(" ✓ Arquivos mesclados\n"));
|
|
193
202
|
} else {
|