1+ /**
2+ * Windows: Please do not use trailing comma as windows will fail with token error
3+ */
4+
15const { series, crossEnv, concurrent, rimraf, runInNewWindow } = require ( 'nps-utils' ) ;
26
37module . exports = {
@@ -17,8 +21,8 @@ module.exports = {
1721 serve : {
1822 script : series (
1923 'nps banner.serve' ,
20- '\"./node_modules/.bin/ nodemon\" --watch src --watch \" .env\"' ,
21- ) ,
24+ 'nodemon --watch src --watch .env'
25+ )
2226 } ,
2327 /**
2428 * Setup's the development environment and the database
@@ -28,7 +32,7 @@ module.exports = {
2832 'yarn install' ,
2933 'nps db.migrate' ,
3034 'nps db.seed'
31- ) ,
35+ )
3236 } ,
3337 /**
3438 * Builds the app into the dist directory
@@ -39,8 +43,8 @@ module.exports = {
3943 'nps lint' ,
4044 'nps clean.dist' ,
4145 'nps transpile' ,
42- 'nps copy' ,
43- ) ,
46+ 'nps copy'
47+ )
4448 } ,
4549 /**
4650 * Database scripts
@@ -50,29 +54,29 @@ module.exports = {
5054 script : series (
5155 'nps banner.migrate' ,
5256 'nps db.config' ,
53- runFast ( '\"./node_modules/.bin/typeorm\" migrations:run' ) ,
54- ) ,
57+ runFast ( '\"./node_modules/.bin/typeorm\" migrations:run' )
58+ )
5559 } ,
5660 revert : {
5761 script : series (
5862 'nps banner.revert' ,
5963 'nps db.config' ,
60- runFast ( '\"./node_modules/.bin/typeorm\" migrations:revert' ) ,
61- ) ,
64+ runFast ( '\"./node_modules/.bin/typeorm\" migrations:revert' )
65+ )
6266 } ,
6367 seed : {
6468 script : series (
6569 'nps banner.seed' ,
6670 'nps db.config' ,
67- runFast ( '\" ./src/lib/seeds/\"' ) ,
68- ) ,
71+ runFast ( './src/lib/seeds/' )
72+ )
6973 } ,
7074 config : {
71- script : runFast ( '\" ./src/lib/ormconfig.ts\"' ) ,
75+ script : runFast ( './src/lib/ormconfig.ts' )
7276 } ,
7377 drop : {
74- script : runFast ( '\"./node_modules/.bin/typeorm\" schema:drop' ) ,
75- } ,
78+ script : runFast ( '\"./node_modules/.bin/typeorm\" schema:drop' )
79+ }
7680 } ,
7781 /**
7882 * These run various kinds of tests. Default is unit.
@@ -84,54 +88,54 @@ module.exports = {
8488 script : series (
8589 'nps banner.test' ,
8690 'nps test.unit.pretest' ,
87- 'nps test.unit.run' ,
88- ) ,
91+ 'nps test.unit.run'
92+ )
8993 } ,
9094 pretest : {
91- script : '\"./node_modules/.bin/ tslint\" -c \" ./tslint.json\" -t stylish \" ./test/unit/**/*.ts\" '
95+ script : 'tslint -c ./tslint.json -t stylish ./test/unit/**/*.ts'
9296 } ,
9397 run : {
94- script : '\"./node_modules/.bin/ cross-env\" NODE_ENV=test \"./node_modules/.bin/ jest\" --testPathPattern=unit'
98+ script : 'cross-env NODE_ENV=test jest --testPathPattern=unit'
9599 } ,
96100 verbose : {
97101 script : 'nps "test --verbose"'
98102 } ,
99103 coverage : {
100104 script : 'nps "test --coverage"'
101- } ,
105+ }
102106 } ,
103107 e2e : {
104108 default : {
105109 script : series (
106110 'nps banner.test' ,
107111 'nps test.e2e.pretest' ,
108112 runInNewWindow ( series ( 'nps build' , 'nps start' ) ) ,
109- 'nps test.e2e.run' ,
110- ) ,
113+ 'nps test.e2e.run'
114+ )
111115 } ,
112116 pretest : {
113- script : '\"./node_modules/.bin/ tslint\" -c \" ./tslint.json\" -t stylish \" ./test/e2e/**/*.ts\" '
117+ script : 'tslint -c ./tslint.json -t stylish ./test/e2e/**/*.ts'
114118 } ,
115119 verbose : {
116120 script : 'nps "test.e2e --verbose"'
117121 } ,
118122 run : series (
119123 `wait-on --timeout 120000 http-get://localhost:3000/api/info` ,
120- '\"./node_modules/.bin/ cross-env\" NODE_ENV=test \"./node_modules/.bin/ jest\" --testPathPattern=e2e -i' ,
121- ) ,
124+ 'cross-env NODE_ENV=test jest --testPathPattern=e2e -i'
125+ )
122126 }
123127 } ,
124128 /**
125129 * Runs TSLint over your project
126130 */
127131 lint : {
128- script : `\"./node_modules/.bin/ tslint\" -c \" ./tslint.json\" -p tsconfig.json \" src/**/*.ts\" --format stylish`
132+ script : `tslint -c ./tslint.json -p tsconfig.json src/**/*.ts --format stylish`
129133 } ,
130134 /**
131135 * Transpile your app into javascript
132136 */
133137 transpile : {
134- script : `\"./node_modules/.bin/ tsc\" `
138+ script : `tsc`
135139 } ,
136140 /**
137141 * Clean files and folders
@@ -140,11 +144,11 @@ module.exports = {
140144 default : {
141145 script : series (
142146 `nps banner.clean` ,
143- `nps clean.dist` ,
144- ) ,
147+ `nps clean.dist`
148+ )
145149 } ,
146150 dist : {
147- script : `\"./node_modules/.bin/trash\" \"./ dist\"`
151+ script : rimraf ( './ dist' )
148152 }
149153 } ,
150154 /**
@@ -154,20 +158,20 @@ module.exports = {
154158 default : {
155159 script : series (
156160 `nps copy.swagger` ,
157- `nps copy.public` ,
158- ) ,
161+ `nps copy.public`
162+ )
159163 } ,
160164 swagger : {
161165 script : copy (
162- '\" ./src/api/swagger.json\" ' ,
163- '\" ./dist\"' ,
164- ) ,
166+ './src/api/swagger.json' ,
167+ './dist'
168+ )
165169 } ,
166170 public : {
167171 script : copy (
168- '\" ./src/public/*\" ' ,
169- '\" ./dist\"' ,
170- ) ,
172+ './src/public/*' ,
173+ './dist'
174+ )
171175 }
172176 } ,
173177 /**
@@ -180,9 +184,9 @@ module.exports = {
180184 migrate : banner ( 'migrate' ) ,
181185 seed : banner ( 'seed' ) ,
182186 revert : banner ( 'revert' ) ,
183- clean : banner ( 'clean' ) ,
184- } ,
185- } ,
187+ clean : banner ( 'clean' )
188+ }
189+ }
186190} ;
187191
188192function banner ( name ) {
@@ -191,16 +195,16 @@ function banner(name) {
191195 silent : true ,
192196 logLevel : 'error' ,
193197 description : `Shows ${ name } banners to the console` ,
194- script : runFast ( `\" ./src/lib/banner.ts\" ${ name } ` ) ,
198+ script : runFast ( `./src/lib/banner.ts ${ name } ` ) ,
195199 } ;
196200}
197201
198202function copy ( source , target ) {
199- return `\"./node_modules/.bin/ copyup\" ${ source } ${ target } ` ;
203+ return `copyup ${ source } ${ target } ` ;
200204}
201205
202206function run ( path ) {
203- return `\"./node_modules/.bin/ ts-node\" ${ path } ` ;
207+ return `ts-node ${ path } ` ;
204208}
205209
206210function runFast ( path ) {
0 commit comments