Skip to content

Commit ccbc900

Browse files
authored
Sandbox -> main (Already reviewed) (#1209)
2 parents 288489b + f081a2c commit ccbc900

File tree

24 files changed

+1990
-213
lines changed

24 files changed

+1990
-213
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ mockServiceWorker.js
1515
cypress
1616
src/nais.js
1717
public/src/nais.js
18+
scripts/FetchLandListe.js
1819

package-lock.json

Lines changed: 19 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
"scripts": {
77
"start": "vite",
88
"start:production": "vite --mode production",
9+
"fetch-land-liste": "node --experimental-fetch ./scripts/FetchLandListe.js",
910
"fetch-dev-types": "openapi-typescript https://pensjonskalkulator-backend.intern.dev.nav.no/v3/api-docs/current -o ./src/types/schema.d.ts",
1011
"postfetch-dev-types": "npm run format:types",
1112
"format:types": "prettier --write ./src/types/schema.d.ts && eslint ./src/types/schema.d.ts --fix",
12-
"prebuild": "npm run eslint:check && npm run prettier:check && npm run stylelint:check",
13+
"prebuild": "npm run fetch-land-liste && npm run eslint:check && npm run prettier:check && npm run stylelint:check",
1314
"build": "tsc && vite build --mode staging",
1415
"build:server": "tsc -p tsconfig.server.json",
1516
"build:production": "tsc && vite build --mode production",
@@ -39,6 +40,7 @@
3940
"winston": "^3.14.1"
4041
},
4142
"devDependencies": {
43+
"@babel/plugin-syntax-import-attributes": "^7.24.7",
4244
"@formatjs/intl-datetimeformat": "^6.12.5",
4345
"@formatjs/intl-numberformat": "^8.10.3",
4446
"@grafana/faro-web-sdk": "^1.8.0",

scripts/FetchLandListe.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import fs from 'fs'
2+
import prettier from 'prettier'
3+
4+
fetch(`https://pensjonskalkulator-backend.intern.dev.nav.no/api/v1/land-liste`)
5+
.then((response) => response.text())
6+
.then(async (body) => {
7+
const formattedJson = await prettier.format(
8+
JSON.stringify(JSON.parse(body)),
9+
{
10+
parser: 'json',
11+
}
12+
)
13+
fs.writeFileSync('./src/assets/land-liste.json', formattedJson)
14+
})
15+
.catch((error) => {
16+
console.error(
17+
'Error while fetching or processing /api/v1/land-liste',
18+
error
19+
)
20+
})

0 commit comments

Comments
 (0)