forked from tsai/budibase
3 changed files with 37 additions and 12 deletions
@ -1,12 +1,40 @@ |
|||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||
const { exportTemplateFromApp } = require("../src/utilities/templates") |
const { exportTemplateFromApp } = require("../src/utilities/templates") |
||||
|
const yargs = require("yargs") |
||||
|
|
||||
// Script to export a chosen budibase app into a package
|
// Script to export a chosen budibase app into a package
|
||||
|
// Usage: ./scripts/exportAppTemplate.js export --name=Funky --instanceId=someInstanceId --appId=appId
|
||||
|
|
||||
const [name, instanceId, appId] = process.argv.slice(1) |
yargs |
||||
|
.command( |
||||
exportTemplateFromApp({ |
"export", |
||||
templateName: "Funky", |
"Export an existing budibase application to the .budibase/templates directory", |
||||
instanceId: "inst_b70abba_16feb394866140a1ac3f2e450e99f28a", |
{ |
||||
appId: "b70abba3874546bf99a339911b579937", |
name: { |
||||
}) |
description: "The name of the newly exported template", |
||||
|
alias: "n", |
||||
|
type: "string", |
||||
|
}, |
||||
|
instanceId: { |
||||
|
description: "The instanceId to dump the database for", |
||||
|
alias: "inst", |
||||
|
type: "string", |
||||
|
}, |
||||
|
appId: { |
||||
|
description: "The appId of the application you want to export", |
||||
|
alias: "app", |
||||
|
type: "string", |
||||
|
}, |
||||
|
}, |
||||
|
async args => { |
||||
|
console.log("Exporting app..") |
||||
|
const exportPath = await exportTemplateFromApp({ |
||||
|
templateName: args.name, |
||||
|
instanceId: args.instanceId, |
||||
|
appId: args.appId, |
||||
|
}) |
||||
|
console.log(`Template ${args.name} exported to ${exportPath}`) |
||||
|
} |
||||
|
) |
||||
|
.help() |
||||
|
.alias("help", "h").argv |
||||
|
|||||
Loading…
Reference in new issue