dx: new dev scripts
Massimo Melina committed
Jun 3, 2022 at 16:04 UTC
6060121ec1bf41a16642da86d31786153872e4d6
2 files changed
+11
-17
dev.md
+8
-16
@@ -12,28 +12,20 @@ more reassuring, like "found 0 vulnerabilities", hopefully.
12
13
## Dev environment
14
15
-First `npm install`.
15
+0. `npm install`
16
+1. `npm run watch-server-proxied` and leave it running. It will serve server stuff plus will proxy frontend and admin files.
17
+2. `npm run start-frontend` and leave it running. It will serve on port 3005.
18
+3. `npm run start-admin` and leave it running. It will serve on port 3006
19
17
-One way of working on sources here is to `npm run watch-server`.
18
-This will give you auto-restarting of the server on back-end changes.
19
-Set an env `DEV=1` to let the code know we are in a dev environment.
20
-
21
-If you want to work on the frontend and admin too, you should *first*
22
-1. set an env `FRONTEND_PROXY=3005`
23
-2. `npm run start-frontend`
24
-1. set an env `ADMIN_PROXY=3006`
25
-2. `npm run start-admin`
26
-
27
-Having this env-s will make the server get all related stuff from the other dev servers.
28
-Otherwise, you should be sure that frontend and admin have been built, and its files are ready to be used in `dist` folder.
29
-In this latter case, the `DEV=1` you set before will make the server get the files from inside the `dist` folder.
20
+If you don't want this proxying version, you can use `npm run watch-server` but after both frontend and admin have
21
+been built, so their files are available in `dist` folder.
22
23
## Tests
24
25
To run tests
26
- `npm run build-all`
35
-- `npm run server-for-test`
36
-- in another shell `npm test`
27
+- `npm run server-for-test` and leave it running.
28
+- `npm test`
29
30
Alternatively you can run a development server, just be sure to load config from `tests` folder.
31
package.json
+3
-1
@@ -11,8 +11,10 @@
11
"author": "Massimo Melina <a@rejetto.com>",
12
"workspaces": [ "server", "admin", "frontend", "shared", "mui-grid-form" ],
13
"scripts": {
14
- "watch-server": "nodemon --ignore tests/ --watch server/src -e ts,tsx --exec ts-node server/src/index.ts",
14
+ "watch-server": "cross-env DEV=1 nodemon --ignore tests/ --watch server/src -e ts,tsx --exec ts-node server/src",
15
+ "watch-server-proxied": "cross-env FRONTEND_PROXY=3005 ADMIN_PROXY=3006 npm run watch-server",
16
"watch-shared": "cd shared && tsc --watch",
17
+ "watch-form": "cd mui-grid-form && tsc --watch",
18
"start-frontend": "cd frontend && npm run start",
19
"start-admin": "cd admin && npm run start",
20
"build-all": "npm audit --omit=dev && rm -rf dist && npm install && npm run build-shared && npm run build-mui-grid-form && npm run build-server && npm run build-frontend && npm run build-admin && echo COMPLETED",