-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage-scripts.js
126 lines (123 loc) · 3.97 KB
/
package-scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
const { series, rimraf } = require("nps-utils");
const { description } = require("commander");
module.exports = {
scripts: {
default: "nps start",
/**
* Serves the current app and watches for changes to restart it
*/
start: {
script: series(
//"nps banner.start",
"webpack",
//"nps transpile",
"nodemon ./src/index.ts web"
// "concurrently -c 'bgBlue.bold,bgMagenta.bold' -n 'webpack,server' 'webpack --watch' 'nodemon --watch src --watch .env'",
),
description:
"Serves the current app and watches for changes to restart it",
},
serve: {
// inspector: {
// script: series(
// "nps banner.serve",
// //"nodemon --watch src --watch .env --inspect",
// "concurrently -c 'bgBlue.bold,bgMagenta.bold' -n 'webpack,server' 'webpack --watch' 'nodemon --watch src --watch .env --inspect'",
// ),
// description:
// "Serves the current app and watches for changes to restart it, you may attach inspector to it.",
// },
script: series(
"nps banner.serve",
"nps webpack",
`nodemon --watch .env --watch src/* ./src/index.ts web`,
// "concurrently -c 'bgBlue.bold,bgMagenta.bold' -n 'webpack,server' 'webpack --watch' 'nodemon --watch src --watch .env'",
),
description:
"For Back End Developing. Serves the current app and watches for changes to restart it",
},
developing: {
script: series(
"concurrently -c 'bgBlue.bold,bgMagenta.bold' -n 'webpack,server' 'webpack --watch --info-verbosity verbose' 'nodemon ./src/index.ts web'"),
description: "For Front or Back End Developing. Serves the current app and watches for changes to restart it"
},
webpack: {
script: series("nps banner.webpack",
`concurrently -c 'bgBlue.bold,bgMagenta.bold' -n 'webpack,server' 'webpack --watch --info-verbosity verbose' '${runFast("./src/index.ts web")}'`
),
description: "For Front End Developing. Serves the current app and watches for changes to restart it"
//, "webpack --watch --info-verbosity verbose"),
},
workers: {
script: series(
"nps banner.workers",
runFast("./src/index.ts worker"),
),
description: "Running the workers service"
},
custom: {
script: "nodemon --watch src/workers/import-into-tags/*.ts src/workers/import-into-tags/index.ts"
},
build: {
script: series("nps banner.build","nps transpile")
},
clean: {
default: {
script: series(`nps banner.clean`, `nps clean.dist`),
description: "Deletes the ./dist folder",
},
dist: {
script: rimraf("./dist"),
hiddenFromHelp: true,
},
},
db: {
scripts: "use `knex migrate:make migration_name -x ts`"
},
/**
* Transpile your app into javascript
*/
transpile: {
script: `tsc --project ./tsconfig.json`,
hiddenFromHelp: true,
},
lint: {
script: eslint(`./src/**/*.ts`),
hiddenFromHelp: true,
},
/**
* This creates pretty banner to the terminal
*/
banner: {
build: banner("build"),
start: banner("start"),
eval: banner("emulators"),
serve: banner("serve"),
testUnit: banner("test.unit"),
testIntegration: banner("test.integration"),
testE2E: banner("test.e2e"),
migrate: banner("migrate"),
seed: banner("seed"),
revert: banner("revert"),
clean: banner("clean"),
generate: banner("db.generate"),
new: banner("db.new"),
webpack: banner("webpack"),
workers: banner("workers")
},
}
};
function runFast(path) {
return `ts-node --transpile-only ${path}`;
}
function banner(name) {
return {
hiddenFromHelp: true,
silent: true,
description: `Shows ${name} banners to the console`,
script: runFast(`./scripts/banner.ts ${name}`),
};
}
function eslint(path) {
return `eslint ${path} --format stylish`;
}