clwy-express-generator 5.2.1 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +38 -31
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,13 +4,11 @@
4
4
 
5
5
  **此项目基于 [express-generator](https://github.com/expressjs/generator) 分叉而来,并新增了一些功能特性。**
6
6
 
7
- **其中,ES6 支持的实现参考了 [Dr. Jeff Jackson](https://github.com/drjeffjackson) 提交的 [Pull Request](https://github.com/expressjs/generator/pull/316),并在其基础上进行了进一步优化和调整。**
8
-
9
7
  ## 功能特性
10
8
 
11
9
  - **🚀 ES6 支持**:代码更现代简洁。
12
10
  - **🔀 路由拆分**:独立文件,便于管理维护。
13
- - **🗄️ ORM 支持**:支持 PrismaSequelize ORM。
11
+ - **🗄️ ORM 支持**:支持 SequelizePrisma ORM。
14
12
  - **📁 中间件模块化**:新增文件夹存放中间件。
15
13
  - **🔧 增加环境变量配置**:多环境管理更便捷。
16
14
  - **🔄 集成 nodemon**:开发时自动重启服务。
@@ -28,6 +26,7 @@
28
26
 
29
27
  ```bash
30
28
  $ npx clwy-express-generator --view=ejs --es6 es6-demo
29
+ # 或:npx clwy-express-generator -v=ejs --es6 es6-demo
31
30
  $ cd es6-demo
32
31
  ```
33
32
 
@@ -53,39 +52,43 @@ $ npm start
53
52
  $ docker-compose up -d
54
53
  ```
55
54
 
56
- 默认将启动 MySQL 数据库,PostgreSQL 和 Redis 配置已在 `docker-compose.yml` 中,请根据需求调整。
55
+ 默认将启动 MySQL 数据库,PostgreSQL 和 Redis 配置已在 `docker-compose.yml` 中,请根据需求取消注释。
57
56
 
58
- ### 使用 Prisma
57
+ ### 使用 Sequelize
59
58
 
60
59
  创建应用:
61
60
 
62
61
  ```bash
63
- $ npx clwy-express-generator --view=ejs --orm=prisma --es6 es6-prisma-demo
64
- $ cd es6-prisma-demo
62
+ $ npx clwy-express-generator --view=ejs --orm=sequelize --es6 es6-sequelize-demo
63
+ # 或:npx clwy-express-generator -v=ejs -o=sequelize --es6 es6-sequelize-demo
64
+
65
+ $ cd es6-sequelize-demo
65
66
  $ npm i
66
67
  ```
67
68
 
68
- 初始化数据库客户端:
69
+ 根据需求安装数据库引擎:
69
70
 
70
71
  ```bash
71
- $ npx prisma generate
72
+ $ npm install --save mysql2 # MySQL
73
+ $ npm install --save pg pg-hstore # Postgres
72
74
  ```
73
75
 
74
- ### 使用 Sequelize
76
+ ### 使用 Prisma
75
77
 
76
78
  创建应用:
77
79
 
78
80
  ```bash
79
- $ npx clwy-express-generator --view=ejs --orm=sequelize --es6 es6-sequelize-demo
80
- $ cd es6-sequelize-demo
81
+ $ npx clwy-express-generator --view=ejs --orm=prisma --es6 es6-prisma-demo
82
+ # 或:npx clwy-express-generator -v=ejs -o=prisma --es6 es6-prisma-demo
83
+
84
+ $ cd es6-prisma-demo
81
85
  $ npm i
82
86
  ```
83
87
 
84
- 根据需求安装数据库引擎:
88
+ 初始化数据库客户端:
85
89
 
86
90
  ```bash
87
- $ npm install --save mysql2 # MySQL
88
- $ npm install --save pg pg-hstore # Postgres
91
+ $ npx prisma generate
89
92
  ```
90
93
 
91
94
  ## 命令行选项
@@ -95,7 +98,7 @@ $ npm install --save pg pg-hstore # Postgres
95
98
  --version 输出版本号
96
99
  -v, --view <engine> 添加视图引擎 <engine> 支持 (dust|ejs|hbs|hjs|pug|twig|vash|api)(默认为 ejs)
97
100
  --no-view 使用静态html而不是视图引擎
98
- -o, --orm <orm> 添加 ORM <orm> 支持 (prisma|sequelize)
101
+ -o, --orm <orm> 添加 ORM <orm> 支持 (sequelize|prisma)
99
102
  -c, --css <engine> 添加样式表引擎 <engine> 支持 (less|stylus|compass|sass)(默认为纯 css)
100
103
  --git 添加 .gitignore 文件
101
104
  --es6 生成 ES6 代码和模块类型项目(需要Node 22.x或更高版本)
@@ -108,8 +111,6 @@ $ npm install --save pg pg-hstore # Postgres
108
111
 
109
112
  **This project is forked from [express-generator](https://github.com/expressjs/generator) with additional features.**
110
113
 
111
- **ES6 support is implemented based on the [Pull Request](https://github.com/expressjs/generator/pull/316) submitted by [Dr. Jeff Jackson](https://github.com/drjeffjackson), with further optimizations and adjustments.**
112
-
113
114
  ## Features
114
115
 
115
116
  - **🚀 ES6 Support**: More modern and concise code.
@@ -132,6 +133,7 @@ Create the application:
132
133
 
133
134
  ```bash
134
135
  $ npx clwy-express-generator --view=ejs --es6 es6-demo
136
+ # or: npx clwy-express-generator -v=ejs --es6 es6-demo
135
137
  $ cd es6-demo
136
138
  ```
137
139
 
@@ -157,39 +159,44 @@ After installing and starting Docker:
157
159
  $ docker-compose up -d
158
160
  ```
159
161
 
160
- This will start a MySQL database by default. PostgreSQL and Redis configurations are already in `docker-compose.yml`; adjust them according to your needs.
162
+ By default, the MySQL database will be started. PostgreSQL and Redis configurations are already included in
163
+ docker-compose.yml; please uncomment them as needed.
161
164
 
162
- ### Using Prisma
165
+ ### Using Sequelize
163
166
 
164
167
  Create the application:
165
168
 
166
169
  ```bash
167
- $ npx clwy-express-generator --view=ejs --orm=prisma --es6 es6-prisma-demo
168
- $ cd es6-prisma-demo
170
+ $ npx clwy-express-generator --view=ejs --orm=sequelize --es6 es6-sequelize-demo
171
+ # or: npx clwy-express-generator -v=ejs -o=sequelize --es6 es6-sequelize-demo
172
+
173
+ $ cd es6-sequelize-demo
169
174
  $ npm i
170
175
  ```
171
176
 
172
- Initialize the database client:
177
+ Install the database engine as needed:
173
178
 
174
179
  ```bash
175
- $ npx prisma generate
180
+ $ npm install --save mysql2 # MySQL
181
+ $ npm install --save pg pg-hstore # Postgres
176
182
  ```
177
183
 
178
- ### Using Sequelize
184
+ ### Using Prisma
179
185
 
180
186
  Create the application:
181
187
 
182
188
  ```bash
183
- $ npx clwy-express-generator --view=ejs --orm=sequelize --es6 es6-sequelize-demo
184
- $ cd es6-sequelize-demo
189
+ $ npx clwy-express-generator --view=ejs --orm=prisma --es6 es6-prisma-demo
190
+ # or: npx clwy-express-generator -v=ejs -o=prisma --es6 es6-prisma-demo
191
+
192
+ $ cd es6-prisma-demo
185
193
  $ npm i
186
194
  ```
187
195
 
188
- Install the database engine as needed:
196
+ Initialize the database client:
189
197
 
190
198
  ```bash
191
- $ npm install --save mysql2 # MySQL
192
- $ npm install --save pg pg-hstore # Postgres
199
+ $ npx prisma generate
193
200
  ```
194
201
 
195
202
  ## Command Line Options
@@ -199,7 +206,7 @@ This generator can be further configured with the following command line flags.
199
206
  --version Output the version number
200
207
  -v, --view <engine> Add view engine <engine> support (dust|ejs|hbs|hjs|pug|twig|vash|api) (defaults to ejs)
201
208
  --no-view Use static HTML instead of a view engine
202
- -o, --orm <orm> Add ORM <orm> support (prisma|sequelize)
209
+ -o, --orm <orm> Add ORM <orm> support (sequelize|prisma)
203
210
  -c, --css <engine> Add stylesheet engine <engine> support (less|stylus|compass|sass) (defaults to plain css)
204
211
  --git Add .gitignore file
205
212
  --es6 Generate ES6 code and module type project (requires Node 22.x or higher)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "clwy-express-generator",
3
3
  "description": "Express' application generator",
4
4
  "homepage": "https://github.com/clwy-cn/clwy-express-generator",
5
- "version": "5.2.1",
5
+ "version": "5.2.2",
6
6
  "author": "TJ Holowaychuk <tj@vision-media.ca>",
7
7
  "contributors": [
8
8
  "Aaron Heckmann <aaron.heckmann+github@gmail.com>",