Skip to content

Commit

Permalink
docs: change egg-init to npm init egg
Browse files Browse the repository at this point in the history
  • Loading branch information
atian25 committed Apr 3, 2019
1 parent b174646 commit 0a3acdb
Show file tree
Hide file tree
Showing 26 changed files with 61 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ A clear and concise description of what the bug is.

## Mini Showcase Repository(REQUIRED)
> Provide a mini GitHub repository which can reproduce the issue.
> Use `egg-init --type=simple bug` then upload to your GitHub
> Use `npm init egg --type=simple bug` then upload to your GitHub
<!-- https://github.com/YOUR_REPOSITORY_URL -->

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ assignees: ''
<!-- 清晰的描述下遇到的问题。-->

## 最小可复现仓库
> 请使用 `egg-init --type=simple bug` 创建,并上传到你的 GitHub 仓库
> 请使用 `npm init egg --type=simple bug` 创建,并上传到你的 GitHub 仓库
<!-- https://github.com/YOUR_REPOSITORY_URL -->

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Feel free to add more content in the body, if you think subject is not self-expl

- **If the commit is a Breaking Change, please note it clearly in this part.**
- related issues, like `Closes #1, Closes #2, #3`
- If there is a change about an old feaure or a new feature, please associate `doc` and `egg-init`, like `eggjs/egg-bin#123`
- If there is a change about an old feaure or a new feature, please associate `doc` and `egg-core`, like `eggjs/egg-core#123`

e.g.

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ $ git push origin branch-name

- **当有非兼容修改(Breaking Change)时必须在这里描述清楚**
- 关联相关 issue,如 `Closes #1, Closes #2, #3`
- 如果功能点有新增或修改的,还需要关联文档 `doc``egg-init` 的 PR,如 `eggjs/egg-bin#123`
- 如果功能点有新增或修改的,还需要关联文档 `doc``egg-core` 的 PR,如 `eggjs/egg-core#123`

示例

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ Node.js >= 8.0.0 required.
Follow the commands listed below.

```bash
$ npm install egg-init -g
$ egg-init --type simple showcase && cd showcase
$ mkdir showcase && cd showcase
$ npm init egg --type=simple
$ npm install
$ npm run dev
$ open http://localhost:7001
Expand Down
4 changes: 2 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ $ npm install egg --save
## 快速开始

```bash
$ npm install egg-init -g
$ egg-init --type simple showcase && cd showcase
$ mkdir showcase && cd showcase
$ npm init egg --type=simple
$ npm install
$ npm run dev
$ open http://localhost:7001
Expand Down
6 changes: 3 additions & 3 deletions docs/source/en/advanced/framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ We could regard EggCore as the advanced version of Koa Application, which integr

## How to Customize a Framework

To setup by [egg-init](https://github.com/eggjs/egg-init) with the [framework](https://github.com/eggjs/egg-boilerplate-framework) option is a good way, in which generates a scaffold for you.
Just use [egg-boilerplate-framework](https://github.com/eggjs/egg-boilerplate-framework) to generates a scaffold for you.

```bash
$ egg-init --type=framework yadan
$ cd yadan
$ mkdir yadan && cd yadan
$ npm init egg --type=framework
$ npm i
$ npm test
```
Expand Down
7 changes: 3 additions & 4 deletions docs/source/en/advanced/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ As we've already explained some these points in chapter [using plugins](../basic

### Quick Start with Scaffold

You can choose [plugin][egg-boilerplate-plugin] scaffold in [egg-init] for quick start.
Just use [egg-boilerplate-plugin] to generates a scaffold for you.

```bash
$ egg-init --type=plugin egg-hello
$ cd egg-hello
$ mkdir egg-hello && cd egg-hello
$ npm init egg --type=plugin
$ npm i
$ npm test
```
Expand Down Expand Up @@ -478,7 +478,6 @@ What's more, Egg can use this feature to make an adapter, for example, the plugi
**Giving the same plugin name and the same API to the same plugin can make quick switch between them**. This is really really useful in template and database.
[egg-init]: https://github.com/eggjs/egg-init
[egg-boilerplate-plugin]: https://github.com/eggjs/egg-boilerplate-plugin
[egg-mysql]: https://github.com/eggjs/egg-mysql
[egg-oss]: https://github.com/eggjs/egg-oss
2 changes: 1 addition & 1 deletion docs/source/en/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Thank you for reporting an issue.
1. It's RECOMMENDED to submit PR for typo or tiny bug fix.
2. If this's a FEATURE request, please provide: details, pseudo codes if necessary.
3. If this's a BUG, please provide: course repetition, error log and configuration. Fill in as much of the template below as you're able.
4. **It will be nice to use `egg-init --type=simple bug` to provide a mini GitHub repository which can reproduce the issue.**
4. **It will be nice to use `npm init egg --type=simple bug` to provide a mini GitHub repository which can reproduce the issue.**

Most importantly, please understand one thing: the relationship between the `user` and `the maintainer of open source project` is not `Buyer` and `Seller`, the issue is not a customer order either.
When you're opening an issue, please hold a mentality of "working together to solve this problem." Do not expect us to serve you unilaterally.
Expand Down
8 changes: 3 additions & 5 deletions docs/source/en/intro/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ To begin with, let's quickly initialize the project by using a scaffold,
which will quickly generate some of the major pieces of the application.

```bash
$ npm i egg-init -g
$ egg-init egg-example --type=simple
$ cd egg-example
$ mkdir egg-example && cd egg-example
$ npm init egg --type=simple
$ npm i
```

Expand All @@ -30,7 +29,7 @@ $ open localhost:7001

## Step by Step

Usually you can just use [egg-init] of the previous section,
Usually you can just use `npm init egg` of the previous section,
choose a scaffold that best fits your business model and quickly generate a project,
then get started with the development.

Expand Down Expand Up @@ -481,7 +480,6 @@ Where to go from here? read our documentation to better understand the framework
- Egg framework enables developers to write painless unit testing with many plugins and community-powered toolings. The team should give it a try by using Egg unit testing without worrying about setting up the testing tooling but writing the testing logics. See [Unit Testing](../core/unittest.md).

[Node.js]: http://nodejs.org
[egg-init]: https://github.com/eggjs/egg-init
[egg-bin]: https://github.com/eggjs/egg-bin
[egg-static]: https://github.com/eggjs/egg-static
[egg-development]: https://github.com/eggjs/egg-development
Expand Down
2 changes: 1 addition & 1 deletion docs/source/en/style-guide.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: Code Style Guide
---

Developers are advised to use `egg-init --type=simple showcase` to generate and observe the recommended project structure and configuration.
Developers are advised to use `npm init egg --type=simple showcase` to generate and observe the recommended project structure and configuration.

## Classify

Expand Down
6 changes: 3 additions & 3 deletions docs/source/en/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ title: Tutorials
You can use boilerplate type like this:

```bash
$ egg-init --type=simple
$ npm init egg --type=simple
```
### Options

boilerplate type | Description
:----: | ----:
simple | Simple egg app boilerplate
empty | Empty egg app boilerplate
simple | Simple egg app boilerplate
empty | Empty egg app boilerplate
plugin | egg plugin boilerplate
framework | egg framework boilerplate

Expand Down
2 changes: 1 addition & 1 deletion docs/source/en/tutorials/passport.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ In the previous section, we learned how to use a Passport middleware in the fram
**initialization:**

```bash
$ egg-init --type=plugin egg-passport-local
$ npm init egg --type=plugin egg-passport-local
```

**Configure dependencies in `package.json`:**
Expand Down
6 changes: 3 additions & 3 deletions docs/source/en/tutorials/restful.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ After interface convention, we begin to create a RESTful API.

### Application Initialization

Initializes the application using [egg-init](https://github.com/eggjs/egg-init) in the [quickstart](../intro/quickstart.md)
Initializes the application using `npm` in the [quickstart](../intro/quickstart.md)

```bash
$ egg-init cnode-api --type=simple
$ cd cnode-api
$ mkdir cnode-api && cd cnode-api
$ npm init egg --type=simple
$ npm i
```

Expand Down
10 changes: 5 additions & 5 deletions docs/source/en/tutorials/sequelize.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ brew service start mysql

## Initialization

Init project by `egg-init`:
Init project by `npm`:

```bash
egg-init --type=simple --dir=sequelize-project
cd sequelize-project
npm i
$ mkdir sequelize-project && cd sequelize-project
$ npm init egg --type=simple
$ npm i
```

Install and configure the [egg-sequelize] plugin (which will help us load the defined Model object onto `app` and `ctx` ) and the [mysql2] module:
Expand Down Expand Up @@ -405,7 +405,7 @@ A more complete example can be found in [eggjs/examples/sequelize].

## Boilerplate

We also provide sequelize boilerplate that integrates the modules [egg-sequelize], [sequelize-cli] and [factory-girl] provided in this documentation. You can quickly initialize a new application based on it by `egg-init --type=sequelize`.
We also provide sequelize boilerplate that integrates the modules [egg-sequelize], [sequelize-cli] and [factory-girl] provided in this documentation. You can quickly initialize a new application based on it by `npm init egg --type=sequelize`.

[mysql2]: https://github.com/sidorares/node-mysql2
[sequelize]: http://docs.sequelizejs.com/
Expand Down
9 changes: 5 additions & 4 deletions docs/source/en/tutorials/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ For more about this tossing process, please see [[RFC] TypeScript tool support](
A quick initialization through the boilerplate:

```bash
$ npx egg-init --type=ts showcase
$ cd showcase && npm i
$ mkdir showcase && cd showcase
$ npm init egg --type=ts
$ npm i
$ npm run dev
```

Expand Down Expand Up @@ -415,7 +416,7 @@ What we do is just to do some configs in `package.json`:
}
```

In the latest version of `egg-bin`, we can also support simplify configs of scripts through `egg.require`:
In the latest version of `egg-bin`, we can also support simplify configs of scripts through `egg.require`:

```json
{
Expand Down Expand Up @@ -659,7 +660,7 @@ Here're some questions asked by many people with answers one by one:

`egg-scripts` is the cli for PROD, and we suggest you compiling all the ts to js before running because of robustness and capbility. That's the reason why we don't suggest you using `ts-node` to run the application in PROD.

On the contrary, `ts-node` can reduce the cost of management for compiled files from `tsc`in DEV, and the performance loss can almost be ignored, so `ts-node` is integrated into `egg-bin`.
On the contrary, `ts-node` can reduce the cost of management for compiled files from `tsc`in DEV, and the performance loss can almost be ignored, so `ts-node` is integrated into `egg-bin`.

**In summary: Please use `tsc`to compile all ts files into js through `npm run tsc`, and then run `npm start`.**

Expand Down
6 changes: 3 additions & 3 deletions docs/source/zh-cn/advanced/framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ EggCore 可以看做 Koa Application 的升级版,默认内置 [Loader](./load

## 如何定制一个框架

你可以直接通过 [egg-init] 选择 [framework](https://github.com/eggjs/egg-boilerplate-framework) 脚手架来快速上手。
你可以直接通过 [egg-boilerplate-framework](https://github.com/eggjs/egg-boilerplate-framework) 脚手架来快速上手。

```bash
$ egg-init --type=framework yadan
$ cd yadan
$ mkdir yadan && cd yadan
$ npm init egg --type=framework
$ npm i
$ npm test
```
Expand Down
7 changes: 3 additions & 4 deletions docs/source/zh-cn/advanced/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ title: 插件开发

### 使用脚手架快速开发

你可以直接通过 [egg-init] 选择 [plugin][egg-boilerplate-plugin] 脚手架来快速上手。
你可以直接使用 [egg-boilerplate-plugin] 脚手架来快速上手。

```bash
$ egg-init --type=plugin egg-hello
$ cd egg-hello
$ mkdir egg-hello && cd egg-hello
$ npm init egg --type=plugin
$ npm i
$ npm test
```
Expand Down Expand Up @@ -478,7 +478,6 @@ Egg 是通过 `eggPlugin.name` 来定义插件名的,只在应用或框架具

**将相同功能的插件赋予相同的插件名,具备相同的 API,可以快速切换**。这在模板、数据库等领域非常适用。

[egg-init]: https://github.com/eggjs/egg-init
[egg-boilerplate-plugin]: https://github.com/eggjs/egg-boilerplate-plugin
[egg-mysql]: https://github.com/eggjs/egg-mysql
[egg-oss]: https://github.com/eggjs/egg-oss
2 changes: 1 addition & 1 deletion docs/source/zh-cn/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ title: 常见问题
1. 我们推荐如果是小问题(错别字修改,小的 bug fix)直接提交 PR。
2. 如果是一个新需求,请提供:详细需求描述,最好是有伪代码示意。
3. 如果是一个 BUG,请提供:复现步骤,错误日志以及相关配置,并尽量填写下面的模板中的条目。
4. **如果可以,尽可能使用 `egg-init --type=simple bug` 提供一个最小可复现的代码仓库,方便我们排查问题。**
4. **如果可以,尽可能使用 `npm init egg --type=simple bug` 提供一个最小可复现的代码仓库,方便我们排查问题。**
5. 不要挤牙膏似的交流,扩展阅读:[如何向开源项目提交无法解答的问题](https://zhuanlan.zhihu.com/p/25795393)

最重要的是,请明白一件事:开源项目的用户和维护者之间并不是甲方和乙方的关系,issue 也不是客服工单。在开 issue 的时候,请抱着一种『一起合作来解决这个问题』的心态,不要期待我们单方面地为你服务。
Expand Down
8 changes: 3 additions & 5 deletions docs/source/zh-cn/intro/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ title: 快速入门
我们推荐直接使用脚手架,只需几条简单指令,即可快速生成项目:

```bash
$ npm i egg-init -g
$ egg-init egg-example --type=simple
$ cd egg-example
$ mkdir egg-example && cd egg-example
$ npm init egg --type=simple
$ npm i
```

Expand All @@ -28,7 +27,7 @@ $ open localhost:7001

## 逐步搭建

通常你可以通过上一节的方式,使用 [egg-init] 快速选择适合对应业务模型的脚手架,快速启动 Egg.js 项目的开发。
通常你可以通过上一节的方式,使用 `npm init egg` 快速选择适合对应业务模型的脚手架,快速启动 Egg.js 项目的开发。

但为了让大家更好的了解 Egg.js,接下来,我们将跳过脚手架,手动一步步的搭建出一个 [Hacker News](https://github.com/eggjs/examples/tree/master/hackernews)

Expand Down Expand Up @@ -453,7 +452,6 @@ $ npm test
- 写单元测试其实很简单的事,Egg 也提供了非常多的配套辅助,我们强烈建议大家测试驱动开发,具体参见 [单元测试](../core/unittest.md)

[Node.js]: http://nodejs.org
[egg-init]: https://github.com/eggjs/egg-init
[egg-bin]: https://github.com/eggjs/egg-bin
[egg-static]: https://github.com/eggjs/egg-static
[egg-development]: https://github.com/eggjs/egg-development
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/style-guide.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: 代码风格指南
---

建议开发者使用 `egg-init --type=simple showcase` 来生成并观察推荐的项目结构和配置。
建议开发者使用 `npm init egg --type=simple showcase` 来生成并观察推荐的项目结构和配置。

## 用类的形式呈现(Classify)

Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/tutorials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: 教程
你可以使用骨架类型,像下面这样:

```bash
$ egg-init --type=simple
$ npm init egg --type=simple
```

### 选项
Expand Down
2 changes: 1 addition & 1 deletion docs/source/zh-cn/tutorials/passport.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ module.exports = app => {
**初始化:**

```bash
$ egg-init --type=plugin egg-passport-local
$ npm init egg --type=plugin egg-passport-local
```

`package.json`**配置依赖:**
Expand Down
6 changes: 3 additions & 3 deletions docs/source/zh-cn/tutorials/restful.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ CNode 社区现在 v1 版本的接口不是完全符合 RESTful 语义,在这

### 初始化项目

还是通过[快速入门](../intro/quickstart.md)章节介绍的 [egg-init](https://github.com/eggjs/egg-init) 工具来初始化我们的应用
还是通过[快速入门](../intro/quickstart.md)章节介绍的 `npm` 来初始化我们的应用

```bash
$ egg-init cnode-api --type=simple
$ cd cnode-api
$ mkdir cnode-api && cd cnode-api
$ npm init egg --type=simple
$ npm i
```

Expand Down
10 changes: 5 additions & 5 deletions docs/source/zh-cn/tutorials/sequelize.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ brew service start mysql

## 初始化项目

通过 egg-init 初始化一个项目:
通过 `npm` 初始化一个项目:

```bash
egg-init --type=simple --dir=sequelize-project
cd sequelize-project
npm i
$ mkdir sequelize-project && cd sequelize-project
$ npm init egg --type=simple
$ npm i
```

安装并配置 [egg-sequelize] 插件(它会辅助我们将定义好的 Model 对象加载到 app 和 ctx 上)和 [mysql2] 模块:
Expand Down Expand Up @@ -404,7 +404,7 @@ describe('test/app/service/users.test.js', () => {

## 脚手架

我们也提供了 sequelize 的脚手架,集成了文档中提供的 [egg-sequelize], [sequelize-cli][factory-girl] 等模块。可以通过 `egg-init --type=sequelize` 来基于它快速初始化一个新的应用。
我们也提供了 sequelize 的脚手架,集成了文档中提供的 [egg-sequelize], [sequelize-cli][factory-girl] 等模块。可以通过 `npm init egg --type=sequelize` 来基于它快速初始化一个新的应用。

[mysql2]: https://github.com/sidorares/node-mysql2
[sequelize]: http://docs.sequelizejs.com/
Expand Down
Loading

0 comments on commit 0a3acdb

Please sign in to comment.