Skip to content

Commit 887ede1

Browse files
committed
otp deploy
1 parent 71ab4fa commit 887ede1

17 files changed

+2275
-1948
lines changed

.deploy/service.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"type": "rolling",
3+
"targetPlatform": "REPLACE_IN_PIPELINE",
4+
"applicationData": {
5+
"artifactUrl": "REPLACE_IN_PIPELINE",
6+
"version": "REPLACE_IN_PIPELINE"
7+
},
8+
"runtime": {
9+
"type": "REPLACE_IN_PIPELINE",
10+
"nodejsVersion": "REPLACE_IN_PIPELINE"
11+
},
12+
"profiles": [
13+
{ "name": "loadBalancer", "healthCheckPath": "REPLACE_IN_PIPELINE" },
14+
{ "name": "healthcheck", "interval": "REPLACE_IN_PIPELINE" },
15+
{
16+
"name": "environmentVariables",
17+
"variables": {
18+
"APP_ID": "REPLACE_IN_PIPELINE",
19+
"APP_VERSION": "REPLACE_IN_PIPELINE",
20+
"NODE_ENV": "REPLACE_IN_PIPELINE"
21+
}
22+
}
23+
]
24+
}

.env

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

.env/.env

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# 📝 Shared Variables 📝
2+
# These variables are always loaded and shared by all modes.
3+
#
4+
# The final value of a variable depends on the priority of where it's being set:
5+
# 1. Deployment pipeline.
6+
# 2. Dedicated mode (.env.{development/staging/production}).
7+
# 3. Shared mode (.env).
8+
#
9+
# 🚫 DO NOT PUT SECRETS HERE 🚫
10+
11+
# Service.
12+
VITE_SERVICE_NAME=replace-me

.env/.env.development

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 📝 Development Variables 📝
2+
# These variables are only loaded in the development mode.
3+
#
4+
# The final value of a variable depends on the priority of where it's being set:
5+
# 1. Deployment pipeline.
6+
# 2. Dedicated mode (.env.development).
7+
# 3. Shared mode (.env).
8+
#
9+
# 🚫 DO NOT PUT SECRETS HERE 🚫

.env/.env.production

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 📝 Production Variables 📝
2+
# These variables are only loaded in the production mode.
3+
#
4+
# The final value of a variable depends on the priority of where it's being set:
5+
# 1. Deployment pipeline.
6+
# 2. Dedicated mode (.env.production).
7+
# 3. Shared mode (.env).
8+
#
9+
# 🚫 DO NOT PUT SECRETS HERE 🚫

.env/.env.staging

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# 📝 Staging Variables 📝
2+
# These variables are only loaded in the staging mode.
3+
#
4+
# The final value of a variable depends on the priority of where it's being set:
5+
# 1. Deployment pipeline.
6+
# 2. Dedicated mode (.env.staging).
7+
# 3. Shared mode (.env).
8+
#
9+
# 🚫 DO NOT PUT SECRETS HERE 🚫

.gcloudignore

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

app.yaml

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

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>React Redux App</title>
7+
<title>Code for Life | REPLACE-ME</title>
8+
<!--app-head-->
89
</head>
910
<body>
10-
<noscript>You need to enable JavaScript to run this app.</noscript>
11-
<div id="root"></div>
12-
<script type="module" src="/src/main.tsx"></script>
11+
<div id="root"><!--app-html--></div>
12+
<script type="module" src="/src/entry-client.tsx"></script>
1313
</body>
1414
</html>

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
"version": "0.0.0",
1212
"type": "module",
1313
"scripts": {
14-
"dev": "vite",
15-
"start": "serve -s dist",
16-
"build": "tsc --build tsconfig.json && vite build",
17-
"preview": "vite preview",
14+
"dev:server": "node server",
15+
"dev:client": "vite",
16+
"start": "NODE_ENV=production node server",
17+
"build": "npm run build:client && npm run build:server",
18+
"build:client": "vite build --outDir dist/client",
19+
"build:server": "vite build --ssr src/entry-server.tsx --outDir dist/server",
1820
"test": "vitest run",
1921
"test:coverage": "vitest run --coverage",
2022
"test:verbose": "vitest run --reporter=verbose --coverage.thresholds.lines=90 --coverage.thresholds.functions=90 --coverage.thresholds.branches=90 --coverage.thresholds.statements=90",
@@ -26,7 +28,7 @@
2628
"type-check": "tsc --build tsconfig.json"
2729
},
2830
"dependencies": {
29-
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v2.3.0"
31+
"codeforlife": "2.6.1"
3032
},
3133
"devDependencies": {
3234
"@eslint/js": "^9.9.0",

server.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* © Ocado Group
3+
* Created on 13/12/2024 at 17:47:39(+00:00).
4+
*
5+
* The entrypoint to our app.
6+
*/
7+
8+
import Server from "codeforlife/src/server.js"
9+
10+
new Server().run()

src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
import { App as _App, type AppProps as _AppProps } from "codeforlife/components"
12
import { type FC } from "react"
2-
import { App as _ } from "codeforlife/components"
33

44
import routes from "./routes"
55
import store from "./app/store"
66
import theme from "./app/theme"
77

8-
export interface AppProps {}
8+
export interface AppProps extends Pick<_AppProps, "path"> {}
99

10-
const App: FC<AppProps> = () => (
11-
<_ store={store} theme={theme} routes={routes} />
10+
const App: FC<AppProps> = props => (
11+
<_App store={store} theme={theme} routes={routes} {...props} />
1212
)
1313

1414
export default App

src/entry-client.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { StrictMode } from "react"
2+
import { hydrateRoot } from "react-dom/client"
3+
4+
import App from "./App"
5+
6+
hydrateRoot(
7+
document.getElementById("root") as HTMLElement,
8+
<StrictMode>
9+
<App />
10+
</StrictMode>,
11+
)

src/entry-server.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { StrictMode } from "react"
2+
import { renderToString } from "react-dom/server"
3+
4+
import App from "./App"
5+
6+
export function render(path: string) {
7+
return {
8+
html: renderToString(
9+
<StrictMode>
10+
<App path={path} />
11+
</StrictMode>,
12+
),
13+
}
14+
}

src/main.tsx

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

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default defineConfig({
1111
codeforlife: path.resolve(__dirname, "./node_modules/codeforlife/src"),
1212
},
1313
},
14+
envDir: ".env",
1415
server: {
1516
open: true,
1617
host: true,

0 commit comments

Comments
 (0)