Skip to content

Commit 5a1e446

Browse files
committed
Fix package.json and package-scripts and make them more readable
1 parent 06ab5a9 commit 5a1e446

File tree

2 files changed

+44
-20
lines changed

2 files changed

+44
-20
lines changed

package-scripts.js

+41-14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const { series, crossEnv, concurrent, rimraf, runInNewWindow } = require('nps-ut
22

33
module.exports = {
44
scripts: {
5+
default: {
6+
script: 'nps start'
7+
},
58
/**
69
* Starts the builded app from the dist directory
710
*/
@@ -14,7 +17,7 @@ module.exports = {
1417
serve: {
1518
script: series(
1619
'nps banner.serve',
17-
'\"./node_modules/.bin/nodemon\" --watch src --watch .env'
20+
'\"./node_modules/.bin/nodemon\" --watch src --watch .env',
1821
)
1922
},
2023
/**
@@ -24,7 +27,7 @@ module.exports = {
2427
script: series(
2528
'yarn install',
2629
'nps db.migrate',
27-
'nps db.seed'
30+
'nps db.seed',
2831
)
2932
},
3033
/**
@@ -36,7 +39,7 @@ module.exports = {
3639
'nps lint',
3740
'nps clean.dist',
3841
'nps transpile',
39-
'nps copy'
42+
'nps copy',
4043
)
4144
},
4245
/**
@@ -49,7 +52,7 @@ module.exports = {
4952
script: series(
5053
'nps banner.test',
5154
'nps test.unit.pretest',
52-
'nps test.unit.run'
55+
'nps test.unit.run',
5356
)
5457
},
5558
pretest: {
@@ -71,7 +74,7 @@ module.exports = {
7174
'nps banner.test',
7275
'nps test.e2e.pretest',
7376
runInNewWindow(series('nps build', 'nps start')),
74-
'nps test.e2e.run'
77+
'nps test.e2e.run',
7578
)
7679
},
7780
pretest: {
@@ -82,7 +85,7 @@ module.exports = {
8285
},
8386
run: series(
8487
`wait-on --timeout 120000 http-get://localhost:3000/api/info`,
85-
'./node_modules/.bin/cross-env NODE_ENV=test \"./node_modules/.bin/jest\" --testPathPattern=e2e -i'
88+
'./node_modules/.bin/cross-env NODE_ENV=test \"./node_modules/.bin/jest\" --testPathPattern=e2e -i',
8689
),
8790
}
8891
},
@@ -103,7 +106,10 @@ module.exports = {
103106
*/
104107
clean: {
105108
default: {
106-
script: series(`nps banner.clean`, `nps clean.dist`)
109+
script: series(
110+
`nps banner.clean`,
111+
`nps clean.dist`,
112+
)
107113
},
108114
dist: {
109115
script: `./node_modules/.bin/trash './dist'`
@@ -114,13 +120,22 @@ module.exports = {
114120
*/
115121
copy: {
116122
default: {
117-
script: `nps copy.swagger && nps copy.public`
123+
script: series(
124+
`nps copy.swagger`,
125+
`nps copy.public`,
126+
)
118127
},
119128
swagger: {
120-
script: copy('./src/api/swagger.json', './dist')
129+
script: copy(
130+
'./src/api/swagger.json',
131+
'./dist',
132+
)
121133
},
122134
public: {
123-
script: copy('./src/public/*', './dist')
135+
script: copy(
136+
'./src/public/*',
137+
'./dist',
138+
)
124139
}
125140
},
126141
/**
@@ -140,15 +155,27 @@ module.exports = {
140155
db: {
141156
migrate: {
142157
default: {
143-
script: series('nps banner.migrate', '\"./node_modules/.bin/knex\" migrate:latest')
158+
script: series(
159+
'nps banner.migrate',
160+
'\"./node_modules/.bin/knex\" migrate:latest',
161+
)
144162
},
145-
rollback: series('nps banner.rollback', '\"./node_modules/.bin/knex\" migrate:rollback')
163+
rollback: series(
164+
'nps banner.rollback',
165+
'\"./node_modules/.bin/knex\" migrate:rollback',
166+
)
146167
},
147168
seed: {
148-
script: series('nps banner.seed', '\"./node_modules/.bin/knex\" seed:run')
169+
script: series(
170+
'nps banner.seed',
171+
'\"./node_modules/.bin/knex\" seed:run',
172+
)
149173
},
150174
reset: {
151-
script: series('nps banner.dbReset', 'nps console db:reset')
175+
script: series(
176+
'nps banner.dbReset',
177+
'nps console db:reset',
178+
)
152179
}
153180
},
154181
/**

package.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
"version": "3.0.0-alpha",
44
"description": "A delightful way to building a RESTful API with NodeJs & TypeScript",
55
"main": "src/app.ts",
6-
"engines": {
7-
"node": "8.2.1"
8-
},
96
"scripts": {
10-
"start": "node dist/app.js",
11-
"test": "nps test",
12-
"build": "nps build",
7+
"start": "nps",
8+
"test": "npm start test",
9+
"build": "npm start build",
1310
"ts-node": "./node_modules/.bin/ts-node",
1411
"ts-node:fast": "./node_modules/.bin/ts-node -F",
1512
"console": "npm run ts-node:fast -- ./src/console/lib/console.ts",

0 commit comments

Comments
 (0)