TypeScript JavaScript
Switch branches/tags
reporter-verbose@0.1.0 plugin@0.2.0 plugin@0.1.0 plugin-xargs@0.2.0 plugin-xargs@0.1.0 plugin-write@0.2.0 plugin-write@0.1.3 plugin-write@0.1.2 plugin-write@0.1.1 plugin-write@0.1.0 plugin-watch@0.2.0 plugin-watch@0.1.1 plugin-watch@0.1.0 plugin-unpack@0.2.0 plugin-unpack@0.1.0 plugin-spawn@0.2.0 plugin-spawn@0.1.0 plugin-sequence@0.2.0 plugin-sequence@0.1.0 plugin-rename@0.2.0 plugin-rename@0.1.1 plugin-rename@0.1.0 plugin-remove@0.2.1 plugin-remove@0.2.0 plugin-remove@0.1.0 plugin-read@0.2.0 plugin-read@0.1.1 plugin-read@0.1.0 plugin-parallel@0.2.0 plugin-parallel@0.1.0 plugin-overwrite@0.2.0 plugin-overwrite@0.1.1 plugin-overwrite@0.1.0 plugin-lib-webpack@0.2.0 plugin-lib-webpack@0.1.0 plugin-lib-webpack-serve@0.3.0 plugin-lib-webpack-serve@0.2.0 plugin-lib-webpack-serve@0.1.0 plugin-lib-typescript-generate@0.2.2 plugin-lib-typescript-generate@0.2.1 plugin-lib-typescript-generate@0.2.0 plugin-lib-typescript-generate@0.1.1 plugin-lib-typescript-generate@0.1.0 plugin-lib-typescript-check@0.2.1 plugin-lib-typescript-check@0.2.0 plugin-lib-typescript-check@0.1.1 plugin-lib-typescript-check@0.1.0 plugin-lib-tape@0.2.0 plugin-lib-tape@0.1.1 plugin-lib-tape@0.1.0 plugin-lib-rollup@0.1.0 plugin-lib-prettier-eslint@0.2.0 plugin-lib-prettier-eslint@0.1.0 plugin-lib-postcss@0.1.0 plugin-lib-npm-version@0.2.0 plugin-lib-npm-version@0.1.0 plugin-lib-npm-publish@0.2.0 plugin-lib-npm-publish@0.1.0 plugin-lib-karma@0.2.0 plugin-lib-karma@0.1.2 plugin-lib-karma@0.1.1 plugin-lib-karma@0.1.0 plugin-lib-jest@0.3.0 plugin-lib-jest@0.2.0 plugin-lib-jest@0.1.1 plugin-lib-jest@0.1.0 plugin-lib-istanbul@0.2.1 plugin-lib-istanbul@0.2.0 plugin-lib-istanbul@0.1.1 plugin-lib-istanbul@0.1.0 plugin-lib-flow-generate@0.2.0 plugin-lib-flow-generate@0.1.0 plugin-lib-flow-check@0.2.0 plugin-lib-flow-check@0.1.1 plugin-lib-flow-check@0.1.0 plugin-lib-esm-loader@0.1.3 plugin-lib-esm-loader@0.1.1 plugin-lib-eslint@0.3.0 plugin-lib-eslint@0.2.0 plugin-lib-eslint@0.1.1 plugin-lib-eslint@0.1.0 plugin-lib-codecov@0.2.0 plugin-lib-codecov@0.1.0 plugin-lib-babel@0.2.0 plugin-lib-babel@0.1.1 plugin-lib-babel@0.1.0 plugin-input-files@0.2.0 plugin-input-files@0.1.1 plugin-input-files@0.1.0 plugin-flow-check-generate@0.1.1 plugin-find@0.2.0 plugin-find@0.1.0 plugin-find-git-staged@0.2.0 plugin-find-git-staged@0.1.1 plugin-find-git-staged@0.1.0 plugin-env@0.3.0 plugin-env@0.2.0 plugin-env@0.1.0 plugin-copy@0.2.1 plugin-copy@0.2.0
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

readme.md

start

linux windows coverage

logo

  • functional – in all senses
  • fast – parallelism and concurrency
  • shareable – presets as published packages
  • 4th line to align with logo on the right

TOC

Example

.
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ foo/
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   └── index.ts
β”‚   β”‚   β”œβ”€β”€ test/
β”‚   β”‚   β”‚   └── index.ts
β”‚   β”‚   └── package.json
β”‚   └── bar/
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   └── index.ts
β”‚       β”œβ”€β”€ test/
β”‚       β”‚   └── index.ts
β”‚       └── package.json
β”œβ”€β”€ package.json
└── tasks.ts
$ yarn add --dev --ignore-workspace-root-check \
  @babel/core \
  @babel/register \
  @babel/preset-env \
  @babel/preset-typescript \
  @start/cli \
  @start/reporter-verbose \
  @start/plugin-sequence \
  @start/plugin-parallel \
  @start/plugin-xargs \
  @start/plugin-find \
  @start/plugin-find-git-staged \
  @start/plugin-remove \
  @start/plugin-read \
  @start/plugin-rename \
  @start/plugin-write \
  @start/plugin-lib-babel \
  @start/plugin-lib-typescript-generate \
  @start/plugin-lib-eslint \
  @start/plugin-lib-istanbul \
  @start/plugin-lib-tape \
  @start/plugin-lib-codecov
// package.json

{
  "private": true,
  "description": "Start example",
  "workspaces": [
    "packages/*"
  ],
  "devDependencies": {},
  "start": {
    // tasks file, default to `./tasks`
    "file": "./tasks"
    "require": [
      [
        "@babel/register",
        {
          "extensions": [
            ".ts",
            ".js"
          ]
        }
      ]
    ],
    "reporter": "@start/reporter-verbose"
  },
  "babel": {
    "presets": [
      [
        "@babel/preset-env",
        {
          "targets": {
            "node": "current"
          },
          // "Tomorrow's ECMAScript modules today"
          // @start/cli includes https://github.com/standard-things/esm by default
          "modules": false
        }
      ],
      // Babel 7
      "@babel/preset-typescript"
    ]
  }
}
// tasks.ts

// write tasks file once, publish it and then reuse or even extend
// in all projects using `start.preset` option in `package.json`,
// something like `my-start-preset` package with everything included

import sequence from '@start/plugin-sequence'
import parallel from '@start/plugin-parallel'
import xargs from '@start/plugin-xargs'
import find from '@start/plugin-find'
import findGitStaged from '@start/plugin-find-git-staged'
import remove from '@start/plugin-remove'
import read from '@start/plugin-read'
import rename from '@start/plugin-rename'
import write from '@start/plugin-write'
import babel from '@start/plugin-lib-babel'
import typescriptGenerate from '@start/plugin-lib-typescript-generate'
import eslint from '@start/plugin-lib-eslint'
import {
  istanbulInstrument,
  istanbulReport,
  istanbulThresholds
} from '@start/plugin-lib-istanbul'
import tape from '@start/plugin-lib-tape'
import codecov from '@start/plugin-lib-codecov'

const babelConfig = {
  babelrc: false,
  presets: [
    [
      '@babel/preset-env',
      {
        targets: {
          node: 6
        },
        modules: false
      }
    ],
    '@babel/preset-typescript'
  ]
}

// each named export is a "task"
export const build = (packageName: string) =>
  sequence(
    find(`packages/${packageName}/src/**/*.ts`),
    read,
    babel(babelConfig),
    rename((file) => file.replace(/\.ts$/, '.js')),
    write(`packages/${packageName}/build/`)
  )

export const dts = (packageName: string) =>
  sequence(
    find(`packages/${packageName}/src/index.ts`),
    typescriptGenerate(`packages/${packageName}/build/`)
  )

export const pack = (packageName: string) =>
  sequence(
    find(`packages/${packageName}/build/`),
    remove,
    // child-processes
    parallel(['build', 'dts'])(packageName)
  )

// child processes
export const packs = xargs('pack')

export const dev = (packageName: string) =>
  watch(`packages/${packageName}/**/*.ts`)(
    build(packageName)
  )

export const lint = () =>
  sequence(
    findGitStaged(['packages/*/{src,test}/**/*.ts']),
    read,
    eslint()
  )

export const lintAll = () =>
  sequence(
    find(['packages/*/{src,test}/**/*.ts']),
    read,
    eslint()
  )

export const test = () =>
  sequence(
    find('coverage/'),
    remove,
    find('packages/*/src/**/*.ts'),
    istanbulInstrument({ esModules: true, extensions: ['.ts'] }),
    find('packages/*/test/**/*.ts'),
    tape(),
    istanbulReport(['lcovonly', 'html', 'text-summary']),
    istanbulThresholds({ functions: 100 })
  )

export const ci = () =>
  sequence(
    // nested task
    lintAll(),
    // nested task
    test(),
    find('coverage/lcov.info'),
    read,
    codecov
  )
$ yarn start
# or
$ npx start

One of the following task names is required:
* build
* dts
* pack
* packs
* dev
* lint
* lintAll
* test
* ci
$ yarn start build foo
$ yarn start dts foo
$ yarn start pack foo
$ yarn start packs foo bar
$ yarn start dev bar
$ yarn start lint
$ yarn start lintAll
$ yarn start test
$ yarn start ci

How to

Recipes

  • Node.js TypeScript library preset – @deepsweet/start-preset-node-ts-lib
  • Node.js TypeScript libraries monorepo – Start project builds itself from sources using sources, see tasks/index.ts
  • React / React Native (higher-order) components monorepo – hocs
  • React app – to be added

Packages

Core

  • ⬛️ cli – CLI entry point
  • βš™οΈ plugin – plugin creator
  • πŸ“ƒ reporter-verbose – verbose reporter

Plugins

Misc

  • ⏩ plugin-sequence – run plugins in sequence
  • πŸ”€ plugin-parallel – run tasks as parallel child processes with same agruments
  • πŸ”‚ plugin-xargs – run task as parallel child process for each argument
  • 🐣 plugin-spawn – spawn new child process
  • πŸ‘” plugin-env – set environment variable using process.env
  • πŸ”Œ plugin-input-files – inject arguments as files into Start flow files
  • πŸ”Œ plugin-output-files – to be added

FS

  • πŸ” plugin-find – find files using glob patterns
  • πŸ” plugin-find-git-staged – find Git staged files and filter them using glob patterns
  • πŸ“– plugin-read – read files content
  • πŸ”  plugin-rename – rename files
  • ❌ plugin-remove – remove files or directories
  • πŸ‘― plugin-copy – copy files to relative destination using streams and keeping folders structure
  • ✏️ plugin-write – write files with source maps to relative destination keeping folders structure
  • ✏️ plugin-overwrite – overwrite files
  • πŸ‘€ plugin-watch – watch for new or changed files matched by glob patterns
  • πŸ—œ plugin-unpack – unpack .tar/.tar.bz2/.tar.gz/.zip archives

Build and bundle

Tests

Lint, check and fix

CI and publish

Tasks

Coming soon.

Roadmap

  • stabilize and publish 0.1.0 of everything
  • documentation
  • more tests
  • migrate the rest of important plugins

Copyright

All the packages in this repository are released under the terms of the MIT License.

The font used in logo is supernova fat.