Skip to content
Snippets Groups Projects
Commit 98b1d7e6 authored by Isabella Skořepová's avatar Isabella Skořepová
Browse files

Do not block

parent dbf08282
No related branches found
No related tags found
No related merge requests found
Pipeline #1020 passed
#!/usr/bin/env node
const { spawnSync, spawn } = require('child_process')
const { spawn } = require('child_process')
const config = require('./sitegin/config')
function runBabel({ onExit, opts = [] }) {
......@@ -13,13 +13,23 @@ function runBabel({ onExit, opts = [] }) {
function runBabelWatch() {
runBabel({
onExit: () => {
setTimeout(() => runBabelWatch(), 500)
},
onExit: () => setTimeout(runBabelWatch(), 500),
opts: ['--skip-initial-build', '--watch'],
})
}
function runNodemon({ onExit }) {
const babel = spawn(
'./node_modules/.bin/nodemon',
['--ignore', 'build-debug', 'sitegin/index.js'],
{ stdio: 'inherit', cwd: __dirname },
)
if (onExit) babel.on('exit', onExit)
}
function runNodemonWatch() {
runNodemon({ onExit: () => setTimeout(runNodemonWatch, 500) })
}
;(async () => {
const opts = await config()
await new Promise(res =>
......@@ -28,17 +38,7 @@ function runBabelWatch() {
const watch = !opts.config.options.nowatch
if (watch) {
runBabelWatch()
spawnSync(
process.argv[0],
[
'./node_modules/.bin/nodemon',
'--ignore',
'build-debug',
'sitegin/index.js',
...process.argv.slice(2),
],
{ stdio: ['inherit', 'inherit', 'inherit'] },
)
runNodemonWatch()
} else {
require('./sitegin/index.js')
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment