Commit 780066cb authored by Rik Smith-Unna's avatar Rik Smith-Unna
Browse files

move to async/await for client app setup

parent 4bd594ea
Pipeline #1093 failed with stage
in 5 minutes and 8 seconds
const spawn = require('child_process').spawnSync
const path = require('path')
const tmpdir = await require('pubsweet-cli/test/helpers/working_dir')()
const appname = 'testapp'
fs.mkdirsSync(path.join(tmpdir, appname))
logger.info('created directory')
await require('pubsweet-cli/src/generate-config')()
logger.info('config generated')
await require('pubsweet-cli/src/generate-env')()
logger.info('env generated')
await require('pubsweet-cli/src/initial-app')(appname)
logger.info('app generated')
await require('pubsweet-cli/src/setup-db')({
properties: require('pubsweet-cli/src/db-properties'),
override: dbconfig
})
logger.info('db created')
require('pubsweet-cli/src/load-config')(path.resolve('', './config'))
logger.info('config loaded')
spawn(
'npm install',
[path.join(__dirname, '..', '..')],
{
cwd: process.cwd(),
stdio: 'ignore',
shell: true
}
)
logger.info('starting server')
require('pubsweet-cli/src/start')(_server => {
server = _server
logger.info('server started')
done()
})
const fs = require('fs-extra')
const run = async () => {
const tmpdir = await require('pubsweet-cli/test/helpers/working_dir')()
const appname = 'testapp'
fs.mkdirsSync(path.join(tmpdir, appname))
console.log('created directory')
await require('pubsweet-cli/src/generate-config')()
console.log('config generated')
await require('pubsweet-cli/src/generate-env')()
console.log('env generated')
await require('pubsweet-cli/src/initial-app')(appname)
console.log('app generated')
await require('pubsweet-cli/src/setup-db')({
properties: require('pubsweet-cli/src/db-properties'),
override: require('pubsweet-cli/test/fixtures').dbconfig
})
console.log('db created')
require('pubsweet-cli/src/load-config')(path.resolve('', './config'))
console.log('config loaded')
spawn(
'npm install',
[path.join(__dirname, '..', '..')],
{
cwd: process.cwd(),
stdio: 'ignore',
shell: true
}
)
console.log('starting server')
require('pubsweet-cli/src/start')(_server => {
console.log('PARENT SHOULD DETACH')
})
}
module.exports = run
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment