From 62f7465e2159deab18c0fab9801b75a0d971246a Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sun, 4 Dec 2022 20:19:01 -0500 Subject: [PATCH] Init now works and covers everything. --- commands/init.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/commands/init.js b/commands/init.js index 7685e24..fc8b839 100755 --- a/commands/init.js +++ b/commands/init.js @@ -8,7 +8,8 @@ import { existsSync as exists } from "fs"; export const description = "Initializes a fresh bando project"; export const options = [ - ["--force", "DANGER! overwite config files with templates"] + ["--force", "DANGER! overwite config files with templates"], + ["--templates", "what to use as a template directory", "./commands/templates"], ]; // I did have chalk here but not sure so removed it for now @@ -17,15 +18,8 @@ const good = console.log; const error = console.error; const dirs = ["./debug/email","./debug/errors","./secrets"]; -const templates = "./scripts/templates"; - -export const main = async (opts) => { - good("Creating configuration directories."); - - dirs.forEach(d => mkdir(d)); - - warn("!!! WARNING!: Do not add the contents of secrets to your git repository."); +const copy_templates = (templates) => { good("Copying templates to your project. You can commit these to git."); const source_files = glob(`${templates}/**/*`); @@ -41,11 +35,21 @@ export const main = async (opts) => { good("SKIPPING", dest); } } +} + +export const main = async (opts) => { + good("Creating configuration directories."); + + dirs.forEach(d => mkdir(d)); + + warn("!!! WARNING!: Do not add the contents of secrets to your git repository."); + + copy_templates(opts.templates); good("Starting redis for your OS so you can register an admin."); devsvc({start: true, noexit: true}); - good("Migrating your database."); + good("Migrating your database just in case."); exec("npm run knex migrate:latest") good("In another window start the app server with: npm run DANGER_ADMIN");