re-start

1.14.8 • Public • Published

re-start

npm linux build windows build deps

js-semistandard-style Commitizen friendly semantic-release

⚙️ 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 reporter
  • releaseOpts - opts passed to start-release
  • lintOpts - opts passed to the lint task
  • compileOpts - opts passed to the compile task
  • testCompileOpts - opts passed to the compile task during test (typecript)
  • testOpts - opts passed to the test task
  • instrumentOpts - 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 for lint command. default: [...srcFiles, ...testFiles]
  • coverageFiles - files to instrument with instrument task. default: srcFiles
  • watchFiles - files to watch for dev command. default: srcFiles
  • testWatchFiles - files to watch for tdd 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 for lint command. default: ['src/**/*.ts', 'test/**/*.ts']
  • coverageFiles - files to instrument with instrument task. default: '.scratch/src/**/*.js'
  • watchFiles - files to watch for dev command. default: 'src/**/*.ts'
  • testWatchFiles - files to watch for tdd 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(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 -> coverage
  • release -> [ENV: production] release()

* not available with the es5 preset

Extend

Examples of extending a preset.

Readme

Keywords

Package Sidebar

Install

npm i re-start

Weekly Downloads

1

Version

1.14.8

License

MIT

Last publish

Collaborators

  • effervescentia