Skip to content

Commit

Permalink
build: build all the scripts
Browse files Browse the repository at this point in the history
This change builds all the scripts in one go, which seems to be faster but also reduces the complexity of running them (since TypeScript is no longer needed).

Refs #390, #399
  • Loading branch information
thewilkybarkid committed Nov 29, 2021
1 parent 63a607a commit 8ba0510
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
20 changes: 3 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,6 @@ RUN \



#
# Stage: Frontend hooks build
#
FROM builder AS frontend-hooks

COPY src/common/ src/common/
COPY src/backend/ src/backend/

RUN \
mkdir --parents dist src/frontend/hooks \
&& npm run build:hooks \
&& rm -rf .parcel-cache



#
# Stage: Frontend build
#
Expand All @@ -86,10 +71,11 @@ FROM builder AS frontend
COPY --from=scripts /app/dist/scripts/ dist/scripts/
COPY src/common/ src/common/
COPY src/frontend/ src/frontend/
COPY --from=frontend-hooks /app/src/frontend/hooks/ src/frontend/hooks/

RUN \
npm run build:frontend \
mkdir --parents dist src/frontend/hooks \
&& npm run build:hooks \
&& npm run build:frontend \
&& rm -rf .parcel-cache


Expand Down
16 changes: 4 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,14 @@
"watch:backend:dev": "npm-watch build:backend:dev",
"build:frontend": "parcel build --target=frontend src/frontend/index.html",
"build:frontend:dev": "parcel build --target=frontend src/frontend/index.html",
"build:scripts:migrations": "npm run scan:migrations && parcel build --target=migrations-script src/backend/scripts/dbMigrations.ts",
"build:scripts:init": "parcel build --target=init-script src/backend/scripts/dbInit.ts",
"build:scripts": "rimraf dist/scripts && npm run build:scripts:migrations && npm run build:scripts:init",
"build:hooks:spec": "ts-node --transpile-only src/backend/scripts/genSpec.js > ./dist/openapi.json",
"build:scripts": "rimraf dist/scripts && parcel build --target=backend-scripts src/backend/scripts/*",
"build:hooks:spec": "node dist/scripts/genSpec.js > ./dist/openapi.json",
"build:hooks:import": "restful-react import --file ./dist/openapi.json --output ./src/frontend/hooks/api-hooks.tsx",
"build:hooks": "npm run build:hooks:spec && npm run build:hooks:import && rimraf dist/openapi.json",
"build:templates": "copyfiles -u 2 src/backend/templates/email/**/*.hbs dist/backend",
"db": "mikro-orm",
"db:migrations": "node dist/scripts/dbMigrations.js",
"db:apiKey": "ts-node --transpile-only src/backend/scripts/dbApiKey.ts",
"db:apiKey": "node dist/scripts/dbApiKey.js",
"db:init": "node dist/scripts/dbInit.js",
"scan:migrations": "barrelsby --delete -l below -d src/backend/db/migrations",
"start:backend": "node dist/backend/index.js",
Expand All @@ -51,13 +49,7 @@
"distDir": "dist/frontend",
"scopeHoist": false
},
"migrations-script": {
"context": "node",
"distDir": "dist/scripts",
"optimize": false,
"scopeHoist": false
},
"init-script": {
"backend-scripts": {
"context": "node",
"distDir": "dist/scripts",
"optimize": false,
Expand Down

0 comments on commit 8ba0510

Please sign in to comment.