Skip to content

Commit

Permalink
docs: enrich README
Browse files Browse the repository at this point in the history
  • Loading branch information
alvis committed Aug 14, 2021
1 parent 2f119c1 commit 8509f41
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 48 deletions.
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ so you easily run tests and lint your code during development.
This repo is a monorepo. It contains the code for presetter and a simple preset.
Here's a quick guide to the content of the monorepo.

| Package | Description |
| ----------------------------------- | ------------------------------------------------------------------------------------------------ |
| [presetter](packages/presetter) | The core of presetter containing all the logic and the CLI utility |
| [presetter-preset](packages/preset) | the preset for building presetter, containing declaration of typescript and other building tools |
| Package | Description |
| ----------------------------------- | ----------------------------------------------------------------------------- |
| [presetter](packages/presetter) | The core of presetter containing all the logic and the CLI utility |
| [presetter-preset](packages/preset) | A battery-loaded preset for building presetter, containing typescript and more |

---

Expand Down
88 changes: 49 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ![Logo](logo.svg)
# ![Logo](assets/logo.svg)

<div align="center">

Expand All @@ -15,9 +15,11 @@ What's more, what if you want to update configs for all projects? :man_facepalmi

**Presetter is a utility for setting up building tools for your project from a template.** This means with just only two dev packages, namely this package and your favourite template preset, all essential development packages, such as typescript, eslint and jest, together with their configuration files provided by the preset, are automatically setup for you upon the project's initialisation.

![Before and After](assets/before-and-after.jpg)

## Quick Start

1. Bootstrap your project with a preset (e.g. presetter-preset)
1. Bootstrap your project with a preset (e.g. [preset](packages/preset))

```shell
npx presetter use <preset package name>
Expand All @@ -30,12 +32,11 @@ That's. One command and you're set.
At this point, all development packages specified in the preset are installed,
and now you can try to run some example life cycle scripts provided by the preset (e.g. try `npx run test`).

![Demo](demo.gif)
![Demo](assets/demo.gif)

## Concept

The concept comprises two part: [presetter](packages/presetter) (this package) and a [preset](packages/preset) (which can be provided by yourself).

The concept comprises two part: [presetter](packages/presetter) (this package) and a [preset](packages/preset).
### presetter

Presetter is a utility for two tasks:
Expand Down Expand Up @@ -158,42 +159,51 @@ To fix the issue, you can simply replace the temporary `package.json` by its ori
## About

This project originated from my personal pain on maintaining a number of projects with fairly similar structure, having exactly the same build and test procedures, same `.babelrc`, `tsconfig.json` etc.
Every time when I setup a new project, I have to copy and setup the following **32** development dependencies!!!
Every time when I setup a new project, I have to copy many **idential config files** such as `.babelrc`, `.eslintrc`, `.jestrc`, `.lintstagedrc`, `.npmignore`, `tsconfig.json` to name a few,
together with the following **40** 😱 development dependencies!!!

1. @babel/cli
2. @babel/core
3. @babel/plugin-proposal-class-properties
4. @babel/plugin-proposal-decorators
5. @babel/plugin-proposal-nullish-coalescing-operator
6. @babel/plugin-proposal-object-rest-spread
7. @babel/plugin-proposal-optional-chaining
8. @babel/preset-env
9. @babel/preset-typescript
10. @types/jest
11. @types/node
12. @typescript-eslint/eslint-plugin
13. @typescript-eslint/parser
14. eslint
15. eslint-config-prettier
16. eslint-plugin-eslint-comments
17. eslint-plugin-header
18. eslint-plugin-jsdoc
19. eslint-plugin-no-secrets
20. eslint-plugin-sonarjs
21. jest
22. leasot
23. npm-run-all
24. prettier
25. shx
26. standard-version
27. ts-jest
28. ts-node
29. ts-node-dev
30. tsconfig-paths
31. tscpaths
32. typescript

So, I imagine, if it is possible to reduce all these 3x packages into 1?
1. @babel/core
1. @babel/node
1. @babel/plugin-proposal-class-properties
1. @babel/plugin-proposal-decorators
1. @babel/plugin-proposal-nullish-coalescing-operator
1. @babel/plugin-proposal-object-rest-spread
1. @babel/plugin-proposal-optional-chaining
1. @babel/preset-env
1. @babel/preset-typescript
1. @types/jest
1. @types/node
1. @typescript-eslint/eslint-plugin
1. @typescript-eslint/parser
1. babel-plugin-transform-typescript-metadata
1. conventional-changelog-metahub
1. cross-env
1. eslint
1. eslint-config-prettier
1. eslint-plugin-eslint-comments
1. eslint-plugin-header
1. eslint-plugin-import
1. eslint-plugin-jsdoc
1. eslint-plugin-no-secrets
1. eslint-plugin-sonarjs
1. husky
1. jest
1. leasot
1. lint-staged
1. npm-run-all
1. presetter
1. prettier
1. shx
1. standard-version
1. ts-jest
1. ts-node
1. ts-node-dev
1. tsc-alias
1. tsconfig-paths
1. typescript

So, I imagine, if it is possible to reduce all these 40 packages into 1?
I tried to look for a solution but no luck.
Therefore, I make this tool and make it available to everyone who has a similar problem as me.

Expand Down
Binary file added assets/before-and-after.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
20 changes: 15 additions & 5 deletions packages/preset/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Logo](https://github.com/alvis/presetter/raw/master/logo.svg)

🏄🏻 _A collection of opinionated configurations for a nodejs project in typescript for presetter_
🏄🏻 _A collection of opinionated configurations for a NodeJS project in typescript for presetter_

•   [Quick Start](#quick-start)   •   [Project Structure](#project-structure)   •   [Customisation](#customisation)   •   [Scripts](#script-template-summary)   •

Expand All @@ -18,14 +18,24 @@

In addition to a set of opinionated configuration files, it also provides a number of essential lifecycle and helper commands.

## Features

- 👥 Babel
- 🚿 ESLint
- 🧪 Jest
- 🐶 Husky
- 💅 Prettier
- 📤 Standard Version
- 💯 Typescript

## Quick Start

[**FULL DOCUMENTATION IS AVAILABLE HERE**](https://github.com/alvis/presetter/blob/master/README.md)

1. Bootstrap your project with a preset (e.g. presetter-preset)
1. Bootstrap your project with presetter-preset

```shell
npx presetter use <preset package name>
npx presetter use presetter-preset
```

That's. One command and you're set.
Expand Down Expand Up @@ -68,7 +78,7 @@ Implement your business logic under `source` and prepare tests under `spec`.

## Customisation

By default, this preset exports a handy configuration set for a nodejs project.
By default, this preset exports a handy configuration set for a NodeJS project written in typescript.
But you can further customise (either extending or replacing) the configuration by specifying the change in the config file (`.presetterrc` or `.presetterrc.json`).

These settings are available in the `config` field in the config file. For directories, the setting is specified in the `directory` field, while configuration for other tools like babel and eslint are available in corresponding fields.
Expand All @@ -95,7 +105,7 @@ interface PresetterRC {
prettier?: Record<string, unknown>;
/** configuration to be merged with tsconfig.json */
tsconfig?: Record<string, unknown>;
/** a list of files not to be linked */
/** a list of config files not to be created */
ignores?: string[];
/** relative path to root directories for different file types */
directory?: {
Expand Down

0 comments on commit 8509f41

Please sign in to comment.