feat: preview with optional rebuild (#36)

Now the preview script has an optional build step. Adding --no-rebuild
as an argument to the script will skip the rebuild step and just show a
preview of the parse as is with the current build.
pull/35/head^2
Adam Pash 8 years ago committed by GitHub
parent 181b39b238
commit bd0694fbba

@ -2,12 +2,25 @@
var fs = require('fs')
var execSync = require('child_process').execSync
console.log('Rebuilding Mercury')
execSync('MERCURY_TEST_BUILD=true npm run build')
var optRe = /^--/
var args = process.argv.slice(2).reduce((acc, arg) => {
if (optRe.test(arg)) {
acc.opts.push(arg)
} else {
acc.urls.push(arg)
}
var Mercury = require('./dist/mercury_test')
return acc
}, { opts: [], urls: [] })
var urls = args.urls
var urls = process.argv.slice(2)
if (!args.opts.find(arg => arg === '--no-rebuild')) {
console.log('Rebuilding Mercury')
execSync('MERCURY_TEST_BUILD=true npm run build')
}
var Mercury = require('./dist/mercury_test')
console.log(`Fetching link(s)`)

Loading…
Cancel
Save