UNPKG

9.86 kBMarkdownView Raw
1<div align="center">
2<h1>kcd-scripts 🛠📦</h1>
3
4<p>CLI toolbox for common scripts for my projects</p>
5</div>
6
7<hr />
8
9[![Build Status][build-badge]][build]
10[![Code Coverage][coverage-badge]][coverage]
11[![version][version-badge]][package]
12[![downloads][downloads-badge]][npmcharts]
13[![MIT License][license-badge]][license]
14
15[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors)
16[![PRs Welcome][prs-badge]][prs]
17[![Code of Conduct][coc-badge]][coc]
18
19[![Watch on GitHub][github-watch-badge]][github-watch]
20[![Star on GitHub][github-star-badge]][github-star]
21[![Tweet][twitter-badge]][twitter]
22
23## The problem
24
25I do a bunch of open source and want to make it easier to maintain so many
26projects.
27
28## This solution
29
30This is a CLI that abstracts away all configuration for my open source projects
31for linting, testing, building, and more.
32
33## Table of Contents
34
35<!-- START doctoc generated TOC please keep comment here to allow auto update -->
36<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
37
38- [Installation](#installation)
39- [Usage](#usage)
40 - [Overriding Config](#overriding-config)
41 - [Flow support](#flow-support)
42- [Inspiration](#inspiration)
43- [Other Solutions](#other-solutions)
44- [Contributors](#contributors)
45- [LICENSE](#license)
46
47<!-- END doctoc generated TOC please keep comment here to allow auto update -->
48
49## Installation
50
51This module is distributed via [npm][npm] which is bundled with [node][node] and
52should be installed as one of your project's `devDependencies`:
53
54```
55npm install --save-dev kcd-scripts
56```
57
58## Usage
59
60This is a CLI and exposes a bin called `kcd-scripts`. I don't really plan on
61documenting or testing it super duper well because it's really specific to my
62needs. You'll find all available scripts in `src/scripts`.
63
64This project actually dogfoods itself. If you look in the `package.json`, you'll
65find scripts with `node src {scriptName}`. This serves as an example of some
66of the things you can do with `kcd-scripts`.
67
68### Overriding Config
69
70Unlike `react-scripts`, `kcd-scripts` allows you to specify your own
71configuration for things and have that plug directly into the way things work
72with `kcd-scripts`. There are various ways that it works, but basically if you
73want to have your own config for something, just add the configuration and
74`kcd-scripts` will use that instead of it's own internal config. In addition,
75`kcd-scripts` exposes its configuration so you can use it and override only
76the parts of the config you need to.
77
78This can be a very helpful way to make editor integration work for tools like
79ESLint which require project-based ESLint configuration to be present to work.
80
81So, if we were to do this for ESLint, you could create an `.eslintrc` with the
82contents of:
83
84```
85{"extends": "./node_modules/kcd-scripts/eslint.js"}
86```
87
88> Note: for now, you'll have to include an `.eslintignore` in your project until
89> [this eslint issue is resolved](https://github.com/eslint/eslint/issues/9227).
90
91Or, for `babel`, a `.babelrc` with:
92
93```
94{"presets": ["kcd-scripts/babel"]}
95```
96
97Or, for `jest`:
98
99```javascript
100const {jest: jestConfig} = require('kcd-scripts/config')
101module.exports = Object.assign(jestConfig, {
102 // your overrides here
103
104 // for test written in Typescript, add:
105 transform: {
106 '\\.(ts|tsx)$': '<rootDir>/node_modules/ts-jest/preprocessor.js',
107 },
108})
109```
110
111> Note: `kcd-scripts` intentionally does not merge things for you when you start
112> configuring things to make it less magical and more straightforward. Extending
113> can take place on your terms. I think this is actually a great way to do this.
114
115### Flow support
116
117If the `flow-bin` is a dependency on the project the `@babel/preset-flow` will automatically get loaded when you use the default babel config that comes with `kcd-scripts`. If you customised your `.babelrc`-file you might need to manually add `@babel/preset-flow` to the `presets`-section.
118
119## Inspiration
120
121This is inspired by `react-scripts`.
122
123## Other Solutions
124
125I'm not aware of any, if you are please [make a pull request][prs] and add it
126here! Again, this is a very specific-to-me solution.
127
128## Contributors
129
130Thanks goes to these people ([emoji key][emojis]):
131
132<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
133<!-- prettier-ignore -->
134| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;" alt="Kent C. Dodds"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/kcd-scripts/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/kcd-scripts/commits?author=kentcdodds "Tests") | [<img src="https://avatars2.githubusercontent.com/u/22251956?v=4" width="100px;" alt="Suhas Karanth"/><br /><sub><b>Suhas Karanth</b></sub>](https://github.com/sudo-suhas)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=sudo-suhas "Code") [🐛](https://github.com/kentcdodds/kcd-scripts/issues?q=author%3Asudo-suhas "Bug reports") [⚠️](https://github.com/kentcdodds/kcd-scripts/commits?author=sudo-suhas "Tests") | [<img src="https://avatars0.githubusercontent.com/u/1402095?v=4" width="100px;" alt="Matt Parrish"/><br /><sub><b>Matt Parrish</b></sub>](https://github.com/pbomb)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=pbomb "Code") [⚠️](https://github.com/kentcdodds/kcd-scripts/commits?author=pbomb "Tests") | [<img src="https://avatars3.githubusercontent.com/u/1319157?v=4" width="100px;" alt="Mateus"/><br /><sub><b>Mateus</b></sub>](https://github.com/mateuscb)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=mateuscb "Code") [⚠️](https://github.com/kentcdodds/kcd-scripts/commits?author=mateuscb "Tests") | [<img src="https://avatars1.githubusercontent.com/u/2344137?v=4" width="100px;" alt="Macklin Underdown"/><br /><sub><b>Macklin Underdown</b></sub>](http://macklin.underdown.me)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=macklinu "Code") [⚠️](https://github.com/kentcdodds/kcd-scripts/commits?author=macklinu "Tests") | [<img src="https://avatars2.githubusercontent.com/u/179534?v=4" width="100px;" alt="stereobooster"/><br /><sub><b>stereobooster</b></sub>](https://github.com/stereobooster)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=stereobooster "Code") [⚠️](https://github.com/kentcdodds/kcd-scripts/commits?author=stereobooster "Tests") | [<img src="https://avatars0.githubusercontent.com/u/410792?v=4" width="100px;" alt="Dony Sukardi"/><br /><sub><b>Dony Sukardi</b></sub>](http://dsds.io)<br />[🐛](https://github.com/kentcdodds/kcd-scripts/issues?q=author%3Adonysukardi "Bug reports") [💻](https://github.com/kentcdodds/kcd-scripts/commits?author=donysukardi "Code") |
135| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
136| [<img src="https://avatars3.githubusercontent.com/u/8997319?v=4" width="100px;" alt="Alexander Nanberg"/><br /><sub><b>Alexander Nanberg</b></sub>](https://alexandernanberg.com)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=alexandernanberg "Code") | [<img src="https://avatars2.githubusercontent.com/u/7818365?v=4" width="100px;" alt="Alex Liang"/><br /><sub><b>Alex Liang</b></sub>](https://github.com/fobbyal)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=fobbyal "Code") | [<img src="https://avatars1.githubusercontent.com/u/649578?v=4" width="100px;" alt="Jeff Detmer"/><br /><sub><b>Jeff Detmer</b></sub>](http://www.jeffdetmer.com)<br />[💻](https://github.com/kentcdodds/kcd-scripts/commits?author=shellthor "Code") |
137<!-- ALL-CONTRIBUTORS-LIST:END -->
138
139This project follows the [all-contributors][all-contributors] specification.
140Contributions of any kind welcome!
141
142## LICENSE
143
144MIT
145
146[npm]: https://www.npmjs.com/
147[node]: https://nodejs.org
148[build-badge]: https://img.shields.io/travis/kentcdodds/kcd-scripts.svg?style=flat-square
149[build]: https://travis-ci.org/kentcdodds/kcd-scripts
150[coverage-badge]: https://img.shields.io/codecov/c/github/kentcdodds/kcd-scripts.svg?style=flat-square
151[coverage]: https://codecov.io/github/kentcdodds/kcd-scripts
152[version-badge]: https://img.shields.io/npm/v/kcd-scripts.svg?style=flat-square
153[package]: https://www.npmjs.com/package/kcd-scripts
154[downloads-badge]: https://img.shields.io/npm/dm/kcd-scripts.svg?style=flat-square
155[npmcharts]: http://npmcharts.com/compare/kcd-scripts
156[license-badge]: https://img.shields.io/npm/l/kcd-scripts.svg?style=flat-square
157[license]: https://github.com/kentcdodds/kcd-scripts/blob/master/LICENSE
158[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
159[prs]: http://makeapullrequest.com
160[donate-badge]: https://img.shields.io/badge/$-support-green.svg?style=flat-square
161[coc-badge]: https://img.shields.io/badge/code%20of-conduct-ff69b4.svg?style=flat-square
162[coc]: https://github.com/kentcdodds/kcd-scripts/blob/master/other/CODE_OF_CONDUCT.md
163[github-watch-badge]: https://img.shields.io/github/watchers/kentcdodds/kcd-scripts.svg?style=social
164[github-watch]: https://github.com/kentcdodds/kcd-scripts/watchers
165[github-star-badge]: https://img.shields.io/github/stars/kentcdodds/kcd-scripts.svg?style=social
166[github-star]: https://github.com/kentcdodds/kcd-scripts/stargazers
167[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20kcd-scripts!%20https://github.com/kentcdodds/kcd-scripts%20%F0%9F%91%8D
168[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/kentcdodds/kcd-scripts.svg?style=social
169[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key
170[all-contributors]: https://github.com/kentcdodds/all-contributors