1
0
mirror of https://github.com/spacebarchat/server.git synced 2025-01-31 11:41:38 +01:00

Global prettierrc, format build.js

This commit is contained in:
The Arcane Brony 2021-10-22 09:26:01 +02:00
parent d57cd783ac
commit 2941181430
2 changed files with 33 additions and 47 deletions

View File

@ -1,4 +1,7 @@
{ {
"tabWidth": 4, "tabWidth": 4,
"useTabs": true "useTabs": true,
} "printWidth": 140,
"trailingComma": "none",
"useTabs": true
}

View File

@ -9,57 +9,40 @@ const dirs = ["api", "util", "cdn", "gateway", "bundle"];
const verbose = argv.includes("verbose") || argv.includes("v"); const verbose = argv.includes("verbose") || argv.includes("v");
if (argv.includes("clean")) { if (argv.includes("clean")) {
dirs.forEach((a) => { dirs.forEach((a) => {
var d = "../" + a + "/dist"; var d = "../" + a + "/dist";
if (fse.existsSync(d)) { if (fse.existsSync(d)) {
fse.rmSync(d, { recursive: true }); fse.rmSync(d, { recursive: true });
if (verbose) console.log(`Deleted ${d}!`); if (verbose) console.log(`Deleted ${d}!`);
} }
}); });
} }
fse.copySync( fse.copySync(path.join(__dirname, "..", "..", "api", "assets"), path.join(__dirname, "..", "dist", "api", "assets"));
path.join(__dirname, "..", "..", "api", "assets"), fse.copySync(path.join(__dirname, "..", "..", "api", "client_test"), path.join(__dirname, "..", "dist", "api", "client_test"));
path.join(__dirname, "..", "dist", "api", "assets") fse.copySync(path.join(__dirname, "..", "..", "api", "locales"), path.join(__dirname, "..", "dist", "api", "locales"));
);
fse.copySync(
path.join(__dirname, "..", "..", "api", "client_test"),
path.join(__dirname, "..", "dist", "api", "client_test")
);
fse.copySync(
path.join(__dirname, "..", "..", "api", "locales"),
path.join(__dirname, "..", "dist", "api", "locales")
);
dirs.forEach((a) => { dirs.forEach((a) => {
fse.copySync("../" + a + "/src", "dist/" + a + "/src"); fse.copySync("../" + a + "/src", "dist/" + a + "/src");
if (verbose) if (verbose) console.log(`Copied ${"../" + a + "/dist"} -> ${"dist/" + a + "/src"}!`);
console.log(`Copied ${"../" + a + "/dist"} -> ${"dist/" + a + "/src"}!`);
}); });
console.log("Copying src files done"); console.log("Copying src files done");
if (!argv.includes("copyonly")) { if (!argv.includes("copyonly")) {
console.log("Compiling src files ..."); console.log("Compiling src files ...");
console.log( console.log(
execSync( execSync(
'node "' + 'node "' +
path.join( path.join(__dirname, "..", "node_modules", "typescript", "lib", "tsc.js") +
__dirname, '" -p "' +
"..", path.join(__dirname, "..") +
"node_modules", '"',
"typescript", {
"lib", cwd: path.join(__dirname, ".."),
"tsc.js" shell: true,
) + env: process.env,
'" -p "' + encoding: "utf8"
path.join(__dirname, "..") + }
'"', )
{ );
cwd: path.join(__dirname, ".."),
shell: true,
env: process.env,
encoding: "utf8",
}
)
);
} }