landazuripaul / nest-react Goto Github PK
View Code? Open in Web Editor NEWSimple NestJS + React/Vite boilerplate using Yarn workspaces - Full on TS!
License: GNU Lesser General Public License v3.0
Simple NestJS + React/Vite boilerplate using Yarn workspaces - Full on TS!
License: GNU Lesser General Public License v3.0
As both the server and the client can be deployed separately from each other, it would be nice to have the client pinging the server on a first run to see if the server deployed versions correspond to the expected one.
To do so, we could imagine using the package.json
peerDependencies
entry and the semver package to check if the client is satisfied.
This lines:
"start:common": "(yarn start:domain & yarn start:lib)",
...
"build:common": "(yarn build:domain & yarn build:lib)",
starts a background process for start:domain. Because of the "&". If the domain needs longer to build, the following
COPY --from=builder /usr/src/nest-react/packages/domain/dist packages/domain/dist
fails.
Fix:
diff --git a/package.json b/package.json
index e28856a688caa75930ffe0052a532605ecbc9d27..ac29dd79a493c73e36bde40ecf4cc3f8f295c56f 100644
--- a/package.json
+++ b/package.json
@@ -30,10 +30,12 @@
"generate:version": "./scripts/generate_version.sh",
"start:domain": "yarn workspace @base/domain start:dev",
"start:lib": "yarn workspace @base/lib start:dev",
- "start:common": "(yarn start:domain & yarn start:lib)",
+ "start:common": "(yarn start:domain & yarn start:lib & wait)",
"build:domain": "yarn workspace @base/domain build",
"build:lib": "yarn workspace @base/lib build",
- "build:common": "(yarn build:domain & yarn build:lib)",
+ "build:server": "yarn workspace server build",
+ "build:common": "(yarn build:domain & yarn build:lib & wait)",
+ "build:all": "(yarn build:domain & yarn build:lib & yarn build:server & wait)",
"build-push:server": "PACKAGE=server ./scripts/build_and_push.sh",
"build-push:client": "PACKAGE=client ./scripts/build_and_push.sh",
"client:check-types": "yarn workspace client-vite check-types",
diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile
index 5ad6bae85871715c5fe90c2b99a8cf82ef25aa67..ff7819eb479725aeec635519e66c6161500bf575 100644
--- a/packages/server/Dockerfile
+++ b/packages/server/Dockerfile
@@ -16,12 +16,8 @@ COPY packages/lib packages/lib
# Install domain + lib + server dependencies
RUN yarn install --pure-lockfile --non-interactive
-# Build common packages
-RUN yarn build:common
-
-# Build server then
-WORKDIR /usr/src/nest-react/packages/server
-RUN yarn build
+# Build domain, lib and server packages
+RUN yarn build:all
# Runner
FROM node:14-alpine AS runner
Of course it's quite more safe to replace the "&" with "&&". :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.