Skip to content

Commit 9abe734

Browse files
authored
feat: refactor project as a monorepo, created shared and ui packages to handle shared files (#1096)
1 parent edb6345 commit 9abe734

File tree

652 files changed

+22643
-60753
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

652 files changed

+22643
-60753
lines changed

.babelrc

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

.github/workflows/test-admin.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Admin pipeline
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
paths:
6+
- "packages/admin/**"
7+
- "packages/shared/**"
8+
- "packages/ui/**"
49

510
env:
611
CI: true
@@ -14,35 +19,29 @@ env:
1419

1520
jobs:
1621
run:
17-
name: Node ${{ matrix.node }}
22+
name: Node 14
1823
runs-on: ubuntu-latest
1924

20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
node: ["13.x", "14.x"]
24-
2525
steps:
26-
- name: Clone repository
27-
uses: actions/checkout@v1
28-
with:
29-
fetch-depth: 3
30-
- name: Set Node.js version
31-
uses: actions/setup-node@v1
26+
- uses: actions/checkout@v2
27+
- uses: actions/setup-node@v2
3228
with:
33-
node-version: ${{ matrix.node }}
29+
node-version: "14"
3430

3531
- run: node --version
36-
- run: npm --version
32+
- run: yarn --version
3733

3834
- name: Install npm dependencies
39-
run: npm --prefix ./admin ci
35+
run: yarn install
36+
37+
- run: yarn build:shared
38+
- run: yarn build:ui
4039

4140
- name: Run lint
42-
run: npm --prefix ./admin run lint
41+
run: yarn lint:admin
4342

4443
- name: Run build
45-
run: npm --prefix ./admin run build
44+
run: yarn build:admin
4645

4746
- name: Run tests
48-
run: npm --prefix ./admin run test -- --maxWorkers=2
47+
run: yarn test:admin -- --maxWorkers=2

.github/workflows/test-api.yml

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: API pipeline
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
paths:
6+
- "packages/api/**"
7+
- "packages/shared/**"
48

59
env:
610
CI: true
@@ -20,35 +24,29 @@ env:
2024

2125
jobs:
2226
run:
23-
name: Node ${{ matrix.node }}
27+
name: Node 14
2428
runs-on: ubuntu-latest
2529

26-
strategy:
27-
fail-fast: false
28-
matrix:
29-
node: ["13.x", "14.x"]
30-
3130
steps:
32-
- name: Clone repository
33-
uses: actions/checkout@v1
34-
with:
35-
fetch-depth: 3
36-
- name: Set Node.js version
37-
uses: actions/setup-node@v1
31+
- uses: actions/checkout@v2
32+
- uses: actions/setup-node@v2
3833
with:
39-
node-version: ${{ matrix.node }}
34+
node-version: "14"
4035

4136
- run: node --version
42-
- run: npm --version
37+
- run: yarn --version
4338

4439
- name: Install npm dependencies
45-
run: cd api && npm ci
40+
run: yarn install
41+
42+
- run: yarn build:shared
43+
- run: yarn build:ui
4644

4745
- name: Run lint
48-
run: cd api && npm run lint
46+
run: yarn lint:api
4947

5048
- name: Run build
51-
run: cd api && npm run build
49+
run: yarn build:api
5250

5351
- name: Run tests
54-
run: cd api && npm run test -- --maxWorkers=2
52+
run: yarn test:api -- --maxWorkers=2

.github/workflows/test-shared.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Shared pipeline
2+
3+
on:
4+
push:
5+
paths:
6+
- "packages/shared/**"
7+
8+
env:
9+
CI: true
10+
11+
jobs:
12+
run:
13+
name: Node 14
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-node@v2
19+
with:
20+
node-version: "14"
21+
22+
- run: node --version
23+
- run: yarn --version
24+
25+
- name: Install npm dependencies
26+
run: yarn install
27+
28+
- name: Run build
29+
run: yarn build:shared
30+
31+
- name: Run tests
32+
run: yarn test:shared -- --maxWorkers=2

.github/workflows/test-ui.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: UI pipeline
2+
3+
on:
4+
push:
5+
paths:
6+
- "packages/ui/**"
7+
- "packages/shared/**"
8+
9+
env:
10+
CI: true
11+
12+
jobs:
13+
run:
14+
name: Node 14
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- uses: actions/setup-node@v2
20+
with:
21+
node-version: "14"
22+
23+
- run: node --version
24+
- run: yarn --version
25+
26+
- name: Install npm dependencies
27+
run: yarn install
28+
29+
- run: yarn build:shared
30+
31+
- name: Run build
32+
run: yarn build:ui
33+
34+
# - name: Run tests
35+
# run: yarn test:ui -- --maxWorkers=2

.github/workflows/test-web.yml

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Web pipeline
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
paths:
6+
- "packages/web/**"
7+
- "packages/shared/**"
8+
- "packages/ui/**"
49

510
env:
611
CI: true
@@ -19,35 +24,29 @@ env:
1924

2025
jobs:
2126
run:
22-
name: Node ${{ matrix.node }}
27+
name: Node 14
2328
runs-on: ubuntu-latest
2429

25-
strategy:
26-
fail-fast: false
27-
matrix:
28-
node: ["13.x", "14.x"]
29-
3030
steps:
31-
- name: Clone repository
32-
uses: actions/checkout@v1
33-
with:
34-
fetch-depth: 3
35-
- name: Set Node.js version
36-
uses: actions/setup-node@v1
31+
- uses: actions/checkout@v2
32+
- uses: actions/setup-node@v2
3733
with:
38-
node-version: ${{ matrix.node }}
34+
node-version: "14"
3935

4036
- run: node --version
41-
- run: npm --version
37+
- run: yarn --version
4238

4339
- name: Install npm dependencies
44-
run: npm ci
40+
run: yarn install
41+
42+
- run: yarn build:shared
43+
- run: yarn build:ui
4544

4645
- name: Run lint
47-
run: npm run lint
46+
run: yarn lint:admin
4847

4948
- name: Run build
50-
run: npm run build
49+
run: yarn build:admin
5150

5251
- name: Run tests
53-
run: npm run test:ci -- --maxWorkers=2
52+
run: yarn test:admin -- --maxWorkers=2

.gitignore

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1 @@
1-
# See https://help.github.com/ignore-files/ for more about ignoring files.
2-
3-
# dependencies
4-
/node_modules
5-
6-
# testing
7-
/coverage
8-
9-
# production
10-
/build
11-
12-
/.next
13-
14-
# misc
15-
.DS_Store
16-
.env
17-
.env.local
18-
.env.development.local
19-
.env.test.local
20-
.env.production.local
21-
22-
npm-debug.log*
23-
yarn-debug.log*
24-
yarn-error.log*
25-
.vscode
1+
node_modules

.versionrc.js

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

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"files.eol": "\n"
3+
}

PRODUCTION.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,25 @@ REACT_APP_READER_PATH=https://api.mydomain.com
4343

4444
# 3. Install the dependencies
4545

46-
Because it's pretty tedious to install the dependencies for each project individually we've created a script that goes through and runs `npm install` for project for you:
4746

4847
```sh
49-
node shared/install-dependencies.js
48+
yarn install
5049
```
5150

5251
# 4. Build Projects
5352

5453
Build project run:
5554

5655
```sh
57-
npm run build:all
56+
yarn build:all
5857
```
5958

6059
# 4. Migrate database
6160

6261
To migrate database and create the schema run:
6362

6463
```sh
65-
npm run db:migrate
64+
yarn db:migrate
6665
```
6766

6867
# 5. Daemonize Applications
@@ -72,25 +71,23 @@ PM2 is a process manager for Node.js applications. PM2 makes it possible to daem
7271
Use npm to install the latest version of PM2 on your server:
7372

7473
```sh
75-
npm install pm2@latest -g
74+
yarn global add pm2
7675
```
7776

7877
The `-g` option tells npm to install the module globally, so that it’s available system-wide.
7978

8079
## Daemonize `api`:
8180

8281
```sh
83-
cd api/
84-
pm2 start index.js --name "readerfront-api"
82+
pm2 start yarn --name "readerfront-api" -- prod:api
8583
```
8684

8785
Check that the API is running at `http://YOUR_SERVER_IP:8000/`
8886

8987
## Daemonize `web`:
9088

9189
```sh
92-
cd ../
93-
pm2 start npm --name "readerfront-web" -- start
90+
pm2 start yarn --name "readerfront-web" -- prod:web
9491
```
9592

9693
Check that the API is running at `http://YOUR_SERVER_IP:3000/`

0 commit comments

Comments
 (0)