Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18
v22
29 changes: 20 additions & 9 deletions dotenv.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable no-undef */
const dotenv = require('dotenv')
const ngrok = require('ngrok')

const { ENABLE_FRONTEND_TUNNEL, ENABLE_BACKEND_TUNNEL, STAGE } = process.env

Expand All @@ -10,19 +9,31 @@ const { ENABLE_FRONTEND_TUNNEL, ENABLE_BACKEND_TUNNEL, STAGE } = process.env
* and inject the urls into the env variables.
*/
const openTunnels = async () => {
let tunneUrls = {}
let tunnelUrls = {}

if (ENABLE_FRONTEND_TUNNEL === 'true') {
tunneUrls.FRONTEND_TUNNEL_URL = await ngrok.connect({ addr: 8080, host_header: 'localhost:8080' })
console.info(`Frontend tunnel on URL: ${tunneUrls.FRONTEND_TUNNEL_URL}`)
if (ENABLE_FRONTEND_TUNNEL !== 'true' && ENABLE_BACKEND_TUNNEL !== 'true') {
return tunnelUrls
}

if (ENABLE_BACKEND_TUNNEL === 'true') {
tunneUrls.BACKEND_TUNNEL_URL = (await ngrok.connect(3000)) + `/${STAGE ?? 'dev'}`
console.info(`Backend tunnel on URL: ${tunneUrls.BACKEND_TUNNEL_URL}`)
let ngrok
try {
ngrok = require('ngrok')
} catch (err) {
console.error('ngrok is not installed. Run "yarn add ngrok --no-save" in your project directory and try again.')
return tunnelUrls
}

return tunneUrls
if (ngrok && ENABLE_FRONTEND_TUNNEL === 'true') {
tunnelUrls.FRONTEND_TUNNEL_URL = await ngrok.connect({ addr: 8080, host_header: 'localhost:8080' })
console.info(`Frontend tunnel on URL: ${tunnelUrls.FRONTEND_TUNNEL_URL}`)
}

if (ngrok && ENABLE_BACKEND_TUNNEL === 'true') {
tunnelUrls.BACKEND_TUNNEL_URL = (await ngrok.connect(3000)) + `/${STAGE ?? 'dev'}`
console.info(`Backend tunnel on URL: ${tunnelUrls.BACKEND_TUNNEL_URL}`)
}

return tunnelUrls
}

/**
Expand Down
1 change: 0 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"npmClient": "yarn",
"packages": ["packages/*"],
"useWorkspaces": true,
"version": "0.0.0"
}
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
}
},
"resolutions": {
"**/@types/node": "^18.8.0",
"@types/react": "^17.0.4"
"**/@types/node": "^22.9.0",
"@types/react": "^17.0.4",
"minimatch": "^3.0.8"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@types/node": "^18.8.1",
"@types/node": "^22.9.0",
"@types/webpack-env": "^1.15.3",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
Expand All @@ -54,8 +55,7 @@
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"husky": "^4.3.0",
"lerna": "^6.0.1",
"ngrok": "^4.3.0",
"lerna": "^7.4.2",
"prettier": "^2.1.2",
"serverless": "^3.23.0",
"serverless-dynamodb": "^0.2.47",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/services/oauth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export const createOAuthData = (user: User): OAuthData => {
export const validateJWT = (jwt: string): JWTPayload | undefined => {
try {
const decoded = verify(jwt, LaraSecret)
return typeof decoded !== 'object' ? JSON.parse(decoded) : decoded
return typeof decoded !== 'object' ? JSON.parse(decoded) : (decoded as JWTPayload)
} catch (e) {
return undefined
}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@types/file-saver": "^2.0.1",
"@types/graphql": "^14.5.0",
"@types/jest": "^29.1.2",
"@types/node": "^15.0.1",
"@types/node": "^22.9.0",
"@types/react": "^17.0.9",
"@types/react-dom": "^17.0.3",
"@types/react-router": "^5.1.13",
Expand Down
15 changes: 8 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Lara is a tool for writing your "Berichtsheft" digitally. In Germany all trainee

To run the project, ensure the following are installed:

1. Node.js (version 18)
1. Node.js (version 22)
2. Yarn
- Install Yarn globally using
```bash
Expand Down Expand Up @@ -42,12 +42,13 @@ In order to use the frontend, you need an instance of the backend running on por

From the root of the project call:

1. `yarn`
1. `yarn install`
2. `yarn db:install`
3. `yarn compile:watch`
4. `yarn start`
3. `yarn compile`
4. `yarn build`
5. `yarn start`

`compile:watch` starts a file watcher and `start` starts a dev server which serves the frontend on port `:8080`
`start` starts a dev server which serves the frontend on port `:8080`

### Linting

Expand Down Expand Up @@ -168,9 +169,9 @@ The following variables can be added to your cloned version of Lara.
- BACKEND_URL
- String containing backend development url
- ENABLE_FRONTEND_TUNNEL
- Boolean. Tunnel localhost to a publicly available url using ngrok.
- Boolean. Tunnel localhost to a publicly available url using ngrok. You may need to temporarily install ngrok to your workspace first as it is not included in the package.json
- ENABLE_BACKEND_TUNNEL
- Boolean. Tunnel localhost to a publicly available url using ngrok.
- Boolean. Tunnel localhost to a publicly available url using ngrok. You may need to temporarily install ngrok to your workspace first as it is not included in the package.json
- ALEXA_SKILL_ID
- String. Not required
- ALEXA_SKILL_STAGE
Expand Down
Loading