Last active
August 9, 2017 08:41
-
-
Save pawelgalazka/65f9ad8e9fed5f5af94504ff66fffd7a to your computer and use it in GitHub Desktop.
Example of runfile.js (for medium article)
This file contains hidden or 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, 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