Skip to content

Commit 3be84eb

Browse files
committed
feat: add cross-env
1 parent f231e90 commit 3be84eb

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

app/config/secure.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
module.exports = {
44
db: {
5-
database: 'lin-cms5',
5+
database: 'lin-cms',
66
host: 'localhost',
77
dialect: 'mysql',
88
port: 3306,
99
username: 'root',
10-
password: '123456',
10+
password: 'root',
1111
logging: false,
1212
timezone: '+08:00'
1313
},

app/config/setting.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
'use strict';
22

3+
let siteDomain
4+
switch (process.env.NODE_ENV) {
5+
case 'development':
6+
siteDomain = 'http://localhost:5000';
7+
break;
8+
case 'production':
9+
siteDomain = '';
10+
break;
11+
}
312
module.exports = {
413
port: 5000,
5-
siteDomain: 'http://localhost:5000',
14+
siteDomain,
615
countDefault: 10,
716
pageDefault: 0,
817
apiDir: 'app/api',

app/extensions/file/local-uploader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class LocalUploader extends Uploader {
4949
arr.push({
5050
key: file.fieldname,
5151
id: saved.id,
52+
path: `${saved.path}`,
5253
url: `${siteDomain}/assets/${saved.path}`
5354
});
5455
}

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "simple and practical CMS implememted by koa",
55
"main": "app/starter.js",
66
"scripts": {
7-
"start:dev": "nodemon",
8-
"start:prod": "node app/starter.js",
7+
"start:dev": "cross-env NODE_ENV=development nodemon",
8+
"start:prod": "cross-env NODE_ENV=production node app/starter.js",
99
"prettier": "prettier --write app/**/*.js app/*.js app/**/**/*.js app/**/**/**/*.js tests/**/*.js && eslint app tests --fix"
1010
},
1111
"keywords": [
@@ -23,6 +23,7 @@
2323
"@types/koa__cors": "^2.2.3",
2424
"@types/prettier": "1.16.1",
2525
"@types/supertest": "^2.0.7",
26+
"cross-env": "^5.2.0",
2627
"eslint": "^5.15.1",
2728
"eslint-config-standard": "^12.0.0",
2829
"eslint-plugin-import": "^2.16.0",

0 commit comments

Comments
 (0)