_comuns/dist-back/instalarAmbiente.js
2025-11-11 16:02:48 -03:00

63 lines
2.7 KiB
JavaScript

"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var import_node_fs = __toESM(require("node:fs"));
var import_node_path = __toESM(require("node:path"));
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;
};
const abrirJson = (caminho) => {
try {
return JSON.parse(import_node_fs.default.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 = import_node_path.default.join(process.cwd(), ".vscode/settings.json");
import_node_fs.default.mkdirSync(import_node_path.default.dirname(caminhoSeting), { recursive: true });
const atual = abrirJson(caminhoSeting);
const final = mesclar(atual, settings_json);
import_node_fs.default.writeFileSync(caminhoSeting, JSON.stringify(final, null, 2), "utf8");
console.log(`\u2705 Configura\xE7\xF5es salvas em ${caminhoSeting}`);