Skip to content

Instantly share code, notes, and snippets.

@pawelgalazka
Last active August 9, 2017 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pawelgalazka/65f9ad8e9fed5f5af94504ff66fffd7a to your computer and use it in GitHub Desktop.
Save pawelgalazka/65f9ad8e9fed5f5af94504ff66fffd7a to your computer and use it in GitHub Desktop.
Example of runfile.js (for medium article)
import { run, option } from 'runjs'
export function clean () {
run('rm -rf node_modules')
run('rm -rf build')
}
export function lint (path = '.') {
option(this, 'fix') ? run(`eslint ${path} --fix`) : run(`eslint ${path}`)
}
export function dev () {
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})
}
export function test () {
let watch
if (option(this, 'watch')) {
watch = watch ? '--watch' : ''
} else {
watch = ''
lint()
}
run(`mocha plugins/**/*.test.js --require mochaccino/dom-setup --compilers js:babel-register${watch}`)
}
export const build = {
clean () {
run('rm -rf build')
run('mkdir build')
run('rm -f ./core/index.node.bundle.js')
}
dev () {
// ...
}
dist () {
build.clean()
run('webpack -p --config config/webpack/prod.js --display-error-details')
run('webpack --config config/webpack/node.js --display-error-details')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment