re-start v1.14.8
re-start
⚙️ Configurable Start preset
Install
npm install --save-dev re-start
# or
yarn add --dev re-startUsage
See documentation and source tasks file for details.
Default (ES6)
// package.json
"scripts": {
"start": "start-runner --preset re-start"
}Included Presets
typescript:bundle-start-webpackcompile-start-typescripttest-start-mochainstrument&report-start-istanbullint- currently unsupported
es6:bundle-start-webpackcompile-babeltest-start-mochainstrument&report-start-istanbullint-eslint
es5:bundle-start-webpacktest-start-mochainstrument&report-start-istanbullint-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-eslintbundle- the bundle task. default:start-webpackcompile- the compile task. default:start-babeltest- the test test. default:start-mochainstrument- the coverage instrumentation task. default:start-istanbul.instrumentreport- the coverage reporting task. default:start-istanbul.reportexportCoverage- the task to export coverage reports. default:start-codecov
options
reporterOpts- opts passed to the reporterreleaseOpts- opts passed tostart-releaselintOpts- 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 forlintcommand. default:[...srcFiles, ...testFiles]coverageFiles- files to instrument withinstrumenttask. default:srcFileswatchFiles- files to watch fordevcommand. default:srcFilestestWatchFiles- files to watch fortddcommand. 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 forlintcommand. default:['src/**/*.ts', 'test/**/*.ts']coverageFiles- files to instrument withinstrumenttask. default:'.scratch/src/**/*.js'watchFiles- files to watch fordevcommand. default:'src/**/*.ts'testWatchFiles- files to watch fortddcommand. 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(copyDiroroutDir)dev* -[ENV: development]in(watchFilesorsrcFiles) -> 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(lintFilesorsrcFiles + testFiles) -> lint()test-[ENV: test]in(testFiles) ->test()tdd-[ENV: test]in(testWatchFilesortestFiles) -> watch(test)coverage-[ENV: test]in(coverageFilesorsrcFiles) ->instrument()->test->report()ci-[ENV: test]lint->coverage-> in(coverageReport) ->exportCoverage()prepush->[ENV: test]lint->coveragerelease->[ENV: production]release()
* not available with the es5 preset
Extend
Examples of extending a preset.
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago