Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
LironEr committed May 17, 2024
1 parent fd3e19b commit 99924f9
Show file tree
Hide file tree
Showing 16 changed files with 153 additions and 593 deletions.
25 changes: 10 additions & 15 deletions .github/workflows/build-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,33 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'

- name: Install dependencies
run: yarn

- name: Build packages
run: yarn build-packages

- name: Build
working-directory: ./website
working-directory: ./apps/website
run: yarn build

# need to build packages in order to run the bundlemon action on the current CLI
- name: Build packages
run: yarn build-packages

- name: BundleMon
uses: lironer/bundlemon-action@v1
with:
working-directory: ./website
working-directory: ./apps/website
run: yarn bundlemon
env:
CI_COMMIT_SHA: ${{github.event.pull_request.head.sha || github.sha}} # important!
CI_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}

- name: Deploy
if: ${{ github.ref_name == 'master' }}
working-directory: ./website
working-directory: ./apps/website
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# https://securitylab.github.com/research/github-actions-untrusted-input/
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: yarn deploy:prod --message "$COMMIT_MSG"
run: yarn deploy --prod --message "$COMMIT_MSG"
50 changes: 19 additions & 31 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand All @@ -31,7 +31,7 @@ jobs:

- name: Test
env:
NODE_OPTIONS: "--max_old_space_size=4096"
NODE_OPTIONS: '--max_old_space_size=4096'
run: yarn test-packages

- uses: codecov/codecov-action@v1
Expand All @@ -43,73 +43,61 @@ jobs:
if: ${{ matrix.node-version == '18.x' }} # run this step only one time
run: yarn lint-packages

- name: Type check
if: ${{ matrix.node-version == '18.x' }} # run this step only one time
run: yarn type-check-packages

website:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'

- name: Install dependencies
run: yarn

- name: Build packages
run: yarn build-packages

- name: type check
working-directory: ./website
run: yarn type-check

- name: Lint
working-directory: ./website
working-directory: ./apps/website
run: yarn lint

service:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Run docker compose
run: docker-compose -f service/docker-compose.test.yml up -d
- name: Start mock services
working-directory: ./apps/service
run: yarn start:mock-services

- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'yarn'

- name: Install dependencies
run: yarn

- name: Build packages
run: yarn build-packages

- name: Test
working-directory: ./service
working-directory: ./apps/service
run: yarn test

- uses: codecov/codecov-action@v1
with:
file: ./service/coverage/coverage-final.json

- name: type check
working-directory: ./service
run: yarn type-check

- name: Lint
working-directory: ./service
working-directory: ./apps/service
run: yarn lint

- name: Build
working-directory: ./service
working-directory: ./apps/service
run: yarn build

- name: Stop mock services
if: always()
working-directory: ./apps/service
run: yarn stop:mock-services
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Thanks for taking the time to contribute! ❤️

### Prerequisites

- [Node.js](https://nodejs.org/) >= v14
- [Node.js](https://nodejs.org/) >= v18
- [Yarn](https://yarnpkg.com/en/docs/install)

#### Install dependencies
Expand Down Expand Up @@ -35,12 +35,12 @@ Requires `docker` & `docker-compose`

#### Start service

When changing code in `service/` directory the service will reload itself
When changing code in `apps/service/` directory the service will reload itself

Run from root directory
Run from `apps/service/` directory

```
yarn start:service
yarn serve
```

By default the service will start on port `3333`
Expand All @@ -55,7 +55,7 @@ yarn gen-local-data

#### Run tests

Run from `service/` directory
Run from `apps/service/` directory

```bash
yarn start:mock-services
Expand All @@ -68,7 +68,7 @@ yarn test
### BundleMon website

```bash
yarn start
yarn serve
```

After running the command the website will be available at https://localhost:4000/
Expand Down
11 changes: 6 additions & 5 deletions apps/service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
"private": true,
"license": "MIT",
"scripts": {
"serve": "yarn nx serve service",
"build": "yarn nx build service",
"serve": "yarn --cwd ../../ nx serve service",
"build": "yarn --cwd ../../ nx build service",
"generate-schemas": "node ./scripts/generateSchemas.js",
"prevercel-deploy": "yarn nx build service -c vercel",
"prevercel-deploy": "yarn --cwd ../../ nx build service -c vercel",
"vercel-deploy": "vercel deploy",
"start:mock-services": "docker-compose -f docker-compose.test.yml up --remove-orphans",
"stop:mock-services": "docker-compose -f docker-compose.test.yml down",
"gen-local-data": "node -r @swc-node/register -r dotenv/config ./scripts/generateLocalData.ts dotenv_config_path=.development.env"
},
"dependencies": {
Expand All @@ -18,8 +19,8 @@
"@fastify/secure-session": "^7.4.0",
"@octokit/auth-app": "^6.0.0",
"@octokit/rest": "^20.0.1",
"bundlemon-markdown-output": "^1.0.0",
"bundlemon-utils": "^1.2.1",
"bundlemon-markdown-output": "^2.0.0-rc.0",
"bundlemon-utils": "^2.0.0-rc.0",
"env-var": "^7.3.1",
"fastify": "^4.26.2",
"mongodb": "^6.3.0"
Expand Down
2 changes: 1 addition & 1 deletion apps/service/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
}
],
"files": [],
"include": [],
"include": []
}
7 changes: 4 additions & 3 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
"build": "yarn --cwd ../../ nx build website --verbose",
"serve": "yarn --cwd ../../ nx serve website --verbose",
"serve:preview": "yarn --cwd ../../ nx preview website --verbose",
"bundlemon": "node -r @swc-node/register ../../packages/bundlemon/bin/bundlemon.ts"
"bundlemon": "node -r @swc-node/register ../../packages/bundlemon/bin/bundlemon.ts",
"deploy": "netlify deploy --dir ../../dist/apps/website"
},
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.13",
"@mui/lab": "^5.0.0-alpha.148",
"@mui/material": "^5.14.13",
"bundlemon-utils": "^1.2.1",
"bundlemon-utils": "^2.0.0-rc.0",
"material-react-table": "^1.15.0",
"mobx": "^6.10.2",
"mobx-react-lite": "^4.0.5",
Expand All @@ -33,7 +34,7 @@
"@types/react-router-dom": "^5.3.3",
"@types/recharts": "^1.8.25",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"esbuild-loader": "^4.0.2",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"netlify-cli": "^16.7.0",
Expand Down
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
"license": "MIT",
"scripts": {
"test-packages": "yarn nx run-many --target=test --projects tag:type:lib --verbose",
"build-packages": "nx run-many --target=build --projects tag:type:lib",
"build-packages": "nx run-many --target=build --projects tag:type:lib --verbose",
"build-packages:watch": "nx watch --projects tag:type:lib -- nx run \\$NX_PROJECT_NAME:build",
"lint-packages": "yarn nx run-many --target=lint --projects tag:type:lib",
"type-check-packages": "lerna run type-check --stream",
"start:service": "docker-compose -f docker-compose.dev.yml up --build",
"lint-packages": "yarn nx run-many --target=lint --projects tag:type:lib --verbose",
"prepare": "husky install"
},
"devDependencies": {
Expand All @@ -23,8 +21,6 @@
"@types/jest": "^29.5.1",
"@types/jest-when": "^3.5.2",
"@types/node": "18.16.9",
"@types/react": "18.2.33",
"@types/react-dom": "18.2.14",
"@typescript-eslint/eslint-plugin": "^6.4.0",
"@typescript-eslint/parser": "^6.4.0",
"@vitejs/plugin-react": "^4.2.0",
Expand All @@ -37,14 +33,11 @@
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-when": "^3.5.2",
"jsdom": "~22.1.0",
"lint-staged": "^15.2.2",
"nx": "18.3.2",
"prettier": "^3.0.2",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"vite": "~5.0.0"
"typescript": "^5.0.4"
},
"engines": {
"yarn": "^1.10.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/bundlemon-markdown-output/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bundlemon-markdown-output",
"version": "1.0.0",
"version": "2.0.0-rc.0",
"description": "",
"keywords": [],
"author": "Liron Er",
Expand All @@ -12,13 +12,13 @@
"directory": "packages/bundlemon-markdown-output"
},
"engines": {
"node": ">=14.16"
"node": ">=18"
},
"main": "lib/index",
"types": "lib/index.d.ts",
"scripts": {},
"dependencies": {
"bundlemon-utils": "^1.2.1",
"bundlemon-utils": "^2.0.0-rc.0",
"bytes": "^3.1.0"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion packages/bundlemon-markdown-output/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"main": "{projectRoot}/lib/index.ts",
"updateBuildableProjectDepsInPackageJson": false,
"assets": [
"README.md",
{
"input": "{projectRoot}",
"glob": "README.md",
"output": "/"
},
"LICENSE",
{
"input": "{projectRoot}",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundlemon-markdown-output/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"path": "./tsconfig.spec.json"
}
]
}
}
4 changes: 2 additions & 2 deletions packages/bundlemon-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bundlemon-utils",
"version": "1.2.1",
"version": "2.0.0-rc.0",
"description": "",
"keywords": [],
"author": "Liron Er",
Expand All @@ -12,7 +12,7 @@
"directory": "packages/bundlemon-utils"
},
"engines": {
"node": ">=14.16"
"node": ">=18"
},
"main": "lib/index",
"types": "lib/index.d.ts",
Expand Down
6 changes: 5 additions & 1 deletion packages/bundlemon-utils/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
"main": "{projectRoot}/lib/index.ts",
"updateBuildableProjectDepsInPackageJson": false,
"assets": [
"README.md",
{
"input": "{projectRoot}",
"glob": "README.md",
"output": "/"
},
"LICENSE",
{
"input": "{projectRoot}",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundlemon-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"path": "./tsconfig.spec.json"
}
]
}
}
Loading

0 comments on commit 99924f9

Please sign in to comment.