|
|
@ -11,19 +11,17 @@ const { exec } = require("child_process") |
|
|
|
|
|
|
|
|
module.exports = opts => { |
|
|
module.exports = opts => { |
|
|
run(opts) |
|
|
run(opts) |
|
|
console.log(chalk.green(`Budibase app ${opts.name} created!`)) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const run = async opts => { |
|
|
const run = async opts => { |
|
|
console.log(opts) |
|
|
|
|
|
try { |
|
|
try { |
|
|
opts.dir = xPlatHomeDir(opts.dir) |
|
|
opts.dir = xPlatHomeDir(opts.dir) |
|
|
console.log(resolve(opts.dir)) |
|
|
|
|
|
const bbconfig = dotenv.config({ path: resolve(opts.dir, ".env") }) |
|
|
const bbconfig = dotenv.config({ path: resolve(opts.dir, ".env") }) |
|
|
console.log(bbconfig) |
|
|
console.log(bbconfig) |
|
|
await createAppInstance(opts) |
|
|
await createAppInstance(opts) |
|
|
await createEmptyAppPackage(opts) |
|
|
await createEmptyAppPackage(opts) |
|
|
exec(`cd ${join(opts.dir, opts.applicationId)} && npm install`) |
|
|
exec(`cd ${join(opts.dir, opts.applicationId)} && npm install`) |
|
|
|
|
|
console.log(chalk.green(`Budibase app ${opts.name} created!`)) |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error(chalk.red("Error creating new app", error)) |
|
|
console.error(chalk.red("Error creating new app", error)) |
|
|
} |
|
|
} |
|
|
@ -40,6 +38,7 @@ const createAppInstance = async opts => { |
|
|
|
|
|
|
|
|
await createApplication(createAppCtx) |
|
|
await createApplication(createAppCtx) |
|
|
opts.applicationId = createAppCtx.body.id |
|
|
opts.applicationId = createAppCtx.body.id |
|
|
|
|
|
console.log(chalk.green(`Application Created: ${createAppCtx.body.id}`)) |
|
|
await createInstance({ |
|
|
await createInstance({ |
|
|
params: { |
|
|
params: { |
|
|
clientId: process.env.CLIENT_ID, |
|
|
clientId: process.env.CLIENT_ID, |
|
|
@ -49,6 +48,7 @@ const createAppInstance = async opts => { |
|
|
body: { name: `dev-${process.env.CLIENT_ID}` }, |
|
|
body: { name: `dev-${process.env.CLIENT_ID}` }, |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
|
|
|
console.log(chalk.green(`Default Instance Created`)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const createEmptyAppPackage = async opts => { |
|
|
const createEmptyAppPackage = async opts => { |
|
|
|