-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement breaking svelte-kit changes (#50)
Implement the breaking changes necessary to upgrade svelte-kit. Main focus is the new routes structure. Check https://kit.svelte.dev/docs/introduction for info. Also, `svelte-kit` now requires `vite` as a separate dependency. This fixes that. Moved the API_URL building logic to `vite.config.ts` also. I also noticed that the LICENSE file was not matching to the license in `frontend`. AFAIK we should be using MPL license, which saves us from people copying the design but still gives us zero responsibility in terms of warranty and zero liability.
- Loading branch information
1 parent
7f3e302
commit 2a2ecab
Showing
21 changed files
with
1,087 additions
and
575 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
nodejs 16.14.0 | ||
nodejs 16.17.0 | ||
elixir 1.13.3 | ||
erlang 24.3.4 | ||
ruby 2.6.6 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ node_modules | |
/.svelte-kit | ||
/build | ||
/functions | ||
.netlify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
16.2.0 | ||
16.17.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +0,0 @@ | ||
engine-strict=true | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
[build] | ||
ignore = "/bin/false" | ||
command = "yarn build" | ||
publish = "build/" | ||
functions = "functions/" | ||
|
||
[functions] | ||
node_bundler = "esbuild" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
{ | ||
"name": "secrets-frontend", | ||
"license": "MPL 2.0", | ||
"license": "MPL-2.0", | ||
"scripts": { | ||
"dev": "svelte-kit dev", | ||
"build": "svelte-kit build", | ||
"preview": "svelte-kit preview", | ||
"dev": "vite dev", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", | ||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch", | ||
"lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .", | ||
"format": "prettier --write --plugin-search-dir=. ." | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/adapter-netlify": "next", | ||
"@sveltejs/kit": "next", | ||
"@typescript-eslint/eslint-plugin": "^5.28.0", | ||
"@typescript-eslint/parser": "^5.28.0", | ||
"autoprefixer": "^10.4.7", | ||
"cssnano": "^5.1.11", | ||
"eslint": "^8.17.0", | ||
"@sveltejs/adapter-netlify": "1.0.0-next.75", | ||
"@sveltejs/kit": "^1.0.0-next.455", | ||
"@typescript-eslint/eslint-plugin": "^5.36.1", | ||
"@typescript-eslint/parser": "^5.36.1", | ||
"autoprefixer": "^10.4.8", | ||
"cssnano": "^5.1.13", | ||
"eslint": "^8.23.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-svelte3": "^4.0.0", | ||
"postcss": "^8.4.14", | ||
"postcss-load-config": "^4.0.1", | ||
"prettier": "~2.7.1", | ||
"prettier-plugin-svelte": "^2.7.0", | ||
"prettier-plugin-tailwindcss": "^0.1.12", | ||
"prettier-plugin-tailwindcss": "^0.1.13", | ||
"svelte": "^3.49.0", | ||
"svelte-preprocess": "^4.10.7", | ||
"tailwindcss": "^3.1.3", | ||
"tailwindcss": "^3.1.8", | ||
"tslib": "^2.4.0", | ||
"typescript": "^4.7.3" | ||
"typescript": "^4.8.2", | ||
"vite": "^3.0.0" | ||
}, | ||
"type": "module", | ||
"dependencies": { | ||
"uuid": "^8.3.2" | ||
} | ||
"dependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 3 additions & 13 deletions
16
frontend/src/routes/__layout.svelte → frontend/src/routes/+layout.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { getStats } from '$lib/api'; | ||
import type { LayoutLoad } from './$types'; | ||
|
||
export const load: LayoutLoad = async ({ fetch }) => { | ||
const stats = await getStats(fetch); | ||
|
||
return stats; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 4 additions & 14 deletions
18
frontend/src/routes/[room].svelte → frontend/src/routes/[room]/+page.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { checkIfRoomExists } from '$lib/api'; | ||
import type { PageLoad } from './$types'; | ||
|
||
export const load: PageLoad = async ({ params, fetch }) => { | ||
return { room: params.room, roomExists: await checkIfRoomExists(params.room, fetch) }; | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,3 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleResolution": "node", | ||
"module": "es2020", | ||
"lib": ["es2020"], | ||
"target": "es2019", | ||
/** | ||
svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript | ||
to enforce using \`import type\` instead of \`import\` for Types. | ||
*/ | ||
"importsNotUsedAsValues": "error", | ||
"isolatedModules": true, | ||
"resolveJsonModule": true, | ||
/** | ||
To have warnings/errors of the Svelte compiler at the correct position, | ||
enable source maps by default. | ||
*/ | ||
"sourceMap": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"baseUrl": ".", | ||
"allowJs": true, | ||
"checkJs": true, | ||
"paths": { | ||
"$lib/*": ["src/lib/*"] | ||
} | ||
}, | ||
"include": ["src/**/*.d.ts", "src/**/*.js", "src/**/*.ts", "src/**/*.svelte"] | ||
"extends": "./.svelte-kit/tsconfig.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { sveltekit } from '@sveltejs/kit/vite'; | ||
import { defineConfig, type UserConfig } from 'vite'; | ||
|
||
export default defineConfig(({ mode }) => { | ||
function buildApiUrl() { | ||
if (mode === 'development') { | ||
return 'http://localhost:4000'; | ||
} | ||
|
||
const prNumber = process.env['REVIEW_ID']; | ||
|
||
if (prNumber) return `https://finiam-secrets-pr-${prNumber}.herokuapp.com`; | ||
|
||
return `https://finiam-secrets.herokuapp.com`; | ||
} | ||
|
||
const apiUrl = buildApiUrl(); | ||
console.log('RUNNING WITH THE FOLLOWING API_URL', apiUrl); | ||
process.env.VITE_API_URL = apiUrl; | ||
|
||
const config: UserConfig = { | ||
plugins: [...sveltekit()] | ||
}; | ||
|
||
return config; | ||
}); |
Oops, something went wrong.