Skip to content

Commit

Permalink
Merge pull request #55 from brentvollebregt/migrate-to-node-22
Browse files Browse the repository at this point in the history
Migrate to Node 22
  • Loading branch information
brentvollebregt authored Oct 4, 2024
2 parents 499cee9 + 663463e commit b616d7f
Show file tree
Hide file tree
Showing 44 changed files with 4,998 additions and 76,215 deletions.
24 changes: 9 additions & 15 deletions .github/workflows/deploy-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,28 @@ jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: "14.x"

- name: Install npm 7
run: npm install -g npm@7
node-version: "22.x"

- name: Install dependencies
run: npm install --legacy-peer-deps
run: npm ci

- name: Build project
run: npm run build
env:
SKIP_PREFLIGHT_CHECK: true
REACT_APP_API_ROOT: https://monopoly-money.fly.dev
REACT_APP_GOOGLE_ANALYTICS_TRACKING_ID: G-3SFPXD2CWJ
REACT_APP_API_UNREACHABLE_ERROR_MESSAGE: "Unable to communicate with server.\nSince this is publicly hosted, we may have run out of minutes on the server.\nThis should be running again next month when the time is reset."
CI: false
GENERATE_SOURCEMAP: false
VITE_API_ROOT: https://monopoly-money.fly.dev
VITE_GOOGLE_ANALYTICS_TRACKING_ID: G-3SFPXD2CWJ
VITE_API_UNREACHABLE_ERROR_MESSAGE: "Unable to communicate with server.\nSince this is publicly hosted, we may have run out of minutes on the server.\nThis should be running again next month when the time is reset."

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./packages/client/build
PUBLISH_BRANCH: gh-pages
publish_branch: gh-pages
cname: monopoly-money.nitratine.net
force_orphan: true # Only keep latest commit in gh-pages (to keep repo size down)
2 changes: 1 addition & 1 deletion .github/workflows/deploy-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
**/build
**/.env
.eslintcache
sitemap.xml
sitemap.xml
**/*.tsbuildinfo
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM debian:bullseye as builder

ARG NODE_VERSION=16.13.1
ARG NODE_VERSION=22.9.0

RUN apt-get update; apt install -y curl
RUN curl https://get.volta.sh | bash
Expand All @@ -20,7 +20,7 @@ COPY . .
# https://stackoverflow.com/a/72323758
RUN chown -R root:root .

RUN npm install && npm run build
RUN npm ci && npm run build
FROM debian:bullseye

LABEL fly_launch_runtime="nodejs"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
The environment variables that can be used are (can also be found in .env.example files):

- `REACT_APP_API_ROOT` (optional): The route that the client requests. Not setting this will default to `window.location.origin`.
- `VITE_API_ROOT` (optional): The route that the client requests. Not setting this will default to `window.location.origin`.
- `SERVER_ALLOWED_ORIGINS` (optional): The origins that are served by the server. Not setting this is the equivalent of setting CORS to \*.

### 🧪 Development Setup

When running the client in development mode using `npm run client:dev`, the client will use the `REACT_APP_API_ROOT` environment variable value to decide where to send requests. If this is not provided, the current hosted URL will be used.
When running the client in development mode using `npm run client:dev`, the client will use the `VITE_API_ROOT` environment variable value to decide where to send requests. If this is not provided, the current hosted URL will be used.

`npm run server:dev` can also be used for development of the server; this allows for hot-reloading. Running the client using `npm run client:dev` and setting `REACT_APP_API_ROOT` to where the server is running will allow for a development setup with hot-reloading.
`npm run server:dev` can also be used for development of the server; this allows for hot-reloading. Running the client using `npm run client:dev` and setting `VITE_API_ROOT` to where the server is running will allow for a development setup with hot-reloading.

> `launch.json` also offers the ability to connect and debug the the server when running `npm run client:dev`.
Expand Down
6 changes: 3 additions & 3 deletions fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ kill_timeout = "5s"

[env]
PORT = "8080"
REACT_APP_API_ROOT = "https://monopoly-money.fly.dev"
REACT_APP_API_UNREACHABLE_ERROR_MESSAGE = "Unable to communicate with server.\nSince this is publicly hosted, we may have run out of minutes on the server.\nThis should be running again next month when the time is reset."
REACT_APP_GOOGLE_ANALYTICS_TRACKING_ID = "G-3SFPXD2CWJ"
VITE_API_ROOT = "https://monopoly-money.fly.dev"
VITE_API_UNREACHABLE_ERROR_MESSAGE = "Unable to communicate with server.\nSince this is publicly hosted, we may have run out of minutes on the server.\nThis should be running again next month when the time is reset."
VITE_GOOGLE_ANALYTICS_TRACKING_ID = "G-3SFPXD2CWJ"
SERVER_ALLOWED_ORIGINS = "https://monopoly-money.nitratine.net,https://monopoly-money.fly.dev"

[[services]]
Expand Down
Loading

0 comments on commit b616d7f

Please sign in to comment.