1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-05 18:32:33 +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,
"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");
if (argv.includes("clean")) {
dirs.forEach((a) => {
var d = "../" + a + "/dist";
if (fse.existsSync(d)) {
fse.rmSync(d, { recursive: true });
if (verbose) console.log(`Deleted ${d}!`);
}
});
dirs.forEach((a) => {
var d = "../" + a + "/dist";
if (fse.existsSync(d)) {
fse.rmSync(d, { recursive: true });
if (verbose) console.log(`Deleted ${d}!`);
}
});
}
fse.copySync(
path.join(__dirname, "..", "..", "api", "assets"),
path.join(__dirname, "..", "dist", "api", "assets")
);
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")
);
fse.copySync(path.join(__dirname, "..", "..", "api", "assets"), path.join(__dirname, "..", "dist", "api", "assets"));
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) => {
fse.copySync("../" + a + "/src", "dist/" + a + "/src");
if (verbose)
console.log(`Copied ${"../" + a + "/dist"} -> ${"dist/" + a + "/src"}!`);
fse.copySync("../" + a + "/src", "dist/" + a + "/src");
if (verbose) console.log(`Copied ${"../" + a + "/dist"} -> ${"dist/" + a + "/src"}!`);
});
console.log("Copying src files done");
if (!argv.includes("copyonly")) {
console.log("Compiling src files ...");
console.log("Compiling src files ...");
console.log(
execSync(
'node "' +
path.join(
__dirname,
"..",
"node_modules",
"typescript",
"lib",
"tsc.js"
) +
'" -p "' +
path.join(__dirname, "..") +
'"',
{
cwd: path.join(__dirname, ".."),
shell: true,
env: process.env,
encoding: "utf8",
}
)
);
console.log(
execSync(
'node "' +
path.join(__dirname, "..", "node_modules", "typescript", "lib", "tsc.js") +
'" -p "' +
path.join(__dirname, "..") +
'"',
{
cwd: path.join(__dirname, ".."),
shell: true,
env: process.env,
encoding: "utf8"
}
)
);
}