Skip to content
This repository was archived by the owner on May 10, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,21 +116,7 @@ async function updatePackageJSON(expressInstalled, packageJSON, account, app) {
}
}

async function checkServerConf() {
log('Checking for server.conf...')
if (!fs.existsSync(path.resolve('server.conf'))) {
log('')
log('your server.conf is not defined. Please run the following to initialize a server.conf:')
log('sectionctl apps init')
prompt.start()
const installOK = ps(`OK to run sectionctl apps init in current directory? ${defaultYes}`)
const res = await prompt.get(installOK)
if (yn(res[installOK], { default: true })) {
const result = spawn.sync('sectionctl', ['apps', 'init'], {
stdio: 'inherit'
})
}
}
async function npmRunDeploy() {
log('')
log(chalk.greenBright('🎉 Success!'))
log(`You can now run \`${chalk.greenBright('npm run deploy')}\` to deploy your app on section.`)
Expand All @@ -145,4 +131,4 @@ async function checkServerConf() {
}
}

module.exports = { checkPackageJSON, checkServerConf, updatePackageJSON }
module.exports = { checkPackageJSON, npmRunDeploy, updatePackageJSON }
4 changes: 2 additions & 2 deletions src/scripts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { checkPackageJSON, updatePackageJSON, checkServerConf } = require('./common')
const { checkPackageJSON, updatePackageJSON, npmRunDeploy } = require('./common')

async function run(cli) {
if (!cli.flags.account || !cli.flags.app) {
Expand All @@ -22,6 +22,6 @@ async function run(cli) {

await updatePackageJSON(false, packageJSON, cli.flags.account, cli.flags.app)

await checkServerConf()
await npmRunDeploy()
}
module.exports.run = run
4 changes: 2 additions & 2 deletions src/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fs = require('fs')
const prompt = require('prompt')
const yn = require('yn')
const chalk = require('chalk')
const { checkPackageJSON, updatePackageJSON, checkServerConf } = require('./common')
const { checkPackageJSON, updatePackageJSON, npmRunDeploy } = require('./common')
const log = console.log
const error = chalk.bold.red
const warning = chalk.keyword('orange')
Expand Down Expand Up @@ -109,7 +109,7 @@ async function run(cli) {
//TODO: Determine if npm run build exists, and if not, don't include it in predeploy.
await updatePackageJSON(expressInstalled, packageJSON, cli.flags.account, cli.flags.app)

await checkServerConf()
await npmRunDeploy()
}

module.exports.run = run