clwy-express-generator 4.16.1
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.
- package/LICENSE +23 -0
- package/README.md +115 -0
- package/bin/express-cli.js +595 -0
- package/package.json +68 -0
- package/templates/.env.ejs +12 -0
- package/templates/css/style.css +8 -0
- package/templates/css/style.less +8 -0
- package/templates/css/style.sass +6 -0
- package/templates/css/style.scss +10 -0
- package/templates/css/style.styl +5 -0
- package/templates/js/app.js.ejs +44 -0
- package/templates/js/config/routes.js +10 -0
- package/templates/js/gitignore +61 -0
- package/templates/js/index.html +13 -0
- package/templates/js/routes/index.js +11 -0
- package/templates/js/routes/users.js +9 -0
- package/templates/js/www.ejs +90 -0
- package/templates/middlewares/error-handler.js +17 -0
- package/templates/mjs/app.js.ejs +48 -0
- package/templates/mjs/config/routes.js +10 -0
- package/templates/mjs/routes/index.js +11 -0
- package/templates/mjs/routes/users.js +9 -0
- package/templates/mjs/www.ejs +92 -0
- package/templates/prisma/schema.prisma +14 -0
- package/templates/views/error.dust +12 -0
- package/templates/views/error.ejs +3 -0
- package/templates/views/error.hbs +3 -0
- package/templates/views/error.hjs +3 -0
- package/templates/views/error.jade +6 -0
- package/templates/views/error.pug +6 -0
- package/templates/views/error.twig +7 -0
- package/templates/views/error.vash +7 -0
- package/templates/views/index.dust +11 -0
- package/templates/views/index.ejs +11 -0
- package/templates/views/index.hbs +2 -0
- package/templates/views/index.hjs +11 -0
- package/templates/views/index.jade +5 -0
- package/templates/views/index.pug +5 -0
- package/templates/views/index.twig +6 -0
- package/templates/views/index.vash +6 -0
- package/templates/views/layout.hbs +10 -0
- package/templates/views/layout.jade +7 -0
- package/templates/views/layout.pug +7 -0
- package/templates/views/layout.twig +10 -0
- package/templates/views/layout.vash +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2009-2013 TJ Holowaychuk <tj@vision-media.ca>
|
|
4
|
+
Copyright (c) 2015-2018 Douglas Christopher Wilson <doug@somethingdoug.com>
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
a copy of this software and associated documentation files (the
|
|
8
|
+
'Software'), to deal in the Software without restriction, including
|
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be
|
|
15
|
+
included in all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
20
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
21
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
22
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
[](http://expressjs.com/)
|
|
2
|
+
|
|
3
|
+
[Express'](https://www.npmjs.com/package/express) application generator.
|
|
4
|
+
|
|
5
|
+
[![NPM Version][npm-image]][npm-url]
|
|
6
|
+
[![NPM Downloads][downloads-image]][downloads-url]
|
|
7
|
+
[![Linux Build][github-actions-ci-image]][github-actions-ci-url]
|
|
8
|
+
[![Windows Build][appveyor-image]][appveyor-url]
|
|
9
|
+
|
|
10
|
+
Forked from [express-generator](https://github.com/expressjs/generator), this project is a fork with some new features.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **🚀 Support for ES6 syntax**: The project now supports using ES6 syntax, making the code more modern and concise.
|
|
15
|
+
- **💾 Support for creating Prisma ORM project**: The project now supports integrating Prisma ORM, simplifying database operations.
|
|
16
|
+
- **🔀 Split routes**: The route files are now split into separate files, making them easier to manage and maintain.
|
|
17
|
+
- **📁 Added middleware folder**: A new middleware folder has been added to store various middleware, improving the modularity of the code.
|
|
18
|
+
- **🔧 Added environment variable configuration file**: The project now includes a configuration file for environment variables, making it easier to manage different environments.
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
The quickest way to get started with express is to utilize the executable `express(1)` to generate an application as shown below:
|
|
23
|
+
|
|
24
|
+
Create the app:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
$ npx clwy-express-generator --view=ejs --orm --es6 demo && cd demo
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Install dependencies:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
$ npm install
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Start your Express.js app at `http://localhost:3000/`:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
$ npm start
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Command Line Options
|
|
43
|
+
|
|
44
|
+
This generator can also be further configured with the following command line flags.
|
|
45
|
+
|
|
46
|
+
--version output the version number
|
|
47
|
+
-v, --view <engine> add view <engine> support (dust|ejs|hbs|hjs|jade|pug|twig|vash|api) (defaults to ejs)
|
|
48
|
+
--no-view use static html instead of view engine
|
|
49
|
+
-c, --css <engine> add stylesheet <engine> support (less|stylus|compass|sass) (defaults to plain css)
|
|
50
|
+
--git add .gitignore
|
|
51
|
+
--es6 generate ES6 code and module-type project (requires Node 14.x or higher)
|
|
52
|
+
-o, --orm use the Prisma ORM
|
|
53
|
+
-f, --force force on non-empty directory
|
|
54
|
+
-h, --help output usage information
|
|
55
|
+
|
|
56
|
+
------------
|
|
57
|
+
|
|
58
|
+
Forked from [express-generator](https://github.com/expressjs/generator),此项目是从这个项目派生而来,并添加了一些新特性。
|
|
59
|
+
|
|
60
|
+
## 功能特性
|
|
61
|
+
|
|
62
|
+
- **🚀 支持ES6语法**:项目现在支持使用ES6语法,使代码更加现代化和简洁。
|
|
63
|
+
- **💾 支持创建 Prisma ORM 项目**:项目现在支持集成 Prisma ORM,简化了数据库操作。
|
|
64
|
+
- **🔀 分割路由**:路由文件现在被拆分到单独的文件中,使它们更易于管理和维护。
|
|
65
|
+
- **📁 新增中间件文件夹**:添加了一个新的中间件文件夹来存放各种中间件,提高了代码的模块化。
|
|
66
|
+
- **🔧 添加环境变量配置文件**:项目现在包含一个环境变量的配置文件,使管理不同环境变得更加容易。
|
|
67
|
+
|
|
68
|
+
## 快速开始
|
|
69
|
+
|
|
70
|
+
使用express最快的方式是利用可执行文件`express(1)`来生成一个应用,如下所示:
|
|
71
|
+
|
|
72
|
+
创建应用:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
$ npx clwy-express-generator --view=ejs --orm --es6 demo && cd demo
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
安装依赖:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
$ npm install
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
在 `http://localhost:3000/` 启动您的 Express.js 应用:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
$ npm start
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 命令行选项
|
|
91
|
+
|
|
92
|
+
此生成器还可以通过以下命令行标志进行进一步配置。
|
|
93
|
+
|
|
94
|
+
--version 输出版本号
|
|
95
|
+
-v, --view <engine> 添加视图引擎 <engine> 支持 (dust|ejs|hbs|hjs|jade|pug|twig|vash|api)(默认为 ejs)
|
|
96
|
+
--no-view 使用静态html而不是视图引擎
|
|
97
|
+
-c, --css <engine> 添加样式表引擎 <engine> 支持 (less|stylus|compass|sass)(默认为纯 css)
|
|
98
|
+
--git 添加 .gitignore 文件
|
|
99
|
+
--es6 生成 ES6 代码和模块类型项目(需要Node 14.x或更高版本)
|
|
100
|
+
-o, --orm 使用 Prisma ORM
|
|
101
|
+
-f, --force 强制在非空目录上操作
|
|
102
|
+
-h, --help 输出使用信息
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
[MIT](LICENSE)
|
|
107
|
+
|
|
108
|
+
[npm-image]: https://img.shields.io/npm/v/express-generator.svg
|
|
109
|
+
[npm-url]: https://npmjs.org/package/express-generator
|
|
110
|
+
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/generator/master.svg?label=windows
|
|
111
|
+
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/generator
|
|
112
|
+
[downloads-image]: https://img.shields.io/npm/dm/express-generator.svg
|
|
113
|
+
[downloads-url]: https://npmjs.org/package/express-generator
|
|
114
|
+
[github-actions-ci-image]: https://img.shields.io/github/workflow/status/expressjs/generator/ci/master?label=linux
|
|
115
|
+
[github-actions-ci-url]: https://github.com/expressjs/generator/actions/workflows/ci.yml
|