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");