clwy-express-generator 5.0.10 → 5.0.12
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/bin/express-cli.js +5 -5
- package/package.json +1 -1
- package/templates/js/app.js.ejs +1 -7
- package/templates/mjs/app.js.ejs +3 -11
package/bin/express-cli.js
CHANGED
|
@@ -25,10 +25,9 @@ const args = parseArgs(process.argv.slice(2), {
|
|
|
25
25
|
f: 'force',
|
|
26
26
|
h: 'help',
|
|
27
27
|
H: 'hogan',
|
|
28
|
-
v: 'view'
|
|
29
|
-
o: 'orm'
|
|
28
|
+
v: 'view'
|
|
30
29
|
},
|
|
31
|
-
boolean: ['ejs', 'es6', 'force', 'git', 'hbs', 'help', 'hogan', 'pug', 'version'
|
|
30
|
+
boolean: ['ejs', 'es6', 'force', 'git', 'hbs', 'help', 'hogan', 'pug', 'version'],
|
|
32
31
|
default: { css: true, view: true },
|
|
33
32
|
string: ['css', 'view'],
|
|
34
33
|
unknown: function (s) {
|
|
@@ -141,8 +140,9 @@ function createApplication (name, dir, options, done) {
|
|
|
141
140
|
app.locals.uses.push('cookieParser()')
|
|
142
141
|
pkg.dependencies['cookie-parser'] = '~1.4.7'
|
|
143
142
|
|
|
144
|
-
//
|
|
145
|
-
|
|
143
|
+
// CORS
|
|
144
|
+
app.locals.modules.cors = 'cors'
|
|
145
|
+
app.locals.uses.push('cors()')
|
|
146
146
|
|
|
147
147
|
if (dir !== '.') {
|
|
148
148
|
mkdir(dir, '.')
|
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.0.
|
|
5
|
+
"version": "5.0.12",
|
|
6
6
|
"author": "TJ Holowaychuk <tj@vision-media.ca>",
|
|
7
7
|
"contributors": [
|
|
8
8
|
"Aaron Heckmann <aaron.heckmann+github@gmail.com>",
|
package/templates/js/app.js.ejs
CHANGED
|
@@ -3,14 +3,11 @@ var path = require('path');
|
|
|
3
3
|
<% Object.keys(modules).sort().forEach(function (variable) { -%>
|
|
4
4
|
var <%- variable %> = require('<%- modules[variable] %>');
|
|
5
5
|
<% }); -%>
|
|
6
|
-
|
|
6
|
+
require('dotenv').config();
|
|
7
7
|
<% if (view) { -%>
|
|
8
8
|
var createError = require('http-errors');
|
|
9
9
|
var errorHandler = require('./middlewares/error-handler');
|
|
10
10
|
<% } -%>
|
|
11
|
-
|
|
12
|
-
// environment variables
|
|
13
|
-
require('dotenv').config();
|
|
14
11
|
var routes = require('./config/routes');
|
|
15
12
|
|
|
16
13
|
var app = express();
|
|
@@ -28,9 +25,6 @@ app.set('view engine', '<%- view.engine %>');
|
|
|
28
25
|
app.use(<%- use %>);
|
|
29
26
|
<% }); -%>
|
|
30
27
|
|
|
31
|
-
// CORS
|
|
32
|
-
app.use(cors());
|
|
33
|
-
|
|
34
28
|
// routes
|
|
35
29
|
app.use(routes);
|
|
36
30
|
|
package/templates/mjs/app.js.ejs
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
+
import express from 'express'
|
|
1
2
|
import path from 'path'
|
|
2
3
|
import { fileURLToPath } from 'url'
|
|
3
|
-
|
|
4
|
-
import express from 'express'
|
|
5
4
|
<% Object.keys(modules).sort().forEach(function (variable) { -%>
|
|
6
5
|
import <%- variable %> from '<%- modules[variable] %>'
|
|
7
6
|
<% }) -%>
|
|
8
|
-
|
|
7
|
+
import 'dotenv/config'
|
|
9
8
|
<% if (view) { -%>
|
|
10
9
|
import createError from 'http-errors'
|
|
11
10
|
import errorHandler from './middlewares/error-handler.js'
|
|
12
11
|
<% } -%>
|
|
13
|
-
|
|
14
|
-
// environment variables
|
|
15
|
-
import 'dotenv/config'
|
|
16
12
|
import routes from './config/routes.js'
|
|
17
13
|
|
|
18
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
19
|
-
|
|
20
14
|
const app = express()
|
|
15
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url))
|
|
21
16
|
|
|
22
17
|
<% if (view) { -%>
|
|
23
18
|
// view engine setup
|
|
@@ -32,9 +27,6 @@ app.set('view engine', '<%- view.engine %>')
|
|
|
32
27
|
app.use(<%- use %>)
|
|
33
28
|
<% }) -%>
|
|
34
29
|
|
|
35
|
-
// CORS
|
|
36
|
-
app.use(cors())
|
|
37
|
-
|
|
38
30
|
// routes
|
|
39
31
|
app.use(routes)
|
|
40
32
|
|