-
-
Save pertrai1/9acaa53a6cfd9f37405314b8540711fd to your computer and use it in GitHub Desktop.
Example of runfile.js (for medium article)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { run } from 'runjs' | |
const task = { | |
'clean': () => { | |
run('rm -rf node_modules') | |
run('rm -rf build') | |
}, | |
'build:clean': () => { | |
run('rm -rf build') | |
run('mkdir build') | |
run('rm -f ./core/index.node.bundle.js') | |
}, | |
'build:dev': () => { | |
// ... | |
}, | |
'build:prod': () => { | |
task['build:clean']() | |
task['build:html']() | |
run('webpack -p --config config/webpack/prod.js --display-error-details') | |
run('webpack --config config/webpack/node.js --display-error-details') | |
}, | |
'lint': (path = '.') => { | |
run(`eslint ${path}`) | |
}, | |
'lint:fix': (path = '.') => { | |
run(`eslint ${path} --fix`) | |
}, | |
'start': () => { | |
task['build:dev']() | |
run('nodemon --exec node -- core/index.node.dev.js', {async: true}) | |
run('webpack-dev-server --hot --progress --config config/webpack/dev.js', {async: true}) | |
}, | |
'start:prod': () => { | |
run('node ./core/index.node.bundle.js') | |
}, | |
'test': (watch = false) => { | |
if (watch) { | |
watch = watch ? '--watch' : '' | |
} else { | |
watch = '' | |
task['lint']() | |
} | |
run(`mocha plugins/**/*.test.js --require mochaccino/dom-setup --compilers js:babel-register${watch}`) | |
} | |
} | |
export default task |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment