From fa00b6662db88b98a206592ecff8127c8942dd0e Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Wed, 28 Oct 2020 22:14:13 +0000 Subject: [PATCH] The removal of CLI package meant there was no way to init the system anymore so nuking budibase directory was unrecoverable, fixing this. --- packages/server/package.json | 3 ++- packages/server/scripts/initialise.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 packages/server/scripts/initialise.js diff --git a/packages/server/package.json b/packages/server/package.json index c7909e5e28..bf34b1c54f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -32,7 +32,8 @@ "build:electron": "electron-builder --dir", "publish:electron": "electron-builder -mwl --publish always", "postinstall": "electron-builder install-app-deps", - "lint": "eslint --fix src/" + "lint": "eslint --fix src/", + "initialise": "node scripts/initialise.js" }, "keywords": [ "budibase" diff --git a/packages/server/scripts/initialise.js b/packages/server/scripts/initialise.js new file mode 100644 index 0000000000..485ebd56a0 --- /dev/null +++ b/packages/server/scripts/initialise.js @@ -0,0 +1,17 @@ +const { join } = require("path") +const { homedir } = require("os") + +const initialiseBudibase = require("../src/utilities/initialiseBudibase") +const DIRECTORY = "~/.budibase" + +function run() { + let opts = {} + let dir = DIRECTORY + opts.quiet = true + opts.dir = dir.startsWith("~") ? join(homedir(), dir.substring(1)) : dir + return initialiseBudibase(opts) +} + +run().then(() => { + console.log("Init complete.") +})