feat: upgrade to brand new sveltekit

This commit is contained in:
Reinaldy Rafli 2022-09-10 20:05:26 +07:00
parent 0775a0872e
commit 7ce854f076
No known key found for this signature in database
GPG Key ID: EA1B2522C1693EC8
16 changed files with 129 additions and 172 deletions

View File

@ -1,11 +1,11 @@
FROM node:16.13-bullseye
FROM node:16.17.0-bullseye
WORKDIR /app
COPY . .
RUN npm install && npm run build
RUN npm ci && npm run build && rm -rf node_modules && npm ci --omit=dev
EXPOSE ${PORT}
CMD ["npm", "run", "preview"]
CMD ["node", "dist/index.js"]

View File

@ -1,35 +1,35 @@
# Jokes Bapak2 Client
Still work in progress
The frontend.
## Development
```bash
# Install modules
$ yarn install
$ npm install
# Run local server
$ yarn dev
$ npm run dev
# build everything
$ yarn build
$ npm run build
```
> You can preview the built app with `yarn preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
> You can preview the built app with `npm run preview`, regardless of whether you installed an adapter. This should _not_ be used to serve your app in production.
## Used packages
| Name | Version | Type |
| --- | --- | --- |
| @sveltejs/kit | `1.0.0-next.195` | Framework |
| svelte | `3.44.1` | Framework |
| typescript | `4.4.4` | Static type language |
| svelte-i18n | `3.3.13` | i18n Library |
| svelte-windicss-preprocess | `4.1.5` | CSS Library |
| @fontsource/fira-mono | `4.5.0` | Webfont |
| @fontsource/rubik | `4.5.0` | Webfont |
| dotenv | `10.0.0` | Utils |
| @sentry/browser | `6.14.1` | Logging |
| Name | Version | Type |
| -------------------------- | ---------------- | -------------------- |
| @sveltejs/kit | `1.0.0-next.480` | Framework |
| svelte | `3.50.1` | Framework |
| typescript | `4.8.3` | Static type language |
| svelte-i18n | `3.4.0` | i18n Library |
| svelte-windicss-preprocess | `4.2.8` | CSS Library |
| @fontsource/fira-mono | `4.5.9` | Webfont |
| @fontsource/rubik | `4.5.11` | Webfont |
| dotenv | `16.0.2` | Utils |
| @sentry/browser | `7.12.1` | Logging |
## Directory structure
@ -48,8 +48,8 @@ $ yarn build
├── static - Static/public directory
├── svelte.config.js - Svelte configuration file
├── tsconfig.json - Typescript configuration file
├── windi.config.js - WindiCSS configuration file
└── yarn.lock - Packages lock file
├── windi.config.ts - WindiCSS configuration file
└── package-lock.json - Packages lock file
```
## `.env` configuration

125
client/package-lock.json generated
View File

@ -32,7 +32,8 @@
"svelte-preprocess": "4.10.7",
"svelte-windicss-preprocess": "4.2.8",
"tslib": "2.4.0",
"typescript": "4.8.3"
"typescript": "4.8.3",
"vite": "^3.1.0"
}
},
"node_modules/@antfu/utils": {
@ -2074,8 +2075,7 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true,
"peer": true
"dev": true
},
"node_modules/functional-red-black-tree": {
"version": "1.0.1",
@ -2177,7 +2177,6 @@
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"peer": true,
"dependencies": {
"function-bind": "^1.1.1"
},
@ -2272,7 +2271,6 @@
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
"dev": true,
"peer": true,
"dependencies": {
"has": "^1.0.3"
},
@ -2544,7 +2542,6 @@
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
"dev": true,
"peer": true,
"bin": {
"nanoid": "bin/nanoid.cjs"
},
@ -2749,8 +2746,7 @@
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true,
"peer": true
"dev": true
},
"node_modules/path-type": {
"version": "4.0.0",
@ -2794,7 +2790,6 @@
"url": "https://tidelift.com/funding/github/npm/postcss"
}
],
"peer": true,
"dependencies": {
"nanoid": "^3.3.4",
"picocolors": "^1.0.0",
@ -3320,7 +3315,6 @@
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
"dev": true,
"peer": true,
"dependencies": {
"is-core-module": "^2.9.0",
"path-parse": "^1.0.7",
@ -3372,7 +3366,6 @@
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.78.1.tgz",
"integrity": "sha512-VeeCgtGi4P+o9hIg+xz4qQpRl6R401LWEXBmxYKOV4zlF82lyhgh2hTZnheFUbANE8l2A41F458iwj2vEYaXJg==",
"dev": true,
"peer": true,
"bin": {
"rollup": "dist/bin/rollup"
},
@ -3535,7 +3528,6 @@
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true,
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@ -3622,7 +3614,6 @@
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true,
"peer": true,
"engines": {
"node": ">= 0.4"
},
@ -4002,7 +3993,6 @@
"resolved": "https://registry.npmjs.org/vite/-/vite-3.1.0.tgz",
"integrity": "sha512-YBg3dUicDpDWFCGttmvMbVyS9ydjntwEjwXRj2KBFwSB8SxmGcudo1yb8FW5+M/G86aS8x828ujnzUVdsLjs9g==",
"dev": true,
"peer": true,
"dependencies": {
"esbuild": "^0.15.6",
"postcss": "^8.4.16",
@ -4051,7 +4041,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4062,7 +4051,6 @@
"integrity": "sha512-7V8tzllIbAQV1M4QoE52ImKu8hT/NLGlGXkiDsbEU5PS6K8Mn09ZnYoS+dcmHxOS9CRsV4IRAMdT3I67IyUNXw==",
"dev": true,
"hasInstallScript": true,
"peer": true,
"bin": {
"esbuild": "bin/esbuild"
},
@ -4105,7 +4093,6 @@
"os": [
"android"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4122,7 +4109,6 @@
"os": [
"android"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4139,7 +4125,6 @@
"os": [
"darwin"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4156,7 +4141,6 @@
"os": [
"darwin"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4173,7 +4157,6 @@
"os": [
"freebsd"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4190,7 +4173,6 @@
"os": [
"freebsd"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4207,7 +4189,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4224,7 +4205,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4241,7 +4221,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4258,7 +4237,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4275,7 +4253,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4292,7 +4269,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4309,7 +4285,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4326,7 +4301,6 @@
"os": [
"linux"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4343,7 +4317,6 @@
"os": [
"netbsd"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4360,7 +4333,6 @@
"os": [
"openbsd"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4377,7 +4349,6 @@
"os": [
"sunos"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4394,7 +4365,6 @@
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4411,7 +4381,6 @@
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -4428,7 +4397,6 @@
"os": [
"win32"
],
"peer": true,
"engines": {
"node": ">=12"
}
@ -5907,8 +5875,7 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
"dev": true,
"peer": true
"dev": true
},
"functional-red-black-tree": {
"version": "1.0.1",
@ -5989,7 +5956,6 @@
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
"dev": true,
"peer": true,
"requires": {
"function-bind": "^1.1.1"
}
@ -6063,7 +6029,6 @@
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.10.0.tgz",
"integrity": "sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg==",
"dev": true,
"peer": true,
"requires": {
"has": "^1.0.3"
}
@ -6268,8 +6233,7 @@
"version": "3.3.4",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz",
"integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==",
"dev": true,
"peer": true
"dev": true
},
"natural-compare": {
"version": "1.4.0",
@ -6409,8 +6373,7 @@
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true,
"peer": true
"dev": true
},
"path-type": {
"version": "4.0.0",
@ -6435,7 +6398,6 @@
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.16.tgz",
"integrity": "sha512-ipHE1XBvKzm5xI7hiHCZJCSugxvsdq2mPnsq5+UF+VHCjiBvtDrlxJfMBToWaP9D5XlgNmcFGqoHmUn0EYEaRQ==",
"dev": true,
"peer": true,
"requires": {
"nanoid": "^3.3.4",
"picocolors": "^1.0.0",
@ -6760,7 +6722,6 @@
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
"dev": true,
"peer": true,
"requires": {
"is-core-module": "^2.9.0",
"path-parse": "^1.0.7",
@ -6793,7 +6754,6 @@
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.78.1.tgz",
"integrity": "sha512-VeeCgtGi4P+o9hIg+xz4qQpRl6R401LWEXBmxYKOV4zlF82lyhgh2hTZnheFUbANE8l2A41F458iwj2vEYaXJg==",
"dev": true,
"peer": true,
"requires": {
"fsevents": "~2.3.2"
}
@ -6907,8 +6867,7 @@
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz",
"integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==",
"dev": true,
"peer": true
"dev": true
},
"sourcemap-codec": {
"version": "1.4.8",
@ -6969,8 +6928,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
"integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
"dev": true,
"peer": true
"dev": true
},
"svelte": {
"version": "3.50.1",
@ -7213,7 +7171,6 @@
"resolved": "https://registry.npmjs.org/vite/-/vite-3.1.0.tgz",
"integrity": "sha512-YBg3dUicDpDWFCGttmvMbVyS9ydjntwEjwXRj2KBFwSB8SxmGcudo1yb8FW5+M/G86aS8x828ujnzUVdsLjs9g==",
"dev": true,
"peer": true,
"requires": {
"esbuild": "^0.15.6",
"fsevents": "~2.3.2",
@ -7227,15 +7184,13 @@
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.15.7.tgz",
"integrity": "sha512-IKznSJOsVUuyt7cDzzSZyqBEcZe+7WlBqTVXiF1OXP/4Nm387ToaXZ0fyLwI1iBlI/bzpxVq411QE2/Bt2XWWw==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.15.7.tgz",
"integrity": "sha512-7V8tzllIbAQV1M4QoE52ImKu8hT/NLGlGXkiDsbEU5PS6K8Mn09ZnYoS+dcmHxOS9CRsV4IRAMdT3I67IyUNXw==",
"dev": true,
"peer": true,
"requires": {
"@esbuild/linux-loong64": "0.15.7",
"esbuild-android-64": "0.15.7",
@ -7265,160 +7220,140 @@
"resolved": "https://registry.npmjs.org/esbuild-android-64/-/esbuild-android-64-0.15.7.tgz",
"integrity": "sha512-p7rCvdsldhxQr3YHxptf1Jcd86dlhvc3EQmQJaZzzuAxefO9PvcI0GLOa5nCWem1AJ8iMRu9w0r5TG8pHmbi9w==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-android-arm64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-android-arm64/-/esbuild-android-arm64-0.15.7.tgz",
"integrity": "sha512-L775l9ynJT7rVqRM5vo+9w5g2ysbOCfsdLV4CWanTZ1k/9Jb3IYlQ06VCI1edhcosTYJRECQFJa3eAvkx72eyQ==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-darwin-64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-darwin-64/-/esbuild-darwin-64-0.15.7.tgz",
"integrity": "sha512-KGPt3r1c9ww009t2xLB6Vk0YyNOXh7hbjZ3EecHoVDxgtbUlYstMPDaReimKe6eOEfyY4hBEEeTvKwPsiH5WZg==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-darwin-arm64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.15.7.tgz",
"integrity": "sha512-kBIHvtVqbSGajN88lYMnR3aIleH3ABZLLFLxwL2stiuIGAjGlQW741NxVTpUHQXUmPzxi6POqc9npkXa8AcSZQ==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-freebsd-64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-freebsd-64/-/esbuild-freebsd-64-0.15.7.tgz",
"integrity": "sha512-hESZB91qDLV5MEwNxzMxPfbjAhOmtfsr9Wnuci7pY6TtEh4UDuevmGmkUIjX/b+e/k4tcNBMf7SRQ2mdNuK/HQ==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-freebsd-arm64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.15.7.tgz",
"integrity": "sha512-dLFR0ChH5t+b3J8w0fVKGvtwSLWCv7GYT2Y2jFGulF1L5HftQLzVGN+6pi1SivuiVSmTh28FwUhi9PwQicXI6Q==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-linux-32": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-linux-32/-/esbuild-linux-32-0.15.7.tgz",
"integrity": "sha512-v3gT/LsONGUZcjbt2swrMjwxo32NJzk+7sAgtxhGx1+ZmOFaTRXBAi1PPfgpeo/J//Un2jIKm/I+qqeo4caJvg==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-linux-64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-linux-64/-/esbuild-linux-64-0.15.7.tgz",
"integrity": "sha512-LxXEfLAKwOVmm1yecpMmWERBshl+Kv5YJ/1KnyAr6HRHFW8cxOEsEfisD3sVl/RvHyW//lhYUVSuy9jGEfIRAQ==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-linux-arm": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-linux-arm/-/esbuild-linux-arm-0.15.7.tgz",
"integrity": "sha512-JKgAHtMR5f75wJTeuNQbyznZZa+pjiUHV7sRZp42UNdyXC6TiUYMW/8z8yIBAr2Fpad8hM1royZKQisqPABPvQ==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-linux-arm64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-linux-arm64/-/esbuild-linux-arm64-0.15.7.tgz",
"integrity": "sha512-P3cfhudpzWDkglutWgXcT2S7Ft7o2e3YDMrP1n0z2dlbUZghUkKCyaWw0zhp4KxEEzt/E7lmrtRu/pGWnwb9vw==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-linux-mips64le": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.15.7.tgz",
"integrity": "sha512-T7XKuxl0VpeFLCJXub6U+iybiqh0kM/bWOTb4qcPyDDwNVhLUiPcGdG2/0S7F93czUZOKP57YiLV8YQewgLHKw==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-linux-ppc64le": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.15.7.tgz",
"integrity": "sha512-6mGuC19WpFN7NYbecMIJjeQgvDb5aMuvyk0PDYBJrqAEMkTwg3Z98kEKuCm6THHRnrgsdr7bp4SruSAxEM4eJw==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-linux-riscv64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.15.7.tgz",
"integrity": "sha512-uUJsezbswAYo/X7OU/P+PuL/EI9WzxsEQXDekfwpQ23uGiooxqoLFAPmXPcRAt941vjlY9jtITEEikWMBr+F/g==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-linux-s390x": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-linux-s390x/-/esbuild-linux-s390x-0.15.7.tgz",
"integrity": "sha512-+tO+xOyTNMc34rXlSxK7aCwJgvQyffqEM5MMdNDEeMU3ss0S6wKvbBOQfgd5jRPblfwJ6b+bKiz0g5nABpY0QQ==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-netbsd-64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-netbsd-64/-/esbuild-netbsd-64-0.15.7.tgz",
"integrity": "sha512-yVc4Wz+Pu3cP5hzm5kIygNPrjar/v5WCSoRmIjCPWfBVJkZNb5brEGKUlf+0Y759D48BCWa0WHrWXaNy0DULTQ==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-openbsd-64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-openbsd-64/-/esbuild-openbsd-64-0.15.7.tgz",
"integrity": "sha512-GsimbwC4FSR4lN3wf8XmTQ+r8/0YSQo21rWDL0XFFhLHKlzEA4SsT1Tl8bPYu00IU6UWSJ+b3fG/8SB69rcuEQ==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-sunos-64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-sunos-64/-/esbuild-sunos-64-0.15.7.tgz",
"integrity": "sha512-8CDI1aL/ts0mDGbWzjEOGKXnU7p3rDzggHSBtVryQzkSOsjCHRVe0iFYUuhczlxU1R3LN/E7HgUO4NXzGGP/Ag==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-windows-32": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-windows-32/-/esbuild-windows-32-0.15.7.tgz",
"integrity": "sha512-cOnKXUEPS8EGCzRSFa1x6NQjGhGsFlVgjhqGEbLTPsA7x4RRYiy2RKoArNUU4iR2vHmzqS5Gr84MEumO/wxYKA==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-windows-64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-windows-64/-/esbuild-windows-64-0.15.7.tgz",
"integrity": "sha512-7MI08Ec2sTIDv+zH6StNBKO+2hGUYIT42GmFyW6MBBWWtJhTcQLinKS6ldIN1d52MXIbiJ6nXyCJ+LpL4jBm3Q==",
"dev": true,
"optional": true,
"peer": true
"optional": true
},
"esbuild-windows-arm64": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/esbuild-windows-arm64/-/esbuild-windows-arm64-0.15.7.tgz",
"integrity": "sha512-R06nmqBlWjKHddhRJYlqDd3Fabx9LFdKcjoOy08YLimwmsswlFBJV4rXzZCxz/b7ZJXvrZgj8DDv1ewE9+StMw==",
"dev": true,
"optional": true,
"peer": true
"optional": true
}
}
},

View File

@ -11,9 +11,9 @@
],
"type": "module",
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build",
"preview": "svelte-kit preview",
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "eslint --fix --ext .svelte,.js,.ts --ignore-path .gitignore .",
@ -35,7 +35,8 @@
"svelte-preprocess": "4.10.7",
"svelte-windicss-preprocess": "4.2.8",
"tslib": "2.4.0",
"typescript": "4.8.3"
"typescript": "4.8.3",
"vite": "^3.1.0"
},
"dependencies": {
"@fontsource/fira-mono": "4.5.9",

View File

@ -1,30 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<html lang="%lang%">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/favicon.png" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="keywords" content="jokesbapak2, jokes, bapak2, indonesian, dad, jokes, api, rest" />
<meta name="author" content="Reinaldy Rafli" />
<meta name="theme-color" content="#f4a9f5" />
<meta name="publisher" content="https://jokesbapak2.pages.dev/" />
<meta property="og:image" content="https://jokesbapak2.pages.dev/social.jpg" />
<meta name="publisher" content="https://jokesbapak2.reinaldyrafli.com/" />
<meta property="og:image" content="%sveltekit.assets%/social.jpg" />
<meta property="og:image:alt" content="Jokesbapak2 - Largest collection of Indonesian dad jokes" />
<meta property="og:image:secure_url" content="https://jokesbapak2.pages.dev/social.jpg" />
<meta property="og:image:secure_url" content="%sveltekit.assets%/social.jpg" />
<meta property="og:image:width" content="1280" />
<meta property="og:image:height" content="640" />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="website" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image:src" content="https://jokesbapak2.pages.dev/social.jpg" />
<meta name="twitter:image" content="https://jokesbapak2.pages.dev/social.jpg" />
<meta name="twitter:image:src" content="%sveltekit.assets%/social.jpg" />
<meta name="twitter:image" content="%sveltekit.assets%/social.jpg" />
<meta name="twitter:creator" content="Reinaldy Rafli" />
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="icon" type="image/svg" href="/favicon.svg">
<script async defer data-website-id="82725fd7-2542-4828-b313-349f68d84894" src="https://jokesbapak2-analytics.herokuapp.com/umami.js" data-do-not-track="true" data-domains="jokesbapak2.pages.dev"></script>
%svelte.head%
%sveltekit.head%
</head>
<body>
<div id="svelte">%svelte.body%</div>
<div id="svelte">%sveltekit.body%</div>
</body>
</html>

View File

@ -0,0 +1,7 @@
import type { Handle } from "@sveltejs/kit";
export const handle: Handle = ({ event, resolve }) => {
return resolve(event, {
transformPageChunk: ({ html }) => html.replace('%lang%', "en")
});
}

View File

@ -71,7 +71,7 @@
}
},
"api": {
"limit": "We limit the request to be 30 request/minute.",
"limit": "We limit the request to be 120 request/minute.",
"get": {
"title": "Get Jokes",
"random": {
@ -105,7 +105,7 @@
"fetch": {
"1": "Using fetch API",
"2": "You can use it, but I personally don't recommend it.",
"3": "data is a base64 string"
"3": "Do some error handling if the request fails"
}
}
}

View File

@ -71,7 +71,7 @@
}
},
"api": {
"limit": "Kami membatasi request menjadi 30 request/menit.",
"limit": "Kami membatasi request menjadi 120 request/menit.",
"get": {
"title": "Dapatkan Jokes",
"random": {
@ -105,7 +105,7 @@
"fetch": {
"1": "Menggunakan fetch API",
"2": "Bapak bisa menggunakannya, tapi saya secara personal tidak merekomendasikannya.",
"3": "data adalah string dengan isi base64"
"3": "Periksa dan jangan abaikan errornya jika request gagal"
}
}
}

View File

@ -42,16 +42,10 @@
<p class="text-sm opacity-50 hover:opacity-90 transition duration-300 ease-in-out inline-block">
{$_('footer.language')}
<a href="?lang=en" target="_top" class="hover:underline">{$_('footer.english')}</a>
|
<a href="?lang=id" target="_top" class="hover:underline">{$_('footer.indonesian')}</a>.
</p>
</div>
<div class="flex-initial pr-3">
<p class="text-sm opacity-50 hover:opacity-90 transition duration-300 ease-in-out inline-block">
<a href="https://jokesbapak2-analytics.herokuapp.com/share/1xYuVSyl/Jokes%20Bapak2" class="hover:underline"
>Analytics</a
>.
</p>
</div>
</div>
</footer>
</div>

View File

@ -0,0 +1,21 @@
import { $fetch } from "ohmyfetch";
import env from "../lib/env";
interface TotalResponse {
message: number;
}
/** @type {import('./$types').PageServerLoad} */
export async function load() {
const response = await $fetch<TotalResponse>(
"total",
{
method: "GET",
baseURL: env.API_ENDPOINT,
parseResponse: JSON.parse
});
return {
total: response.message
}
}

View File

@ -1,25 +1,13 @@
<script lang="ts">
import { onMount } from 'svelte';
import { _ } from 'svelte-i18n';
import { $fetch as omf } from 'ohmyfetch';
import { goto } from '$app/navigation';
import env from '$lib/env';
import Codeblock from '../components/codeblock.svelte';
interface TotalResponse {
message: string;
}
/** @type {import('./$types').PageData} */
export let data;
let total;
onMount(async () => {
const totalJokes = async (): Promise<string> => {
const response = await omf<TotalResponse>(`${env.API_ENDPOINT}/total`);
return response.message;
};
total = await totalJokes();
});
let total = data.total;
</script>
<svelte:head>
@ -27,7 +15,7 @@
<meta name="title" content={$_('meta.title') + '-' + $_('meta.tagline')} />
<meta name="twitter:title" content={$_('meta.title') + '-' + $_('meta.tagline')} />
<meta property="og:title" content={$_('meta.title') + '-' + $_('meta.tagline')} />
<link rel="canonical" href="https://jokesbapak2.pages.dev/" />
<link rel="canonical" href="https://jokesbapak2.reinaldyrafli.com/" />
<meta name="description" content="Largest collection of Indonesian dad jokes as a consumable API" />
<meta name="twitter:description" content="Largest collection of Indonesian dad jokes as a consumable API" />
<meta property="og:description" content="Largest collection of Indonesian dad jokes as a consumable API" />
@ -43,7 +31,7 @@
<div class="max-w-xs mx-auto">
<img src={env.API_ENDPOINT + `/today`} alt="Sample joke" class="py-6 shadow-2xl" />
</div>
<Codeblock>$ curl -XGET 'https://jokesbapak2.herokuapp.com/'</Codeblock>
<Codeblock>$ curl -XGET 'https://jokesbapak2.reinaldyrafli.com/api/'</Codeblock>
<p class="text-sm text-center py-4 opacity-70 hover:opacity-100 transition duration-300 ease-in-out">
{$_('home.more.1')}
<span class="hover:underline cursor-pointer" on:click={() => goto('/guide')}>{$_('navigation.guide')}</span>

View File

@ -0,0 +1 @@
export const ssr = true;

View File

@ -4,8 +4,8 @@
import { _ } from 'svelte-i18n';
import env from '$lib/env';
import { $fetch as omf } from 'ohmyfetch';
import Codeblock from '../components/codeblock.svelte';
import Notice from '../components/notice.svelte';
import Codeblock from '../../components/codeblock.svelte';
import Notice from '../../components/notice.svelte';
interface TotalResponse {
message: string;
@ -28,7 +28,7 @@
<meta name="title" content={$_('navigation.api') + '-' + $_('meta.title')} />
<meta name="twitter:title" content={$_('navigation.api') + '-' + $_('meta.title')} />
<meta property="og:title" content={$_('navigation.api') + '-' + $_('meta.title')} />
<link rel="canonical" href="https://jokesbapak2.pages.dev/api" />
<link rel="canonical" href="https://jokesbapak2.reinaldyrafli.com/api" />
<meta name="description" content="Largest collection of Indonesian dad jokes as a consumable API" />
<meta name="twitter:description" content="Largest collection of Indonesian dad jokes as a consumable API" />
<meta property="og:description" content="Largest collection of Indonesian dad jokes as a consumable API" />

View File

@ -1,5 +1,5 @@
<script lang="ts">
import Codeblock from '../components/codeblock.svelte';
import Codeblock from '../../components/codeblock.svelte';
import { _ } from 'svelte-i18n';
// This page is meant to guide people on how to use the API.
</script>
@ -9,7 +9,7 @@
<meta name="title" content={$_('navigation.guide') + '-' + $_('meta.title')} />
<meta name="twitter:title" content={$_('navigation.guide') + '-' + $_('meta.title')} />
<meta property="og:title" content={$_('navigation.guide') + '-' + $_('meta.title')} />
<link rel="canonical" href="https://jokesbapak2.pages.dev/guide" />
<link rel="canonical" href="https://jokesbapak2.reinaldyrafli.com/guide" />
<meta name="description" content="Largest collection of Indonesian dad jokes as a consumable API" />
<meta name="twitter:description" content="Largest collection of Indonesian dad jokes as a consumable API" />
<meta property="og:description" content="Largest collection of Indonesian dad jokes as a consumable API" />
@ -25,20 +25,24 @@
<section class="guide_page">
<h2>{$_('guide.direct.1')} <code>&lt;img&gt;</code> {$_('guide.direct.2')}</h2>
<Codeblock>&lt;img src="https://jokesbapak2.herokuapp.com/" /&gt;</Codeblock>
<Codeblock>&lt;img src="https://jokesbapak2.reinaldyrafli.com/api/" /&gt;</Codeblock>
</section>
<section class="guide_page">
<h2>{$_('guide.fetch.1')}</h2>
<p>{$_('guide.fetch.2')}</p>
<Codeblock>
fetch("https://jokesbapak2.herokuapp.com/")<br />
&nbsp;&nbsp;.then(response =&gt; response.text())<br />
&nbsp;&nbsp;.then(data =&gt; console.log(data))<br />
const response = await fetch(&quot;https://jokesbapak2.reinaldyrafli.com/api/&quot;);<br />
<br />
// {$_('guide.fetch.3')}<br />
if (!response.ok) &#123;<br />
&nbsp;&nbsp;// {$_('guide.fetch.3')}<br />
&#125;<br />
<br />
&lt;img src="data:image/jpeg;base64, &lcub; data &rcub;" /&gt;
const blob = await response.blob();<br />
<br />
const objectURL = URL.createObjectURL(blob);<br />
<br />
&lt;img src=&quot;&#123; objectURL &#125;&quot; /&gt;
</Codeblock>
</section>

View File

@ -7,7 +7,7 @@
<meta name="title" content={$_('navigation.why') + '-' + $_('meta.title')} />
<meta name="twitter:title" content={$_('navigation.why') + '-' + $_('meta.title')} />
<meta property="og:title" content={$_('navigation.why') + '-' + $_('meta.title')} />
<link rel="canonical" href="https://jokesbapak2.pages.dev/why" />
<link rel="canonical" href="https://jokesbapak2.reinaldyrafli.com/why" />
<meta name="description" content="Largest collection of Indonesian dad jokes as a consumable API" />
<meta name="twitter:description" content="Largest collection of Indonesian dad jokes as a consumable API" />
<meta property="og:description" content="Largest collection of Indonesian dad jokes as a consumable API" />

7
client/vite.config.ts Normal file
View File

@ -0,0 +1,7 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()],
});