start
- 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"
}
}
],
// 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 usingprocess.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
๐ญ plugin-lib-babel โ transform files using Babel๐ญ plugin-lib-esm-loader โ copy a predefined ESM loader file to a directory๐ญ plugin-lib-webpack โ bundle files using Webpack๐ญ plugin-lib-webpack-dev-server โ run Webpack development server๐ญ plugin-lib-rollup โ bundle files using Rollup๐ญ plugin-lib-typescript-generate โ generate.d.ts
files using TypeScript๐ญ plugin-lib-flow-generate โ generate.js.flow
files using Flow๐ญ plugin-lib-postcss โ transform files using PostCSS๐ญ plugin-lib-less โ to be migrated๐ญ plugin-lib-clean-css โ to be migrated๐ญ plugin-lib-uglify โ to be migrated
Tests
โ plugin-lib-jest โย run tests using Jestโ plugin-lib-tape โ run tests using Tapeโ plugin-lib-karma โ run tests using Karma๐ฏ plugin-lib-instanbul โ collect, report and check code coverage using Istanbulโ plugin-lib-ava โ to be migratedโ plugin-lib-mocha โ to be migratedโ plugin-assert โย Node.jsassert()
Lint, check and fix
๐ท plugin-lib-eslint โ lint and/or fix code using ESLint๐ท plugin-lib-prettier-eslint โ fix code(style) using Prettier + ESLint๐ท plugin-lib-typescript-check โย check types using TypeScript๐ท plugin-lib-flow-check โ check types using Flow
CI and publish
๐ฏ plugin-lib-codecov โ send code coverage report to codecov.io๐ข plugin-lib-npm-version โ bump package version๐ฆ plugin-lib-npm-publish โย publish package to NPM๐ฏ plugin-lib-coveralls โ to be migrated
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.