From c0677192c544cdebb4caf0167d90b379c0464ebb Mon Sep 17 00:00:00 2001 From: Olivier Gamache Date: Wed, 31 Aug 2022 06:48:53 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=95=20moving=20to=20deno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 54 +++++++++++++++ package.json | 4 +- pnpm-lock.yaml | 111 ++++++++++++++++--------------- src/components/toaster/index.tsx | 56 ---------------- src/entry-client.tsx | 3 +- src/entry-server.tsx | 4 +- src/islands/app/index.tsx | 8 +-- src/root.tsx | 3 +- vercel.json | 18 ----- vite.config.ts | 4 +- 10 files changed, 122 insertions(+), 143 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 src/components/toaster/index.tsx delete mode 100644 vercel.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..491e38aa --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: Deno Deploy +on: [push] + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + permissions: + id-token: write # Needed for auth with Deno Deploy + contents: read # Needed to clone the repository + + steps: + - name: Clone repository + uses: actions/checkout@v2 + + - uses: pnpm/action-setup@v2.0.1 + name: Install pnpm + id: pnpm-install + with: + version: 7 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + run: | + echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + + - name: Install dependencies + run: pnpm install + + - name: Build + run: | + pnpm build + + - name: Install Deno and Deploy + run: | + cd dist + curl -fsSL https://deno.land/x/install/install.sh | sh + export DENO_INSTALL="/home/runner/.deno" + export PATH="$DENO_INSTALL/bin:$PATH" + deno install --allow-read --allow-write --allow-env --allow-net --allow-run --no-check -r -f https://deno.land/x/deploy/deployctl.ts + deployctl deploy --verbose --prod --project=olgam4-bat --token=$TOKEN -- ./server.js + ls + env: + TOKEN: ${{ secrets.DENOLAND }} diff --git a/package.json b/package.json index 8717886f..e5ffeb09 100644 --- a/package.json +++ b/package.json @@ -41,9 +41,9 @@ "postcss-preset-env": "7.8.0", "rollup": "2.79.0", "solid-app-router": "0.4.2", - "solid-js": "1.4.7", + "solid-js": "1.5.1", "solid-start": "0.1.0-alpha.99", - "solid-start-vercel": "0.1.0-alpha.99", + "solid-start-deno": "0.1.0-alpha.99", "solid-testing-library": "0.3.0", "tailwindcss": "3.1.8", "tailwindcss-plugin-icons": "1.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eae1925d..808a6eac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -28,9 +28,9 @@ specifiers: postcss-preset-env: 7.8.0 rollup: 2.79.0 solid-app-router: 0.4.2 - solid-js: 1.4.7 + solid-js: 1.5.1 solid-start: 0.1.0-alpha.99 - solid-start-vercel: 0.1.0-alpha.99 + solid-start-deno: 0.1.0-alpha.99 solid-testing-library: 0.3.0 tailwindcss: 3.1.8 tailwindcss-plugin-icons: 1.0.7 @@ -48,10 +48,10 @@ devDependencies: '@iconify-json/carbon': 1.1.7 '@mdx-js/rollup': 2.1.3_rollup@2.79.0 '@rollup/plugin-replace': 4.0.0_rollup@2.79.0 - '@solid-primitives/destructure': 0.1.2_solid-js@1.4.7 - '@solid-primitives/i18n': 1.1.1_solid-js@1.4.7 - '@solidjs/meta': 0.28.0_solid-js@1.4.7 - '@solidjs/router': 0.4.2_solid-js@1.4.7 + '@solid-primitives/destructure': 0.1.2_solid-js@1.5.1 + '@solid-primitives/i18n': 1.1.1_solid-js@1.5.1 + '@solidjs/meta': 0.28.0_solid-js@1.5.1 + '@solidjs/router': 0.4.2_solid-js@1.5.1 '@testing-library/dom': 8.17.1 '@testing-library/jest-dom': 5.16.5 '@testing-library/user-event': 14.4.3_wl4iynrlixafokvgqnhzlvigei @@ -70,11 +70,11 @@ devDependencies: postcss-import: 15.0.0_postcss@8.4.16 postcss-preset-env: 7.8.0_postcss@8.4.16 rollup: 2.79.0 - solid-app-router: 0.4.2_solid-js@1.4.7 - solid-js: 1.4.7 - solid-start: 0.1.0-alpha.99_i3e5gkc6iaajliwj4z46dnxgxe - solid-start-vercel: 0.1.0-alpha.99_2kkqsdkpmgichxt4qza77ol55q - solid-testing-library: 0.3.0_solid-js@1.4.7 + solid-app-router: 0.4.2_solid-js@1.5.1 + solid-js: 1.5.1 + solid-start: 0.1.0-alpha.99_aerksk34ruitxfovp76mnxopzu + solid-start-deno: 0.1.0-alpha.99_2kkqsdkpmgichxt4qza77ol55q + solid-testing-library: 0.3.0_solid-js@1.5.1 tailwindcss: 3.1.8_postcss@8.4.16 tailwindcss-plugin-icons: 1.0.7_tailwindcss@3.1.8 taze: 0.8.0 @@ -168,7 +168,7 @@ packages: resolution: {integrity: sha512-s6t2w/IPQVTAET1HitoowRGXooX8mCgtuP5195wD/QJPV6wYjpujCGF7JuMODVX2ZAJOf1GT6DT9MHEZvLOFSw==} engines: {node: '>=6.9.0'} dependencies: - '@babel/types': 7.18.10 + '@babel/types': 7.18.4 dev: true /@babel/helper-annotate-as-pure/7.18.6: @@ -1298,7 +1298,7 @@ packages: '@babel/helper-plugin-utils': 7.17.12 '@babel/plugin-proposal-unicode-property-regex': 7.17.12_@babel+core@7.18.10 '@babel/plugin-transform-dotall-regex': 7.16.7_@babel+core@7.18.10 - '@babel/types': 7.18.10 + '@babel/types': 7.18.4 esutils: 2.0.3 dev: true @@ -1367,6 +1367,14 @@ packages: to-fast-properties: 2.0.0 dev: true + /@babel/types/7.18.4: + resolution: {integrity: sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/helper-validator-identifier': 7.18.6 + to-fast-properties: 2.0.0 + dev: true + /@bcoe/v8-coverage/0.2.3: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true @@ -1642,15 +1650,6 @@ packages: chalk: 4.1.2 dev: true - /@jridgewell/gen-mapping/0.3.1: - resolution: {integrity: sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==} - engines: {node: '>=6.0.0'} - dependencies: - '@jridgewell/set-array': 1.1.1 - '@jridgewell/sourcemap-codec': 1.4.11 - '@jridgewell/trace-mapping': 0.3.13 - dev: true - /@jridgewell/gen-mapping/0.3.2: resolution: {integrity: sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==} engines: {node: '>=6.0.0'} @@ -1673,7 +1672,7 @@ packages: /@jridgewell/source-map/0.3.2: resolution: {integrity: sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==} dependencies: - '@jridgewell/gen-mapping': 0.3.1 + '@jridgewell/gen-mapping': 0.3.2 '@jridgewell/trace-mapping': 0.3.13 dev: true @@ -1949,45 +1948,45 @@ packages: resolution: {integrity: sha512-K7C7IlQ3zLePEZleUN21ceBA2aLcMnLHTLph8QWk1JK37L90obdpY+QGY8bXMKxf1ht1Z0MNewvXxWv0oGDYFg==} dev: true - /@solid-primitives/destructure/0.1.2_solid-js@1.4.7: + /@solid-primitives/destructure/0.1.2_solid-js@1.5.1: resolution: {integrity: sha512-Is/o14Sj6LUS9/yzsTsnp0BQ+wWMHhEhzUAp8FXgFiirHuzfZVDngvRd0a4PezDw5kl8ziyV7vBimDt5vuKPhw==} peerDependencies: solid-js: ^1.3.0 dependencies: - '@solid-primitives/utils': 3.0.2_solid-js@1.4.7 - solid-js: 1.4.7 + '@solid-primitives/utils': 3.0.2_solid-js@1.5.1 + solid-js: 1.5.1 dev: true - /@solid-primitives/i18n/1.1.1_solid-js@1.4.7: + /@solid-primitives/i18n/1.1.1_solid-js@1.5.1: resolution: {integrity: sha512-ywIJ4MADZ25of6X/hgPTd6UNWbgM6X/ZNJStIexAlaLi9fFWw1yFRP/cllSBabEfMoCWgOETgoT16JQzxZlphg==} peerDependencies: solid-js: ^1.3.1 dependencies: - solid-js: 1.4.7 + solid-js: 1.5.1 dev: true - /@solid-primitives/utils/3.0.2_solid-js@1.4.7: + /@solid-primitives/utils/3.0.2_solid-js@1.5.1: resolution: {integrity: sha512-LCU3tVrJmyRqJ0ocG5uCEuUNqmGkcAC+cWpDEE49AuvtehkdQfv4CfqvdNJgs3eoQRQhLOrVcgd1bHFJY4lsrQ==} peerDependencies: solid-js: ^1.4.1 dependencies: - solid-js: 1.4.7 + solid-js: 1.5.1 dev: true - /@solidjs/meta/0.28.0_solid-js@1.4.7: + /@solidjs/meta/0.28.0_solid-js@1.5.1: resolution: {integrity: sha512-x52VdB9RZJ1apDB/pAmf58oeJsJ0lGKFXWjnm/TE/MlENIBPg3JaW8H5v2HnGpQC0WUbgiIsDFWpLWVNBo5t6g==} peerDependencies: solid-js: '>=1.4.0' dependencies: - solid-js: 1.4.7 + solid-js: 1.5.1 dev: true - /@solidjs/router/0.4.2_solid-js@1.4.7: + /@solidjs/router/0.4.2_solid-js@1.5.1: resolution: {integrity: sha512-RswymVhqnGVHMCo/01X9wE+u98pzYZQ/b23SgjO/PK+8oTgdY1f83OrsWR1A01LieTySkCSw7nunWTi+VOQyWA==} peerDependencies: solid-js: ^1.3.5 dependencies: - solid-js: 1.4.7 + solid-js: 1.5.1 dev: true /@surma/rollup-plugin-off-main-thread/2.2.3: @@ -3164,6 +3163,10 @@ packages: cssom: 0.3.8 dev: true + /csstype/3.1.0: + resolution: {integrity: sha512-uX1KG+x9h5hIJsaKR9xHUeUraxf8IODOwq9JLNPq6BwB04a/xgpq3rcx47l5BZu5zBPlgD342tdke3Hom/nJRA==} + dev: true + /data-urls/3.0.2: resolution: {integrity: sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ==} engines: {node: '>=12'} @@ -7185,19 +7188,21 @@ packages: smart-buffer: 4.2.0 dev: true - /solid-app-router/0.4.2_solid-js@1.4.7: + /solid-app-router/0.4.2_solid-js@1.5.1: resolution: {integrity: sha512-+NrLcmqYssx8DcbpcLBaYPqfTRtS+rkfbxMhLH8MHfTcTkdZfrkWQK7lsUvuPCebGEzfaPZJvHqBwhPrCXAmxg==} peerDependencies: solid-js: ^1.3.5 dependencies: - solid-js: 1.4.7 + solid-js: 1.5.1 dev: true - /solid-js/1.4.7: - resolution: {integrity: sha512-u3hoe5w3xseAc/8zLwYaQVGanWXknMMQkzryNz7lOPy2ygW6DhCtfMseun4kLflRNRzrUUpTV3W5p7j2SGcHCQ==} + /solid-js/1.5.1: + resolution: {integrity: sha512-Y6aKystIxnrB0quV5nhqNuJV+l2Fk3/PQy1mMya/bzxlGiMHAym7v1NaqEgqDIvctbkxOi5dBj0ER/ewrH060g==} + dependencies: + csstype: 3.1.0 dev: true - /solid-refresh/0.4.1_solid-js@1.4.7: + /solid-refresh/0.4.1_solid-js@1.5.1: resolution: {integrity: sha512-v3tD/OXQcUyXLrWjPW1dXZyeWwP7/+GQNs8YTL09GBq+5FguA6IejJWUvJDrLIA4M0ho9/5zK2e9n+uy+4488g==} peerDependencies: solid-js: ^1.3 @@ -7205,11 +7210,11 @@ packages: '@babel/generator': 7.18.10 '@babel/helper-module-imports': 7.18.6 '@babel/types': 7.18.10 - solid-js: 1.4.7 + solid-js: 1.5.1 dev: true - /solid-start-vercel/0.1.0-alpha.99_2kkqsdkpmgichxt4qza77ol55q: - resolution: {integrity: sha512-vgeCBhd75ztLHVxuyquK9G3fldBUIFH5MsF1maoLBsBj/wf3friAIy0/jzt66XZl2RV7i0iBRPEqmQ3IGH7oFg==} + /solid-start-deno/0.1.0-alpha.99_2kkqsdkpmgichxt4qza77ol55q: + resolution: {integrity: sha512-YuDLb7Us2TVg2CYoBfmVdq7hoB2utTCHnjdM9606evfg+xVuhUBMT96uGb8o8wnABwFMJFiZ//eXVYc5KHhusw==} peerDependencies: solid-start: '*' vite: '*' @@ -7218,12 +7223,12 @@ packages: '@rollup/plugin-json': 4.1.0_rollup@2.79.0 '@rollup/plugin-node-resolve': 13.3.0_rollup@2.79.0 rollup: 2.79.0 - solid-start: 0.1.0-alpha.99_i3e5gkc6iaajliwj4z46dnxgxe + solid-start: 0.1.0-alpha.99_aerksk34ruitxfovp76mnxopzu terser: 5.14.2 vite: 3.0.9 dev: true - /solid-start/0.1.0-alpha.99_i3e5gkc6iaajliwj4z46dnxgxe: + /solid-start/0.1.0-alpha.99_aerksk34ruitxfovp76mnxopzu: resolution: {integrity: sha512-ODzODpXQ3fV6txTYa92C5qCKbd0M/CzzZPknaP6+IrzwNL1aRobepkhKz0rMT3BJLQAVHoSq/dHytsT/ZYw6Jw==} hasBin: true peerDependencies: @@ -7238,8 +7243,8 @@ packages: '@babel/preset-env': 7.18.10_@babel+core@7.18.10 '@babel/preset-typescript': 7.18.6_@babel+core@7.18.10 '@babel/template': 7.18.10 - '@solidjs/meta': 0.28.0_solid-js@1.4.7 - '@solidjs/router': 0.4.2_solid-js@1.4.7 + '@solidjs/meta': 0.28.0_solid-js@1.5.1 + '@solidjs/router': 0.4.2_solid-js@1.5.1 '@types/cookie': 0.5.1 chokidar: 3.5.3 compression: 1.7.4 @@ -7256,25 +7261,25 @@ packages: rollup-route-manifest: 1.0.0_rollup@2.79.0 sade: 1.8.1 sirv: 2.0.2 - solid-js: 1.4.7 + solid-js: 1.5.1 terser: 5.14.2 undici: 5.8.1 vite: 3.0.9 vite-plugin-inspect: 0.6.0_vite@3.0.9 - vite-plugin-solid: 2.3.0_solid-js@1.4.7+vite@3.0.9 + vite-plugin-solid: 2.3.0_solid-js@1.5.1+vite@3.0.9 wait-on: 6.0.1_debug@4.3.4 transitivePeerDependencies: - supports-color dev: true - /solid-testing-library/0.3.0_solid-js@1.4.7: + /solid-testing-library/0.3.0_solid-js@1.5.1: resolution: {integrity: sha512-6NWVbySNVzyReBm2N6p3eF8bzxRZXHZTAmPix4vFWYol16QWVjNQsEUxvr+ZOutb0yuMZmNuGx3b6WIJYmjwMQ==} engines: {node: '>= 14'} peerDependencies: solid-js: '>=1.0.0' dependencies: '@testing-library/dom': 7.31.2 - solid-js: 1.4.7 + solid-js: 1.5.1 dev: true /source-map-js/1.0.2: @@ -8096,7 +8101,7 @@ packages: - supports-color dev: true - /vite-plugin-solid/2.3.0_solid-js@1.4.7+vite@3.0.9: + /vite-plugin-solid/2.3.0_solid-js@1.5.1+vite@3.0.9: resolution: {integrity: sha512-N2sa54C3UZC2nN5vpj5o6YP+XdIAZW6n6xv8OasxNAcAJPFeZT7EOVvumL0V4c8hBz1yuYniMWdESY8807fVSg==} peerDependencies: solid-js: ^1.3.17 @@ -8106,8 +8111,8 @@ packages: '@babel/preset-typescript': 7.18.6_@babel+core@7.18.10 babel-preset-solid: 1.4.8_@babel+core@7.18.10 merge-anything: 5.0.2 - solid-js: 1.4.7 - solid-refresh: 0.4.1_solid-js@1.4.7 + solid-js: 1.5.1 + solid-refresh: 0.4.1_solid-js@1.5.1 vite: 3.0.9 transitivePeerDependencies: - supports-color diff --git a/src/components/toaster/index.tsx b/src/components/toaster/index.tsx deleted file mode 100644 index 84985ceb..00000000 --- a/src/components/toaster/index.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import type { Component, Ref } from 'solid-js' -import autoAnimate from '@formkit/auto-animate' - -type Toast = { - id: string - message: string -} - -const createToaster = () => { - const [toasts, setToasts] = createSignal([]) - - const toast = (message: string) => { - const id = Math.random().toString() - setToasts(toasts => [...toasts, { id, message }]) - } - - const removeToast = (id: string) => { - setToasts(toasts => toasts.filter(t => t.id !== id)) - } - - return { - toasts, - removeToast, - toast, - } -} - -interface Props extends ReturnType { } - -const Toaster: Component = (props) => { - let toasterRef: Ref - - createEffect(() => { - toasterRef && autoAnimate(toasterRef) - }) - - return ( -
- ( -
- -

- {message} -

-
- )} /> -
- ) -} - -export { - createToaster, - Toaster as default, -} diff --git a/src/entry-client.tsx b/src/entry-client.tsx index be42d706..beb1a757 100644 --- a/src/entry-client.tsx +++ b/src/entry-client.tsx @@ -7,4 +7,5 @@ console.log(` \\___) ~~~~~~~~~~~~~~~~~~--> `) -hydrate(() => , document) +if (typeof window !== 'undefined') hydrate(() => , document) + diff --git a/src/entry-server.tsx b/src/entry-server.tsx index f34ec360..38afc9d3 100644 --- a/src/entry-server.tsx +++ b/src/entry-server.tsx @@ -1,3 +1,3 @@ -import { StartServer, createHandler, renderAsync } from "solid-start/entry-server"; +import { StartServer, createHandler, renderAsync } from 'solid-start/entry-server' -export default createHandler(renderAsync(event => )); +export default createHandler(renderAsync(event => )) diff --git a/src/islands/app/index.tsx b/src/islands/app/index.tsx index 1b12f93e..268add2c 100644 --- a/src/islands/app/index.tsx +++ b/src/islands/app/index.tsx @@ -8,7 +8,6 @@ import Button from '@components/button' import ReloadPrompt from '@components/reload' import Form from '@components/form' import { createInput } from '@components/form/input' -import Toaster, { createToaster } from '@components/toaster' import { ThemeContext } from '@context/theme' import { createApp } from './reactivity' @@ -23,7 +22,6 @@ export default function() { const counter = createCounter() const nameInput = createInput('name') - const toasterHook = createToaster() const { phoneCall, nextLanguage, @@ -57,10 +55,7 @@ export default function() {
@@ -68,7 +63,6 @@ export default function() {
-
) } diff --git a/src/root.tsx b/src/root.tsx index 720ce741..8374c37f 100644 --- a/src/root.tsx +++ b/src/root.tsx @@ -1,9 +1,8 @@ // @refresh reload -import { Body, FileRoutes, Head, Html, Link, Meta, Scripts } from 'solid-start' +import { Body, FileRoutes, Head, Html, Link, Meta, Scripts, Title } from 'solid-start' import { ErrorBoundary } from 'solid-start/error-boundary' import { Routes } from '@solidjs/router' import { Suspense } from 'solid-js' -import { ssr } from 'solid-js/web' import './assets/global.css' import { ThemeProvider } from '@context/theme' diff --git a/vercel.json b/vercel.json deleted file mode 100644 index 5a384b64..00000000 --- a/vercel.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "headers": [ - { - "source": "/manifest.webmanifest", - "headers": [ - { - "key": "Content-Type", - "value": "application/manifest+json" - } - ] - } - ], - "build": { - "env": { - "ENABLE_VC_BUILD": "1" - } - } -} diff --git a/vite.config.ts b/vite.config.ts index 3cb0c925..fe5ff768 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,7 +3,7 @@ import { defineConfig } from 'vite' import { configDefaults } from 'vitest/config' import solid from 'solid-start/vite' // @ts-ignore -import vercel from 'solid-start-vercel' +import deno from 'solid-start-deno' import tsconfigPaths from 'vite-tsconfig-paths' import { VitePWA } from 'vite-plugin-pwa' import replace, {RollupReplaceOptions} from '@rollup/plugin-replace' @@ -49,7 +49,7 @@ export default defineConfig({ ...configDefaults, }, plugins: [ - solid({ adapter: vercel() }), + solid({ adapter: deno() }), tsconfigPaths(), AutoImport({ imports: [