UNPKG

3.66 kBMarkdownView Raw
1<p align="center" style="padding-top: 40px">
2 <img src="./docs/images/logo.svg?sanitize=true" width="60" alt="logo" />
3</p>
4
5<h1 align="center">Mili</h1>
6
7[![version](https://img.shields.io/npm/v/mili.svg?style=flat-square)](https://www.npmjs.com/package/mili)
8[![downloads](https://img.shields.io/npm/dm/mili.svg?style=flat-square)](https://www.npmjs.com/package/mili)
9[![dependencies](https://img.shields.io/david/Val-istar-Guo/mili.svg?style=flat-square)](https://www.npmjs.com/package/mili)
10[![coveralls](https://img.shields.io/coveralls/github/Val-istar-Guo/mili.svg?style=flat-square)](https://coveralls.io/github/Val-istar-Guo/mili)
11
12
13[简体中文](./docs/zh-cn/readme.md)
14
15
16**Projects that derived from the same scaffolding, have evolved over time and become different.**
17Scaffolding lost control of the subsequent development of the project.
18When we need to improve some of the basic functions of scaffolding(e.g. eslint rules), we need to modify each project, and even have to design a customized solution for some old projects.
19
20Therefore, in order to improve the control ability of scaffolding for the subsequent development of the project,template can modified some files and release new template version, then project can upgrade the template version.
21
22It is useful for team project management.
23
24## Usage
25
26The basic principle of mili.
27
28<p align="center">
29 <img src="./docs/images/handlers.svg?sanitize=true" width="80%" />
30</p>
31
321. First, you need to design your own template or use someone else's template.
332. Make project directory and run `npx mili init template_path`.
343. Run `npx mili upgrade`, when template is out of date.
354. `mili` run the handler of file that set by tempalte, when `init` or `upgrade` template
36
37### Init Project
38
39Let's use a existed template.
40
41```shell
42// template in github
43npx mili init github:Val-istar-Guo/mili-template.git
44// template in npm
45npx mili init npm:mili-template
46// template in private git repository
47npx mili init https://github.com/Val-istar-Guo/mili.git
48```
49
50### Upgrade
51
52The upgrade operation is very simple to use.The effect of the upgrade is determined by the handlers configured for each file in the template configuration.
53
54```shell
55npx run upgrade
56```
57
58The handler can extract the data of the project file, or use the template file as a [mustache](https://github.com/janl/mustache.js) template to render a new project file that will cover old one.
59
60The handlers can be flexibly and freely combined to implement a variety of initialization and upgrade modes.
61
62
63### Check Before Commit
64
65With [husky](https://www.npmjs.com/package/husky),
66it is easy to verify whether the project file meets the template before commit.
67Thereby ensuring the specification of the project code.
68
69Run in terminal:
70```shell
71npx mili check --diff --fold
72```
73
74Or configuration in husky:
75
76```yaml
77hooks:
78 pre-commit: 'npx mili check --diff --fold'
79```
80
81An example:
82
83![mili check](./docs/images/check.png)
84
85Run `npx mili upgrade` command will auto modify code according to the diff.
86
87
88## See More
89
90- [Command Line Interface](./docs/en/cli.md)
91- [Node Interface](./docs/en/node-interface.md)
92- [Template Development](./docs/en/template.md)
93- [Handler](./docs/en/handler/index.md)
94- Reference
95 + [mili-template](https://github.com/Val-istar-Guo/mili-template): An simple mili template. This can be used as a reference for first time template writing.
96
97
98## Contributing & Development
99
100If there is any doubt, it is very welcome to discuss the issue together.
101Please read [Contributor Covenant Code of Conduct](.github/CODE_OF_CONDUCT.md) and [CONTRIBUTING](.github/CONTRIBUTING.md).
102Let's keep a good community environment.