From 00cafece8c7b678cfe76ca10fa8f696590866793 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 11 Nov 2018 11:12:47 -0800 Subject: [PATCH] make mastodon installation faster in dev mode (#624) --- bin/run-mastodon.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bin/run-mastodon.js b/bin/run-mastodon.js index c2dcbfd..16999f4 100644 --- a/bin/run-mastodon.js +++ b/bin/run-mastodon.js @@ -95,9 +95,17 @@ async function runMastodon () { 'yarn --pure-lockfile' ] - for (let cmd of cmds) { - console.log(cmd) - await exec(cmd, { cwd, env }) + const installedFile = path.join(mastodonDir, 'installed.txt') + try { + await stat(installedFile) + console.log('Already installed Mastodon') + } catch (e) { + console.log('Installing Mastodon...') + for (let cmd of cmds) { + console.log(cmd) + await exec(cmd, { cwd, env }) + } + await writeFile(installedFile, '', 'utf8') } const promise = spawn('foreman', ['start'], { cwd, env }) const log = fs.createWriteStream('mastodon.log', { flags: 'a' })