diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/first_setup.js | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/scripts/first_setup.js b/scripts/first_setup.js index 0f69cacd..4ba0385c 100644 --- a/scripts/first_setup.js +++ b/scripts/first_setup.js @@ -8,9 +8,9 @@ const rl = readline.createInterface({ input: process.stdin, output: process.stdo const data = { env: [], config: { register: {} }, extra_pkgs: [] }; let rights = []; -process.on('SIGINT', function() { - console.log("Caught interrupt signal"); - process.exit(); +process.on("SIGINT", function () { + console.log("Caught interrupt signal"); + process.exit(); }); console.log("Welcome to Fosscord!"); @@ -18,8 +18,8 @@ console.log("Please remember this is pre-release software!"); console.log("We will guide you through some important setup steps."); console.log(); -if(fs.existsSync("package-lock.json")) fs.rmSync("package-lock.json"); -if(fs.existsSync("yarn.lock")) fs.rmSync("yarn.lock"); +if (fs.existsSync("package-lock.json")) fs.rmSync("package-lock.json"); +if (fs.existsSync("yarn.lock")) fs.rmSync("yarn.lock"); async function main() { printTitle("Step 1: Database setup"); @@ -82,7 +82,7 @@ async function main() { if (data.db != "sqlite") data.env.push(`DATABASE=${data.db}://${data.db_user}:${data.db_pass}@${data.db_host}:${data.db_port}/${data.db_name}`); data.env.push(`PORT=${data.port}`); - data.env.push('THREADS=1') + data.env.push("THREADS=1"); printTitle("Step 4: Default rights"); console.log("Please enter the default rights for new users."); @@ -126,8 +126,9 @@ async function main() { }; printTitle("Step 5: extra options"); - if(/y?/i.test(await ask("Use fast BCrypt implementation (requires a compiler) (Y/n): "))) data.extra_pkgs.push("bcrypt"); - if(/y?/.test(await ask("Enable support for widgets (requires compiler, known to fail on some ARM devices.) (Y/n): "))) data.extra_pkgs.push("canvas"); + if (/y?/i.test(await ask("Use fast BCrypt implementation (requires a compiler) (Y/n): "))) data.extra_pkgs.push("bcrypt"); + if (/y?/.test(await ask("Enable support for widgets (requires compiler, known to fail on some ARM devices.) (Y/n): "))) + data.extra_pkgs.push("canvas"); printTitle("Step 6: finalizing..."); //save @@ -140,13 +141,13 @@ async function main() { console.log(" ==> Ensuring yarn is up to date (v3, not v1)..."); execIn("npx yarn set version stable", process.cwd()); console.log(" ==> Installing base packages"); - execIn("npx --yes yarn install", process.cwd(), {stdio: "inherit"}); + execIn("npx --yes yarn install", process.cwd(), { stdio: "inherit" }); - console.log(` ==> Installing extra packages: ${data.extra_pkgs.join(', ')}...`); - execIn(`npx --yes yarn add -O ${data.extra_pkgs.join(' ')}`, process.cwd(), {stdio: "inherit"}); + console.log(` ==> Installing extra packages: ${data.extra_pkgs.join(", ")}...`); + execIn(`npx --yes yarn add -O ${data.extra_pkgs.join(" ")}`, process.cwd(), { stdio: "inherit" }); - console.log('==> Building...') - execIn('npx --yes yarn run build', process.cwd(), {stdio: "inherit"}); + console.log("==> Building..."); + execIn("npx --yes yarn run build", process.cwd(), { stdio: "inherit" }); printTitle("Step 6: run your instance!"); console.log("Installation is complete!"); console.log("You can now start your instance by running 'npm run start:bundle'!"); |