Skip to content

Commit 60818b0

Browse files
authored
Merge pull request #30 from shinesolutions/upgrade-tgrs
Upgrade tgrs
2 parents 8c299a2 + 2fc1f2b commit 60818b0

Some content is hidden

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

54 files changed

+7651
-16491
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,26 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-18.04
11+
runs-on: ubuntu-22.04
1212

1313
steps:
1414
- uses: actions/checkout@v2
1515
# Install the Node version specified in the project `.node-version` file
16-
- uses: nodenv/actions/node-version@v2.0.9
16+
- uses: nodenv/actions/node-version@v3
1717
id: nodenv
18-
- uses: actions/setup-node@v1
18+
- uses: actions/setup-node@v4
1919
with:
2020
node-version: "${{ steps.nodenv.outputs.node-version }}"
21-
# Yarn will also have been installed by actions/setup-node@v1
21+
# # Yarn will also have been installed by actions/setup-node@v1
2222
- run: yarn install --immutable
2323
- run: yarn checkFormatting
2424
- run: yarn workspace shared build
2525
- run: yarn workspace server build
2626
- run: yarn workspace client build
27-
- run: yarn workspace server test
28-
- run: yarn workspace client test
29-
# Fix version so that it doesn't advance over time unless we want it to
30-
- uses: cypress-io/github-action@v2.11.7
27+
# # Fix version so that it doesn't advance over time unless we want it to
28+
- uses: cypress-io/github-action@v6
3129
with:
30+
install: false
3231
start: yarn workspace integration start
3332
wait-on: "http://localhost:5000"
3433
command: yarn workspace tests start

.gitignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
node_modules
1+
node_modules
2+
3+
### Node ###
4+
# Logs
5+
logs
6+
*.log
7+
npm-debug.log*
8+
yarn-debug.log*
9+
yarn-error.log*

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.18.1
1+
24.12.0

README.md

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ TGRS stands for [TypeScript](https://www.typescriptlang.org/),
77
[serverless](https://en.wikipedia.org/wiki/Serverless_computing). This is a
88
sample project that demonstrates the key technologies in this stack.
99

10-
> Note that this stack does not support server-side rendering (SSR) out-of-the-box.
11-
> For SSR to work, you'd need to introduce an additional server layer, which would
10+
> Note that this stack does not support server-side rendering (SSR) out-of-the-box.
11+
> For SSR to work, you'd need to introduce an additional server layer, which would
1212
> also add extra complexity to your project. If your SEO or performance
13-
> needs necessitate that you use SSR, I recommend you look at a framework like
14-
> [Remix](https://remix.run) or [Next.js](https://nextjs.org). Using these
13+
> needs necessitate that you use SSR, I recommend you look at a framework like
14+
> [Remix](https://remix.run) or [Next.js](https://nextjs.org). Using these
1515
> frameworks may also eliminate the need for you to use GraphQL at all.
1616
1717
For a general overview of the stack and the decisions behind it, see
@@ -33,33 +33,42 @@ or check out [this presentation video](https://www.youtube.com/watch?v=-Idub5K7K
3333

3434
## Quick Start
3535

36-
1. Start the integration environment stub REST server:
36+
1. The server will use the following port mapping to reach the mock integration server:
3737

38-
yarn workspace integration startStubby
38+
{
39+
"messageServerUrl": "http://localhost:8882"
40+
}
41+
42+
In Step 2 the integration environment will read this file and use specified port (configured `8882`) for the mock server.
43+
44+
2. Start the integration environment mock REST server:
45+
46+
yarn workspace integration start
47+
48+
3. Set up a server environment file that configures the server to talk to the integration environment's mock REST server.
3949

40-
2. Set up a server environment file that configures the server to talk to the
41-
integration environment's stub REST server:
50+
Note: If you found that Step 2 produces an error, update `env.integration.json` to the port that was logged above, before running:
4251

4352
ln -sf ./env.integration.json packages/server/env.json
4453

45-
3. Build the code that is shared by both the client and server:
54+
4. Build the code that is shared by both the client and server:
4655

4756
yarn workspace shared build
4857

49-
4. Start the GraphQl server inside an Express instance:
58+
5. Start the GraphQl server inside an Express instance:
5059

5160
yarn workspace server start
5261

53-
5. Set up a client environment file that configures the client to talk to the
62+
6. Set up a client environment file that configures the client to talk to the
5463
GraphQL Express server:
5564

5665
ln -sf ../env/localhost-4000.json packages/client/public/env.json
5766

58-
6. Start the client:
67+
7. Start the client:
5968

6069
yarn workspace client start
6170

62-
7. Go to http://localhost:3000
71+
8. Go to http://localhost:3000
6372

6473
## Starting the GraphQL Server in a local Lambda
6574

@@ -139,7 +148,7 @@ Note that the integration tests use a client production build,
139148
Note that if you've had to re-run steps 1, 2 or 3, you'll need to re-run
140149
this.
141150

142-
5. Run the tests:
151+
5. Lastly, in another terminal, Run:
143152

144153
yarn workspace tests start
145154

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"name": "tgrs",
33
"version": "0.0.0",
44
"private": true,
5+
"engines": {
6+
"node": ">=24.0.0 <25.0.0",
7+
"npm": "please-use-yarn",
8+
"yarn": ">= 1.22.17"
9+
},
510
"workspaces": {
611
"packages": [
712
"packages/*"

packages/client/codegen.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
schema: ../server/src/schema.graphql
2+
generates:
3+
./src/__generated__/:
4+
preset: "client"
5+
documents: ["src/**/*.{ts,tsx}"]
6+
config:
7+
strictScalars: true
8+
scalars:
9+
ID: string
Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,25 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
5+
<link rel="icon" href="./favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1" />
77
<meta name="theme-color" content="#000000" />
88
<meta
99
name="description"
1010
content="Web site created using create-react-app"
1111
/>
12-
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
12+
<link rel="apple-touch-icon" href="./logo192.png" />
1313
<!--
1414
manifest.json provides metadata used when your web app is installed on a
1515
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1616
-->
17-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18-
<!--
19-
Notice the use of %PUBLIC_URL% in the tags above.
20-
It will be replaced with the URL of the `public` folder during the build.
21-
Only files inside the `public` folder can be referenced from the HTML.
22-
23-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24-
work correctly both with client-side routing and a non-root public URL.
25-
Learn how to configure a non-root public URL by running `npm run build`.
26-
-->
17+
<link rel="manifest" href="./manifest.json" />
2718
<title>React App</title>
2819
</head>
2920
<body>
3021
<noscript>You need to enable JavaScript to run this app.</noscript>
3122
<div id="root"></div>
23+
<script type="module" src="./src/index.tsx"></script>
3224
<!--
3325
This HTML file is a template.
3426
If you open it directly in the browser, you will see an empty page.

packages/client/package.json

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@
22
"name": "client",
33
"version": "0.1.0",
44
"private": true,
5+
"type": "module",
6+
"engines": {
7+
"node": ">=24.0.0 <25.0.0",
8+
"npm": "please-use-yarn",
9+
"yarn": ">= 1.22.17"
10+
},
511
"dependencies": {
6-
"@apollo/client": "^3.4.16",
7-
"@testing-library/jest-dom": "^5.11.4",
8-
"@testing-library/react": "^11.0.4",
9-
"@testing-library/user-event": "^7.1.2",
10-
"@types/jest": "^24.0.0",
12+
"@apollo/client": "^4.0.11",
1113
"@types/lodash": "^4.14.162",
12-
"@types/node": "^12.0.0",
13-
"@types/react": "^17.0.33",
14-
"@types/react-dom": "^17.0.10",
15-
"apollo": "^2.33.7",
16-
"graphql": "^15.3.0",
17-
"jest-environment-jsdom-sixteen": "^1.0.3",
14+
"@types/node": "^20.17.10",
15+
"@types/react": "^18.2.19",
16+
"@types/react-dom": "^18.2.19",
17+
"graphql": "16.6.0",
1818
"json-typescript": "^1.1.2",
1919
"lodash": "^4.17.20",
20-
"msw": "^0.21.2",
21-
"react": "^17.0.2",
22-
"react-dom": "^17.0.2",
23-
"react-scripts": "4.0.3",
20+
"msw": "^2.12.7",
21+
"react": "^18.2.0",
22+
"react-dom": "^18.2.0",
2423
"shared": "*",
25-
"typescript": "^4.4.4"
24+
"typescript": "^5.9.3"
2625
},
2726
"scripts": {
2827
"start": "./scripts/start.sh",
2928
"build": "./scripts/build.sh",
30-
"test": "./scripts/test.sh",
31-
"codegen": "./scripts/codegen.sh"
29+
"codegen": "graphql-codegen --config codegen.yml",
30+
"test": "vitest run",
31+
"test:watch": "vitest",
32+
"test:ui": "vitest --ui"
3233
},
3334
"eslintConfig": {
3435
"extends": "react-app"
@@ -45,5 +46,24 @@
4546
"last 1 safari version"
4647
]
4748
},
48-
"devDependencies": {}
49+
"devDependencies": {
50+
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
51+
"@graphql-codegen/cli": "^5.0.0",
52+
"@graphql-codegen/client-preset": "4.3.2",
53+
"@graphql-codegen/typescript": "^4.0.1",
54+
"@testing-library/dom": "^10.4.0",
55+
"@testing-library/jest-dom": "^6.6.3",
56+
"@testing-library/react": "^16.1.0",
57+
"@testing-library/user-event": "^14.5.2",
58+
"@vitejs/plugin-react": "^4.2.1",
59+
"@vitejs/plugin-react-swc": "^3.5.0",
60+
"@vitest/ui": "^2.1.8",
61+
"graphql-constraint-directive": "^5.1.1",
62+
"jsdom": "^25.0.1",
63+
"vite": "^5.0.10",
64+
"vite-plugin-node-polyfills": "^0.17.0",
65+
"vite-plugin-svgr": "^4.2.0",
66+
"vite-tsconfig-paths": "^6.0.3",
67+
"vitest": "^4.0.16"
68+
}
4969
}

packages/client/scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
set -o errexit
22
yarn codegen
3-
react-scripts build
3+
vite build

packages/client/scripts/codegen.sh

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

0 commit comments

Comments
 (0)