Skip to content

Commit

Permalink
fix: otp deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Dec 17, 2024
1 parent e622d4b commit ef969b6
Show file tree
Hide file tree
Showing 17 changed files with 942 additions and 467 deletions.
24 changes: 24 additions & 0 deletions .deploy/service.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"type": "rolling",
"targetPlatform": "REPLACE_IN_PIPELINE",
"applicationData": {
"artifactUrl": "REPLACE_IN_PIPELINE",
"version": "REPLACE_IN_PIPELINE"
},
"runtime": {
"type": "REPLACE_IN_PIPELINE",
"nodejsVersion": "REPLACE_IN_PIPELINE"
},
"profiles": [
{ "name": "loadBalancer", "healthCheckPath": "REPLACE_IN_PIPELINE" },
{ "name": "healthcheck", "interval": "REPLACE_IN_PIPELINE" },
{
"name": "environmentVariables",
"variables": {
"APP_ID": "REPLACE_IN_PIPELINE",
"APP_VERSION": "REPLACE_IN_PIPELINE",
"NODE_ENV": "REPLACE_IN_PIPELINE"
}
}
]
}
10 changes: 10 additions & 0 deletions .env → .env/.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# 📝 Shared Variables 📝
# These variables are always loaded and shared by all modes.
#
# The final value of a variable depends on the priority of where it's being set:
# 1. Deployment pipeline.
# 2. Dedicated mode (.env.{development/staging/production}).
# 3. Shared mode (.env).
#
# 🚫 DO NOT PUT SECRETS HERE 🚫

# Service.
VITE_SERVICE_NAME=portal

Expand Down
12 changes: 12 additions & 0 deletions .env/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 📝 Development Variables 📝
# These variables are only loaded in the development mode.
#
# The final value of a variable depends on the priority of where it's being set:
# 1. Deployment pipeline.
# 2. Dedicated mode (.env.development).
# 3. Shared mode (.env).
#
# 🚫 DO NOT PUT SECRETS HERE 🚫

# GitHub
VITE_GH_CLIENT_ID="Ov23liFxLb96ubvBRG2O"
12 changes: 12 additions & 0 deletions .env/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 📝 Production Variables 📝
# These variables are only loaded in the production mode.
#
# The final value of a variable depends on the priority of where it's being set:
# 1. Deployment pipeline.
# 2. Dedicated mode (.env.production).
# 3. Shared mode (.env).
#
# 🚫 DO NOT PUT SECRETS HERE 🚫

# GitHub
VITE_GH_CLIENT_ID="Ov23liP5TXOmoYIDBmLB"
12 changes: 12 additions & 0 deletions .env/.env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 📝 Staging Variables 📝
# These variables are only loaded in the staging mode.
#
# The final value of a variable depends on the priority of where it's being set:
# 1. Deployment pipeline.
# 2. Dedicated mode (.env.staging).
# 3. Shared mode (.env).
#
# 🚫 DO NOT PUT SECRETS HERE 🚫

# GitHub
VITE_GH_CLIENT_ID="Ov23liHsmlS8msOMUqLd"
17 changes: 0 additions & 17 deletions .gcloudignore

This file was deleted.

9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eslint.config.js export-ignore
**/.* export-ignore
**/*.json export-ignore
**/*.yaml export-ignore
**/*.yml export-ignore
**/*.toml export-ignore
**/*.code-* export-ignore
**/*.md export-ignore
scripts export-ignore
9 changes: 0 additions & 9 deletions app.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React Redux App</title>
<title>Code for Life | Portal</title>
<!--app-head-->
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<div id="root"><!--app-html--></div>
<script type="module" src="/src/entry-client.tsx"></script>
</body>
</html>
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"start": "serve -s dist",
"build": "tsc && vite build",
"preview": "vite preview",
"dev:server": "node server",
"dev:client": "vite",
"start": "NODE_ENV=production node server",
"build": "npm run build:client && npm run build:server",
"build:client": "vite build --outDir dist/client",
"build:server": "vite build --ssr src/entry-server.tsx --outDir dist/server",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:verbose": "vitest run --reporter=verbose --coverage.thresholds.lines=90 --coverage.thresholds.functions=90 --coverage.thresholds.branches=90 --coverage.thresholds.statements=90",
Expand All @@ -16,14 +18,14 @@
"format:check": "prettier --check --write=false .",
"lint": "eslint --max-warnings=0 .",
"lint:fix": "eslint --fix .",
"type-check": "tsc --noEmit"
"type-check": "tsc --build tsconfig.json"
},
"//": [
"🚫 Don't add `dependencies` below that are inherited from the CFL package.",
"✅ Do add `devDependencies` below that are `peerDependencies` in the CFL package."
],
"dependencies": {
"codeforlife": "github:ocadotechnology/codeforlife-package-javascript#v2.5.2",
"codeforlife": "2.6.1",
"crypto-js": "^4.2.0"
},
"devDependencies": {
Expand Down
10 changes: 10 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* © Ocado Group
* Created on 13/12/2024 at 17:47:39(+00:00).
*
* The entrypoint to our app.
*/

import Server from "codeforlife/src/server.js"

new Server().run()
14 changes: 10 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { App as _App, type AppProps as _AppProps } from "codeforlife/components"
import { type FC } from "react"
import { App as _ } from "codeforlife/components"

import Footer from "./features/footer/Footer.tsx"
import routes from "./routes"
import store from "./app/store"
import theme from "./app/theme"

export interface AppProps {}
export interface AppProps extends Pick<_AppProps, "path"> {}

const App: FC<AppProps> = () => (
<_ store={store} theme={theme} routes={routes} footer={<Footer />} />
const App: FC<AppProps> = props => (
<_App
store={store}
theme={theme}
routes={routes}
footer={<Footer />}
{...props}
/>
)

export default App
11 changes: 11 additions & 0 deletions src/entry-client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { StrictMode } from "react"
import { hydrateRoot } from "react-dom/client"

import App from "./App"

hydrateRoot(
document.getElementById("root") as HTMLElement,
<StrictMode>
<App />
</StrictMode>,
)
14 changes: 14 additions & 0 deletions src/entry-server.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { StrictMode } from "react"
import { renderToString } from "react-dom/server"

import App from "./App"

export function render(path: string) {
return {
html: renderToString(
<StrictMode>
<App path={path} />
</StrictMode>,
),
}
}
20 changes: 0 additions & 20 deletions src/main.tsx

This file was deleted.

1 change: 1 addition & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default defineConfig({
codeforlife: path.resolve(__dirname, "./node_modules/codeforlife/src"),
},
},
envDir: ".env",
server: {
open: true,
host: true,
Expand Down
Loading

0 comments on commit ef969b6

Please sign in to comment.