re-start
v1.14.8
Published
Start preset with reconfigurable tasks
Downloads
9,082
Readme
re-start
⚙️ Configurable Start preset
Install
npm install --save-dev re-start
# or
yarn add --dev re-start
Usage
See documentation and source tasks file for details.
Default (ES6)
// package.json
"scripts": {
"start": "start-runner --preset re-start"
}
Included Presets
typescript
:bundle
-start-webpack
compile
-start-typescript
test
-start-mocha
instrument
&report
-start-istanbul
lint
- currently unsupported
es6
:bundle
-start-webpack
compile
-babel
test
-start-mocha
instrument
&report
-start-istanbul
lint
-eslint
es5
:bundle
-start-webpack
test
-start-mocha
instrument
&report
-start-istanbul
lint
-eslint
Example:
// package.json
"scripts": {
"start": "start-runner --preset re-start/presets/typescript"
}
Configuration
reporter
- the reporter to use. default:start-pretty-reporter
tasks
lint
- the lint task. default:start-eslint
bundle
- the bundle task. default:start-webpack
compile
- the compile task. default:start-babel
test
- the test test. default:start-mocha
instrument
- the coverage instrumentation task. default:start-istanbul.instrument
report
- the coverage reporting task. default:start-istanbul.report
exportCoverage
- the task to export coverage reports. default:start-codecov
options
reporterOpts
- opts passed to the reporterreleaseOpts
- opts passed tostart-release
lintOpts
- opts passed to the lint taskcompileOpts
- opts passed to the compile tasktestCompileOpts
- opts passed to the compile task during test (typecript)testOpts
- opts passed to the test taskinstrumentOpts
- opts passed to the instrument task. default:{ esModules: true }
reportOpts
- opts passed to the reporting task. default:[ 'lcovonly', 'html', 'text-summary' ]
exportCoverageOpts
- opts passed to the coverage export task
files
srcFiles
- source file glob or glob array. default:'src/**/*.js'
testFiles
- test file glob or glob array. default:'test/**/*.js'
lintFiles
- files to read forlint
command. default:[...srcFiles, ...testFiles]
coverageFiles
- files to instrument withinstrument
task. default:srcFiles
watchFiles
- files to watch fordev
command. default:srcFiles
testWatchFiles
- files to watch fortdd
command. default:[...srcFiles, ...testFiles]
reportDir
- directory for coverage reports. default:'coverage/'
outDir
- directory for compiled code. default:'dist/'
bundleDir
- directory for bundled code. default:'bundle/'
coverageReport
- coverage report file. default:'coverage/lcov.info'
files (typescript-specific)
srcFiles
- source file glob or glob array. default:'src/index.ts'
testFiles
- test file glob or glob array. default:'test/**/*.ts'
scratchTestFiles
- compiled test file glob or glob array. default:'.scratch/test/**/*.js'
lintFiles
- files to read forlint
command. default:['src/**/*.ts', 'test/**/*.ts']
coverageFiles
- files to instrument withinstrument
task. default:'.scratch/src/**/*.js'
watchFiles
- files to watch fordev
command. default:'src/**/*.ts'
testWatchFiles
- files to watch fortdd
command. default:['src/**/*.ts', 'test/**/*.ts']
scratchDir
- directory for compiled code for test. default:'.scratch/'
Customized
// tasks.js
import { restart } from 're-start';
import tape from 'start-tape';
import tapSpec from 'tap-spec';
module.exports = restart({ testOpts: tapSpec, test: tape });
// package.json
"scripts": {
"start": "start-runner --preset tasks.js"
}
or put the configuration in your package.json
// package.json
"config": {
"restart": {
"lintOpts": "semistandard"
}
}
or pass your configuration with your command
npm start build -- -- --lintOpts semistandard
Hijack a command
Want to override a single command without having to repeat existing depending workflows?
Re-start commands target the references in the exported module, so you can simply
replace the whole lint
phase with it's inherent ties to ci
and prepush
with little more than the following:
import { restart } from 're-start';
import env from 'start-env';
import files from 'start-files';
import eslint from 'start-eslint';
const commands = module.exports = restart();
commands.lint = () => commands.start(
env('NODE_ENV', 'lint'),
files('test/**/*.js'),
eslint()
);
Available commands
build
* -[ENV: production]
in(srcFiles
) ->compile()
-> out(outDir
) ->postBuild()
postBuild
* - in(copyFiles
) -> out(copyDir
oroutDir
)dev
* -[ENV: development]
in(watchFiles
orsrcFiles
) -> watch(compile()
->postBuild()
) -> out(outDir
)bundle
-[ENV: development]
in(srcFiles
) ->bundle()
-> out(bundleDir
)bundle:prod
-[ENV: production]
in(srcFiles
) ->bundle()
-> out(bundleDir
)bundle:watch
-[ENV: development]
in(srcFiles
) -> watch(bundle()
)bundle:watch:prod
-[ENV: production]
in(srcFiles
) -> watch(bundle()
)lint
-[ENV: test]
in(lintFiles
orsrcFiles + testFiles
) -> lint()test
-[ENV: test]
in(testFiles
) ->test()
tdd
-[ENV: test]
in(testWatchFiles
ortestFiles
) -> watch(test
)coverage
-[ENV: test]
in(coverageFiles
orsrcFiles
) ->instrument()
->test
->report()
ci
-[ENV: test]
lint
->coverage
-> in(coverageReport
) ->exportCoverage()
prepush
->[ENV: test]
lint
->coverage
release
->[ENV: production]
release()
* not available with the es5
preset
Extend
Examples of extending a preset.