Skip to content

Commit

Permalink
Migrate from npm to yarn (gardener#487)
Browse files Browse the repository at this point in the history
* Migrate from npm to yarn
* Update readme files
  • Loading branch information
holgerkoser authored Nov 6, 2019
1 parent ba741a2 commit e999385
Show file tree
Hide file tree
Showing 14 changed files with 15,176 additions and 20,586 deletions.
9 changes: 7 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
**

# include backend files and folders
!backend/package*.json
!backend/package.json
!backend/yarn.lock
!backend/.babelrc
!backend/.eslintrc.js
!backend/.nycrc
!backend/*.config.js
!backend/server.js
!backend/lib
!backend/bin
!backend/test

# include frontend folder
!frontend/package*.json
!frontend/package.json
!frontend/yarn.lock
!frontend/.browserslistrc
!frontend/.editorconfig
!frontend/.env
Expand All @@ -24,6 +27,8 @@
!frontend/tests

# include metadata files
!package.json
!yarn.lock
!LICENSE.md
!NOTICE.md
!VERSION
Expand Down
58 changes: 18 additions & 40 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,23 @@
# limitations under the License.
#

#### Base ####
FROM node:12-alpine as base
#### Builder ####
FROM node:12-alpine as builder

WORKDIR /usr/src/app

RUN npm set progress=false \
&& npm config set depth 0
COPY . .

#### Backend base ####
FROM base as backend

COPY backend/package*.json ./

RUN npm install --only=production \
&& cp -R node_modules dist \
&& npm install

COPY backend ./
COPY VERSION ../
COPY Dockerfile ../

RUN npm run lint \
&& npm run test-cov \
&& npm run sync-version

#### Frontend base ####
FROM base as frontend

COPY frontend/package*.json ./

RUN npm install

COPY frontend ./
COPY VERSION ../

RUN npm run lint \
&& npm run test:unit \
&& npm run build
RUN yarn --cwd=backend install --no-progress --production \
&& cp -R backend/node_modules backend/production_node_modules \
&& yarn --cwd=backend install --no-progress \
&& yarn --cwd=backend lint \
&& yarn --cwd=backend test:coverage \
&& yarn --cwd=backend sync-version \
&& yarn --cwd=frontend install --no-progress \
&& yarn --cwd=frontend lint \
&& yarn --cwd=frontend test:unit \
&& yarn --cwd=frontend build

# Release
FROM alpine:3.9 as release
Expand All @@ -67,14 +46,13 @@ ENV NODE_ENV production
ARG PORT=8080
ENV PORT $PORT

COPY --from=backend /usr/local/bin/node /usr/local/bin/
COPY --from=builder /usr/local/bin/node /usr/local/bin/

COPY --from=backend /usr/src/app/package.json ./
COPY --from=backend /usr/src/app/dist ./node_modules/
COPY --from=backend /usr/src/app/lib ./lib/
COPY --from=backend /usr/src/app/server.js ./
COPY --from=builder /usr/src/app/backend/package.json /usr/src/app/backend/server.js ./
COPY --from=builder /usr/src/app/backend/lib ./lib/
COPY --from=builder /usr/src/app/backend/production_node_modules ./node_modules/

COPY --from=frontend /usr/src/app/dist ./public/
COPY --from=builder /usr/src/app/frontend/dist ./public/

USER node

Expand Down
26 changes: 4 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,10 @@

### Install

Install client dependencies
Install all dependencies

```sh
pushd frontend
npm install
popd
```

Install server dependencies

```sh
pushd backend
npm install
popd
yarn
```

### Configuration
Expand Down Expand Up @@ -63,18 +53,10 @@ frontend:
## Run locally <small style="color: grey; font-size: 0.7em">(during development)</small>
Run local backend server with hot reload listening on port `3030`.

```sh
cd backend
npm run dev
```

Run local frontend server with hot reload istening on port `8080`.
Concurrently run the backend server (port `3030`) and the frontend server (port `8080`) both with hot reload enabled.

```sh
cd frontend
npm run serve
yarn serve
```

All request to `/api`, `/auth` and `/config.json` will be proxied by default to the backend server.
Expand Down
12 changes: 6 additions & 6 deletions backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ Setup

``` bash
# install dependencies
npm install
yarn

# run server at localhost:3030
npm run start
yarn start

# run server with hot reload at localhost:3030
npm run dev
yarn serve

# run static code checks
npm run lint
yarn lint

# run tests without coverage
npm run test
yarn test

# run tests with coverage
npm run test-cov
yarn test:coverage

```

Loading

0 comments on commit e999385

Please sign in to comment.