Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/eggjs/egg-init

Init egg app helper tools
https://github.com/eggjs/egg-init

boilerplate egg egg-boilerplate

Last synced: about 1 month ago
JSON representation

Init egg app helper tools

Awesome Lists containing this project

README

        

# egg-init

[![NPM version][npm-image]][npm-url]
[![Node.js CI](https://github.com/eggjs/egg-init/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-init/actions/workflows/nodejs.yml)
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]

[npm-image]: https://img.shields.io/npm/v/egg-init.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-init
[codecov-image]: https://codecov.io/gh/eggjs/egg-init/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/eggjs/egg-init
[download-image]: https://img.shields.io/npm/dm/egg-init.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-init

Init egg app helper tools.

## Install

```bash
npm i egg-init -g
egg-init -h
```

## Create a `simple` type application

```bash
egg-init --type simple [dest]
```

## Or select a boilerplate by yourself

```bash
$ egg-init dest
? Please select a boilerplate type (Use arrow keys)
❯ simple - Simple egg app
plugin - egg plugin
```

## Command

```bash
Usage: egg-init [dir] --type=simple

Options:
--type boilerplate type [string]
--dir target directory [string]
--force, -f force to override directory [boolean]
--template local path to boilerplate [string]
--package boilerplate package name [string]
--registry, -r npm registry, support china/npm/custom, default to auto detect [string]
--silent don't ask, just use default value [boolean]
--version Show version number [boolean]
-h, --help Show help [boolean]
```

## Custom a boilerplate

We use npm package to manager boilerplate, you can follow this steps:

- Create a new repo like [egg-boilerplate-plugin](https://github.com/eggjs/egg-boilerplate-plugin)
- Put all files under `boilerplate` dir
- Use `egg-init --template=PATH` to check
- `index.js` can define variables which can be useed on template, like `{{name}}`, but `\{{name}}` will ignore.

```js
module.exports = {
name: {
desc: 'package-name',
},
pluginName: {
desc: 'plugin-name',
default(vars) {
return vars.name;
},
filter(v) {
return 'egg-' + v;
},
},
description: {
desc: 'my best plugin',
},
author: {
desc: 'author',
default: 'eggjs team'
},
};
```

- Write unit test, see `npm scripts` at [egg-boilerplate-simple](https://github.com/eggjs/egg-boilerplate-simple/blob/master/package.json#L5)
- Add your package name to [egg-init-config](https://github.com/eggjs/egg-init-config)'s package.json `config.boilerplate` property
- Publish your package to npm

## License

[MIT](LICENSE)

## Contributors

|[
atian25](https://github.com/atian25)
|[
fengmk2](https://github.com/fengmk2)
|[
thonatos](https://github.com/thonatos)
|[
dead-horse](https://github.com/dead-horse)
|[
popomore](https://github.com/popomore)
|[
killagu](https://github.com/killagu)
|
| :---: | :---: | :---: | :---: | :---: | :---: |
|[
whxaxes](https://github.com/whxaxes)
|[
jtyjty99999](https://github.com/jtyjty99999)
|[
edokeh](https://github.com/edokeh)
|[
DanielWLam](https://github.com/DanielWLam)
|[
Janlaywss](https://github.com/Janlaywss)
|[
Runrioter](https://github.com/Runrioter)
|
[
snyk-bot](https://github.com/snyk-bot)
|[
WinjayYu](https://github.com/WinjayYu)
|[
ShirasawaSama](https://github.com/ShirasawaSama)
|[
supperchong](https://github.com/supperchong)
|[
hyj1991](https://github.com/hyj1991)

This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sat Nov 25 2023 23:06:04 GMT+0800`.