Skip to content

Commit b7d6526

Browse files
authored
Yarn workspaces (#86)
1 parent f64431e commit b7d6526

39 files changed

+3198
-8983
lines changed

.dockerignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
/dashboard/node_modules
55
/dashboard/.next
66
/dashboard/out
7+
/server/node_modules
8+
/server/lib
9+
/server/gitlab-merger-bot
10+
/server/src/generated/
711
/yarn-error.log
8-
/lib
9-
/data
10-
/gitlab-merger-bot
1112
/charts

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: docker://mstruebing/editorconfig-checker:2.0.3
2121

2222
- name: Install
23-
run: yarn install
23+
run: yarn install && yarn run generate
2424

2525
- name: Lint
2626
run: yarn run check:cs

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
/.envrc
22
/node_modules
33
/yarn-error.log
4-
/lib
54
/gitlab-merger-bot
6-
/src/generated/

.prettierignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/.idea/
22
/.github/
33
/charts/
4-
/dashboard/.next/
5-
/dashboard/out/
6-
/lib/
4+
/dashboard/
5+
/server/
6+
/common/

Dockerfile

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,56 @@
1-
FROM node:12.16.1-alpine AS build
1+
FROM node:12.16.1-alpine AS base
22
WORKDIR /app
33

4-
COPY ./package.json ./yarn.lock ./schema.graphql ./codegen.yml ./
4+
COPY ./package.json ./yarn.lock ./
5+
COPY ./server/package.json ./server/
6+
COPY ./dashboard/package.json ./dashboard/
7+
COPY ./common/package.json ./common/
58

9+
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
10+
# See, for example https://github.com/yarnpkg/yarn/issues/5540
611
RUN set -ex \
7-
&& yarn install
12+
&& yarn install --network-timeout 300000
13+
14+
COPY ./schema.graphql ./
815

9-
COPY ./ ./
16+
17+
FROM base AS server-build
18+
WORKDIR /app/server
19+
20+
COPY ./server/codegen.yml ./
21+
22+
RUN set -ex \
23+
&& yarn run generate
24+
25+
COPY ./server ./
1026

1127
RUN set -ex \
1228
&& yarn run build \
1329
&& yarn run build-bin
1430

1531

16-
FROM node:12.16.1-alpine AS dashboard-build
32+
FROM base AS dashboard-build
1733
WORKDIR /app/dashboard
1834

19-
COPY ./dashboard/package.json ./dashboard/yarn.lock ./dashboard/codegen.yml ./
20-
COPY ./schema.graphql ../
21-
22-
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
23-
# See, for example https://github.com/yarnpkg/yarn/issues/5540
24-
RUN set -ex \
25-
&& yarn install --network-timeout 300000
26-
2735
COPY ./dashboard ./
2836

2937
RUN set -ex \
38+
# because it needs src
3039
&& yarn run generate \
3140
&& yarn run build \
3241
&& yarn run export
3342

3443

3544
FROM alpine:3.11
3645
WORKDIR /app
37-
CMD ["/app/gitlab-merger-bot"]
46+
CMD ["/app/server/gitlab-merger-bot"]
3847
ENV NODE_ENV=production
39-
ENV DATA_DIR=/data
4048

4149
RUN set -ex \
4250
&& apk --no-cache --update add \
4351
ca-certificates \
4452
libstdc++ \
45-
libgcc \
46-
&& mkdir -p /data
53+
libgcc
4754

48-
COPY --from=build /app/gitlab-merger-bot /app/schema.graphql /app/
55+
COPY --from=server-build /app/server/gitlab-merger-bot /app/server/
4956
COPY --from=dashboard-build /app/dashboard/out /app/dashboard/out/

common/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/node_modules/

common/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@gitlab-merger-bot/common",
3+
"version": "1.0.0",
4+
"private": true,
5+
"scripts": {
6+
"format": "prettier --write \"**/*.{js,json,ts,tsx}\"",
7+
"generate": "true",
8+
"check": "yarn run check:cs",
9+
"check:cs": "prettier --check \"**/*.{js,json,ts,tsx}\"",
10+
"check:types": "true",
11+
"check:tests": "true"
12+
},
13+
"devDependencies": {
14+
"husky": "^4.2.3",
15+
"pkg": "^4.4.4",
16+
"prettier": "^2.0.4",
17+
"pretty-quick": "^2.0.1"
18+
}
19+
}

dashboard/.dockerignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

dashboard/.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/.next/
2+
/out/

dashboard/package.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
{
2+
"name": "@gitlab-merger-bot/dashboard",
3+
"version": "1.0.0",
24
"private": true,
35
"scripts": {
4-
"start:dev": "concurrently \"next\" \"yarn generate --watch\"",
6+
"start:dev": "next",
57
"start:local": "API_URL=http://127.0.0.1:4000/graphql WS_URL=ws://127.0.0.1:4000/graphql next",
68
"build": "next build",
79
"export": "next export",
810
"start": "next start",
9-
"format": "prettier --write \"**/*.{js,json,ts,tsx}\"",
1011
"generate": "graphql-codegen",
12+
"format": "prettier --write \"**/*.{js,json,ts,tsx}\"",
1113
"check": "yarn run check:types",
12-
"check:types": "tsc --noEmit"
14+
"check:cs": "prettier --check \"**/*.{js,json,ts,tsx}\"",
15+
"check:types": "tsc --noEmit",
16+
"check:tests": "true"
1317
},
1418
"dependencies": {
1519
"@apollo/react-hooks": "^3.1.3",
1620
"@apollo/react-ssr": "^3.1.3",
21+
"@gitlab-merger-bot/common": "*",
22+
"@gitlab-merger-bot/server": "*",
1723
"@material-ui/core": "^4.9.0",
1824
"@material-ui/icons": "^4.5.1",
1925
"apollo-cache-inmemory": "^1.6.5",
@@ -24,10 +30,7 @@
2430
"isomorphic-unfetch": "^3.0.0",
2531
"next": "^9.2.1",
2632
"react": "^16.12.0",
27-
"react-dom": "^16.12.0",
28-
"react-number-format": "^4.4.1",
29-
"subscriptions-transport-ws": "^0.9.16",
30-
"taghiro": "^0.3.1"
33+
"react-dom": "^16.12.0"
3134
},
3235
"devDependencies": {
3336
"@graphql-codegen/cli": "^1.12.1",
@@ -36,7 +39,6 @@
3639
"@types/node": "^13.7.0",
3740
"@types/react": "^16.9.19",
3841
"apollo-utilities": "^1.3.3",
39-
"concurrently": "^5.1.0",
4042
"graphql": "^14.6.0",
4143
"typescript": "^3.8.3"
4244
}

0 commit comments

Comments
 (0)