implementado typescript 7
This commit is contained in:
parent
cd4ea4d36b
commit
e9a323f18c
80 changed files with 5711 additions and 2455 deletions
51
dist-front/instalarAmbiente.js
Normal file
51
dist-front/instalarAmbiente.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
/**
|
||||
* Mescla objetos recursivamente.
|
||||
* - Adiciona chaves novas
|
||||
* - Sobrescreve valores primitivos
|
||||
* - Mescla objetos aninhados
|
||||
*/
|
||||
const mesclar = (entrada, novo) => {
|
||||
const saida = { ...(entrada || {}) };
|
||||
for (const [k, v] of Object.entries(novo)) {
|
||||
if (v && typeof v === "object" && !Array.isArray(v)) {
|
||||
saida[k] = mesclar(saida[k], v);
|
||||
}
|
||||
else {
|
||||
saida[k] = v;
|
||||
}
|
||||
}
|
||||
return saida;
|
||||
};
|
||||
/** Lê JSON ou retorna objeto vazio */
|
||||
const abrirJson = (caminho) => {
|
||||
try {
|
||||
return JSON.parse(fs.readFileSync(caminho, "utf-8"));
|
||||
}
|
||||
catch {
|
||||
return {};
|
||||
}
|
||||
};
|
||||
const settings_json = {
|
||||
"editor.defaultFormatter": "biomejs.biome",
|
||||
"[javascript]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[javascriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[typescript]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[typescriptreact]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[json]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[jsonc]": { "editor.defaultFormatter": "biomejs.biome" },
|
||||
"[vue]": { "editor.defaultFormatter": "esbenp.prettier-vscode" },
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports.biome": "always",
|
||||
"source.fixAll.biome": "always",
|
||||
},
|
||||
};
|
||||
const caminhoSeting = path.join(process.cwd(), ".vscode/settings.json");
|
||||
// Garante a pasta .vscode
|
||||
fs.mkdirSync(path.dirname(caminhoSeting), { recursive: true });
|
||||
// Mescla e grava
|
||||
const atual = abrirJson(caminhoSeting);
|
||||
const final = mesclar(atual, settings_json);
|
||||
fs.writeFileSync(caminhoSeting, JSON.stringify(final, null, 2), "utf8");
|
||||
console.log(`✅ Configurações salvas em ${caminhoSeting}`);
|
||||
Loading…
Add table
Add a link
Reference in a new issue