Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug with prepare #120

Merged
merged 5 commits into from
Mar 8, 2024
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
3 changes: 3 additions & 0 deletions .env.declaration
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DAPLA_TEAM_API_URL=
DAPLA_TEAM_API_CLUSTER_URL=
PORT=8080
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"lint:fix": "eslint ./src --ext .jsx,.js,.ts,.tsx --quiet --fix --ignore-path ./.gitignore",
"lint:format": "prettier --loglevel warn --write \"./**/*.{js,jsx,ts,tsx,css,md,json}\" ",
"preview": "vite preview"
"preview": "vite preview",
"prepare": "npx vite-envs update-types"
},
"dependencies": {
"@emotion/react": "^11.11.4",
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import proxy from 'express-http-proxy'
const app = express()
const PORT = process.env.PORT || 3000
// use cluster URL if available
const DAPLA_TEAM_API_URL = process.env.DAPLA_TEAM_API_CLUSTER_URL || 'https://dapla-team-api-v2.staging-bip-app.ssb.no'
const DAPLA_TEAM_API_URL = process.env.DAPLA_TEAM_API_CLUSTER_URL || "https://dapla-team-api-v2.staging-bip-app.ssb.no"

// Proxy, note this middleware must be place before all else.. THIS TOOK ME 3 HOURS TO FIGURE OUT! TODO: Remove comment
app.use(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// https://vitejs.dev/config/server-options.html
// https://github.com/garronej/vite-envs

export const DAPLA_TEAM_API_URL = `http://localhost:${import.meta.env.PORT.trim()}/api`
export const DAPLA_TEAM_API_URL = `http://localhost:${import.meta.env.PORT}/api`

export const getGroupType = (groupName: string) => {
const match = groupName.match(/(managers|developers|data-admins|support|consumers)$/)
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineConfig({
plugins: [
react(),
viteEnvs({
declarationFile: '.env.local',
declarationFile: '.env.declaration',
}),
],
})