Skip to content
This repository has been archived by the owner on Jul 30, 2022. It is now read-only.

Commit

Permalink
Switch to yarn to fix security vulnerabilities
Browse files Browse the repository at this point in the history
- Replace all `npm` commands with `yarn`
The reason to do this switch is due to two reasons.
The first is that `npm install` completes in 1m30s, while
`npm install` completes in 50s, on average. The second is
explained in the point below. This runtime difference might appear
insignificant, but may improve development time over the long run.

- Remove `preinstall` script and change `resolutions` packages
The `preinstall` script is misleading and does not run before
dependencies are installed, and this is acknowledged in
npm/cli#2660 . With the switch to
`yarn`, the `preinstall` script becomes obsolete as `yarn` will
take care of the `resolutions` without needing a script. In
addition, the cause of the security issues was misattributed to
the wrong dependency in the previous commit. Remove this and add
the true culprits.
  • Loading branch information
daniduong committed Sep 19, 2021
1 parent f084cd0 commit 3be69bc
Show file tree
Hide file tree
Showing 7 changed files with 12,880 additions and 17,935 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
FROM node:alpine as client_builder
WORKDIR /app/client
COPY client .
RUN npm install --production && npm run build
RUN yarn install --production && yarn run build

# => Build server
FROM node:alpine as server_builder
WORKDIR /app/server
COPY server .
RUN npm install && npm run build
RUN yarn install && yarn run build

# => Run container
FROM nginx:alpine as base
Expand Down
16,340 changes: 0 additions & 16,340 deletions client/package-lock.json

This file was deleted.

6 changes: 3 additions & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"preinstall": "npx npm-force-resolutions"
"test": "react-scripts test"
},
"resolutions": {
"postcss": "^8.2.10"
"browserslist": "^4.16.5",
"glob-parent": "^5.1.2"
},
"eslintConfig": {
"extends": [
Expand Down
11,515 changes: 11,515 additions & 0 deletions client/yarn.lock

Large diffs are not rendered by default.

Loading

0 comments on commit 3be69bc

Please sign in to comment.