Skip to content

Commit

Permalink
bump node og pnpm v. fiks pr-oppsett
Browse files Browse the repository at this point in the history
  • Loading branch information
Marthe Frogner Holm authored and Marthe Frogner Holm committed Jan 14, 2025
1 parent 3765a8e commit 2ea4646
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 198 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cypress-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.2.0
version: 9.15.3
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '23'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
- name: Cypress binary cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.2.0
version: 9.15.3
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '23'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
- name: Cypress binary cache
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.2.0
version: 9.15.3
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '23'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.2.0
version: 9.15.3
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '23'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.2.0
version: 9.15.3
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '23'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
- name: Install dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:

jobs:
deploy-pull-request-branch:
if: github.event.pull_request.head.repo.fork != true
if: github.event.pull_request.head.repo.fork != true
name: Deploy Pull Request Branch
runs-on: ubuntu-latest
permissions:
Expand All @@ -20,19 +20,19 @@ jobs:
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 9.2.0
version: 9.15.3
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '23'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
- name: Install dependencies
run: pnpm install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.READER_TOKEN }}
- name: Build Pull Request Application
run: NODE_ENV=development VITE_MOCK_REQUEST_HANDLER=PULL_REQUEST BASE=/deltakeroversikt/pr-${{ github.event.number }}/ pnpm build
run: pnpm build:pull-request
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
Expand Down
9 changes: 9 additions & 0 deletions .nais/nais-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ spec:
{
"fromPath": "/amt-tiltaksarrangor-bff", "toUrl": "http://amt-tiltaksarrangor-bff",
"toApp": { "name": "amt-tiltaksarrangor-bff", "namespace": "amt", "cluster": "dev-gcp" }
},
{
"fromPath": "/pr-[0-9]+/amt-tiltaksarrangor-bff",
"toUrl": "http://amt-tiltaksarrangor-bff",
"toApp": {
"name": "amt-tiltaksarrangor-bff",
"namespace": "amt",
"cluster": "dev-gcp"
}
}
],
"header": {
Expand Down
38 changes: 1 addition & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,13 @@ https://navikt.github.io/amt-tiltaksarrangor-flate/

## Installere avhengigheter
`pnpm install`
Nåværende versjon av pnpm er 8.6.2
Nåværende versjon av pnpm er 9.15.3

## Start applikasjon lokalt
`pnpm start`

Husk å følge dokumentasjonen her https://github.com/navikt/nav-dekoratoren-moduler#readme for å sette opp Nav-dekoratøren.

## Kjør lokalt mot lokal backend
Hvis man ønsker å teste med en backend som kjører lokalt på PCen/MACen
så sett følgende innhold i **.env.local**:

```.env
VITE_MOCK_REQUEST_HANDLER=local
VITE_MOCK_REQUEST_AUTH_HEADER=Bearer <TOKEN>
```

## Kjør lokalt mot preprod med proxy
Hvis man ønsker å teste med en reel backend i testmiljøet lokalt fra PCen/MACen
så sett følgende innhold i **.env.local**:

```.env
VITE_MOCK_REQUEST_HANDLER=dev
VITE_MOCK_REQUEST_COOKIE="<ALL REQUEST COOKIES>"
```

Logg inn i testmiljø og hent alle cookies fra request header og bytt de ut med `<ALL REQUEST COOKIES>`
**.env.local** er lagt til i .gitignore og vil ikke bli commitet.

### Eksempel:
```.env
VITE_MOCK_REQUEST_HANDLER=dev
VITE_MOCK_REQUEST_COOKIE="io.nais.wonderwall.session=Fx8oqzvi5FhS5y4TYHXIYliXHT9fNs6/EXAMPLE/dgAxwY5H9S1qrdgg9E4Y+xv76lmv4bWggPZLr3hTZ12mViRYskEeGxpOPf8UvceXxOy5oYOESdLI; innloggingsstatus-token=eyJhbGciOiJIUzUxMiJ9.eyJhdWQiOiJpbm5sb2dnaW5nc3N0YXR1cy1kZXYiLCJzdWIiOiIyNzg0OTA5ODE3NCIsImFjciI6IkxldmVsNCIsImlzcyI6ImlubmxvZ2dpbmdzc3RhdHVzLWRldiIsImV4cCI6MTY2NjA5ODcwMywiaWF0IjoxNjY2MDk1MTAzfQ.p4sXJFdopUa9s2PzzTzNLT-7easXEKMq9Bi7vhe69AUjlDsioSsKW7P3TPs3j5c3MALExample"
```

Kjør opp dev-proxyen med `docker compose up -d` og start deretter applikasjonen med `npm start`.

## Kjør med vanlig mocking
For å kjøre med mocks så sett følgende innhold i **.env.local** eller slett innholdet/filen:

```.env
VITE_MOCK_REQUEST_HANDLER=mock
```

## WCAG
WCAG rapport ligger i mappen .wcag/.
Rapporten kan lastes opp i https://www.w3.org/WAI/eval/report-tool/evaluation/view-report
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"start": "vite",
"build": "vite build",
"build:gh-pages": "NODE_ENV=development vite build --base=/amt-tiltaksarrangor-flate/ && cpy --cwd=build --rename=404.html index.html .",
"build:gh-pages": "NODE_ENV=development --mode demo vite build --base=/amt-tiltaksarrangor-flate/ && cpy --cwd=build --rename=404.html index.html .",
"build:pull-request": "--mode pull-request BASE=/deltakeroversikt/pr-${{ github.event.number }}/ vite build",
"test": "vitest",
"lint": "eslint --max-warnings=0 'src/**/*.{ts,tsx}'",
"lint:fix": "eslint --fix 'src/**/*.{ts,tsx,js}'",
Expand Down
44 changes: 0 additions & 44 deletions src/mock/handlers/dev-proxy-handlers.ts

This file was deleted.

40 changes: 0 additions & 40 deletions src/mock/handlers/local-app-handlers.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/mock/handlers/pull-request-handlers.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/mock/setupMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EndringFraArrangor, EndringFraArrangorType } from '../api/data/endring'
import { KOMET_DELTAKERE_TOGGLE_NAVN, VIS_DRIFTSMELDING_TOGGLE_NAVN } from '../api/data/feature-toggle'

export async function enableMocking() {
if (useMock()) {
if (useMock) {
const url = appUrl('mockServiceWorker.js')

return worker.start({
Expand Down
35 changes: 0 additions & 35 deletions src/mock/utils/mock-env.ts

This file was deleted.

4 changes: 1 addition & 3 deletions src/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class Environment {

const env = new Environment()

export const useMock = () => {
return import.meta.env.DEV
}
export const useMock = [ 'development', 'demo' ].includes(import.meta.env.MODE)

export default env

0 comments on commit 2ea4646

Please sign in to comment.