https://github.com/ozum/moe-scripts
https://github.com/ozum/moe-scripts
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ozum/moe-scripts
- Owner: ozum
- License: mit
- Created: 2018-03-04T04:37:13.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-03T11:08:59.000Z (over 7 years ago)
- Last Synced: 2025-03-11T08:50:54.698Z (10 months ago)
- Language: TypeScript
- Size: 2.35 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.hbs
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# moe-scripts
[](http://commitizen.github.io/cz-cli/)
# Description
CLI toolbox for common scripts for JavaScript / TypeScript projects. Inspired by ["Tools without config"](https://blog.kentcdodds.com/automation-without-config-412ab5e47229)
and [kcd-scripts](https://github.com/kentcdodds/kcd-scripts)
# Synopsis
1. Create a project:
* `npm init my-project`
* If TypeScript: add `types` into `package.json` such as:
* `{ "types": "lib/index" }`
1. Install:
* `npm install --save-dev moe-scripts`
1. Use scripts:
* `npm run build -- --watch`
* `npm run build:doc`
* `npm run validate`
* `npm run commit`
* `npm run release`
* ... etc.
# Beware
**Build yours using [script-helper](https://www.npmjs.com/package/script-helper).**
Instead of using this toolbox directly, consider creating yours using [script-helper](https://www.npmjs.com/package/script-helper).
This library is an example usage for [script-helper](https://www.npmjs.com/package/script-helper) and not meant for general use.
If it fits you, fork it, because it may change from version to version according to needs of author.
# Problem
There are lots of configuration and boilerplate to start and maintain a JavaScript project.
It is very tiresome to update libraries and configurations within multiple projects.
See ["Tools without config"](https://blog.kentcdodds.com/automation-without-config-412ab5e47229)
# Solution
This toolkit is provided as an npm module and every configuration for linting, testing,
building and more are initialized with a single command and updated simply updating a single npm package.
# Configuration
This toolkit exposes a bin called `moe-scripts`. All scripts are stored in
`lib/scripts` and all configurations are stored either in `lib/config` or in root of the library.
Toolkit decide whether a project is a TypeScript project or JavaScript project by looking `types`
entry in `package.json`.
`moe-scripts init` is automatically executed after package install and creates configuration files
and entries in `package.json` if they do not exist. See [init script below](#module_init).
All scripts can be further refined used arguments related to used tool within that script.
It is mostly avoided to provide extra besides original ones of the tool parameters if really not necessary.
## Overriding Configuration
Most of the configuration can be extended by native extend mechanism of the related
library. Those which cannot be extended such as `.gitignore` or can be extended but
behaves according to location of extended file such as `tsconfig.json` are used with
symbolic links pointing to a file in this toolkit.
All of the configuration can be overridden.
This can be a very helpful way to make editor integration work for tools like
ESLint which require project-based ESLint configuration to be present to work.
### ESLint
Create an `.eslintrc` with the contents of:
```
{"extends": "./node_modules/moe-scripts/eslint.js"}
```
> Note: for now, you'll have to include an `.eslintignore` in your project until
> [this eslint issue is resolved](https://github.com/eslint/eslint/issues/9227).
### TSLint
It is extendible via:
```json
{ "extends": "moe-scripts/tslint.json" }
```
Note: `tslint.json` is not a symbolic link in source root. There is no safe place to link it, because `lib` is not always available in source and `src` is not available in npm package.
### Babel
Or, for `babel`, a `.babelrc` with:
```
{"presets": ["moe-scripts/babel"]}
```
### Jest
```js
const {jest: jestConfig} = require('moe-scripts/config')
module.exports = Object.assign(jestConfig, {
// your overrides here
// for test written in Typescript, add:
transform: {
'\\.(ts|tsx)$': '/node_modules/ts-jest/preprocessor.js',
},
})
```
# Inspiration
This toolkit is based on and very heavily inspired by [kcd-scripts](https://github.com/kentcdodds/kcd-scripts).
I'm also grateful for his [Tools without config](https://blog.kentcdodds.com/automation-without-config-412ab5e47229)
article. I created this as a fork and a separate toolkit instead of contributing it, because he mentioned that, like me,
[kcd-scripts](https://github.com/kentcdodds/kcd-scripts) are a personal project and specific to his needs. (Like this
one is specific to my needs).
# API
{{>main~}}