diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index 4d3d97a7..50d86a5c 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -82,31 +82,28 @@ jobs: with: role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }} aws-region: ${{ secrets.AWS_REGION }} - - name: install sst - run: | - curl -fsSL https://ion.sst.dev/install | VERSION=0.1.51 bash - name: set sst stage id: get_branch_name run: | BRANCH_NAME=${{ github.event.pull_request.head.ref }} SANITIZED_BRANCH_NAME=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9]/-/g') - echo "SS_STAGE=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT + echo "SST_STAGE=$SANITIZED_BRANCH_NAME" >> $GITHUB_OUTPUT - name: install dependencies run: npm install - name: build application run: npm run build - name: configure sst secrets run: | - sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} && - sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} && - sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} && - sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} --stage ${{ steps.get_branch_name.outputs.SS_STAGE }} + sst secret set PartnerId ${{ secrets.PREVIEW_PARTNER_ID }} --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} && + sst secret set CallbackUrl ${{ secrets.PREVIEW_CALLBACK_URL }} --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} && + sst secret set SmileIdApiKey ${{ secrets.PREVIEW_SMILEID_API_KEY }} --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} && + sst secret set SmileIdEnvironment ${{ secrets.PREVIEW_SMILEID_ENVIRONMENT }} --stage ${{ steps.get_branch_name.outputs.SST_STAGE }} - name: deploy sst app if: github.event.pull_request.merged != true id: deploy_sst_app run: | - sst deploy --stage=${{ steps.get_branch_name.outputs.SS_STAGE }} + sst deploy --stage=${{ steps.get_branch_name.outputs.SST_STAGE }} - name: remove sst app if: github.event.pull_request.merged == true run: | - sst remove --stage=${{ steps.get_branch_name.outputs.SS_STAGE }} + sst remove --stage=${{ steps.get_branch_name.outputs.SST_STAGE }} diff --git a/previews/app/routes/products.$productName.tsx b/previews/app/routes/products.$productName.tsx index 4a479c17..ee6b826f 100644 --- a/previews/app/routes/products.$productName.tsx +++ b/previews/app/routes/products.$productName.tsx @@ -1,12 +1,12 @@ import type { LoaderFunctionArgs } from '@remix-run/node'; import { useLoaderData } from '@remix-run/react'; -import { useState, useEffect } from 'react'; +import { useState } from 'react'; import { Resource } from 'sst'; import products from '~/data/products.json'; declare global { interface Window { - SmileIdentity: Function; + SmileIdentity: function; } } @@ -83,7 +83,7 @@ export default function Product() { ...config, document_ids: [config.document_id], document_capture_modes: ( - (config.document_capture_modes as String) ?? '' + (config.document_capture_modes as string) ?? '' ).split(','), partner_details: { partner_id: config.partner_id, diff --git a/previews/default_app/entry.client.tsx b/previews/default_app/entry.client.tsx deleted file mode 100644 index 3f01ce18..00000000 --- a/previews/default_app/entry.client.tsx +++ /dev/null @@ -1,18 +0,0 @@ -/** - * By default, Remix will handle hydrating your app on the client for you. - * You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ - * For more information, see https://remix.run/file-conventions/entry.client - */ - -import { RemixBrowser } from '@remix-run/react'; -import { startTransition, StrictMode } from 'react'; -import { hydrateRoot } from 'react-dom/client'; - -startTransition(() => { - hydrateRoot( - document, - - - , - ); -}); diff --git a/previews/default_app/entry.server.tsx b/previews/default_app/entry.server.tsx deleted file mode 100644 index dda7030a..00000000 --- a/previews/default_app/entry.server.tsx +++ /dev/null @@ -1,140 +0,0 @@ -/** - * By default, Remix will handle generating the HTTP Response for you. - * You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨ - * For more information, see https://remix.run/file-conventions/entry.server - */ - -import { PassThrough } from 'node:stream'; - -import type { AppLoadContext, EntryContext } from '@remix-run/node'; -import { createReadableStreamFromReadable } from '@remix-run/node'; -import { RemixServer } from '@remix-run/react'; -import { isbot } from 'isbot'; -import { renderToPipeableStream } from 'react-dom/server'; - -const ABORT_DELAY = 5_000; - -export default function handleRequest( - request: Request, - responseStatusCode: number, - responseHeaders: Headers, - remixContext: EntryContext, - // This is ignored so we can keep it in the template for visibility. Feel - // free to delete this parameter in your app if you're not using it! - // eslint-disable-next-line @typescript-eslint/no-unused-vars - loadContext: AppLoadContext, -) { - return isbot(request.headers.get('user-agent') || '') - ? handleBotRequest( - request, - responseStatusCode, - responseHeaders, - remixContext, - ) - : handleBrowserRequest( - request, - responseStatusCode, - responseHeaders, - remixContext, - ); -} - -function handleBotRequest( - request: Request, - responseStatusCode: number, - responseHeaders: Headers, - remixContext: EntryContext, -) { - return new Promise((resolve, reject) => { - let shellRendered = false; - const { pipe, abort } = renderToPipeableStream( - , - { - onAllReady() { - shellRendered = true; - const body = new PassThrough(); - const stream = createReadableStreamFromReadable(body); - - responseHeaders.set('Content-Type', 'text/html'); - - resolve( - new Response(stream, { - headers: responseHeaders, - status: responseStatusCode, - }), - ); - - pipe(body); - }, - onShellError(error: unknown) { - reject(error); - }, - onError(error: unknown) { - responseStatusCode = 500; - // Log streaming rendering errors from inside the shell. Don't log - // errors encountered during initial shell rendering since they'll - // reject and get logged in handleDocumentRequest. - if (shellRendered) { - console.error(error); - } - }, - }, - ); - - setTimeout(abort, ABORT_DELAY); - }); -} - -function handleBrowserRequest( - request: Request, - responseStatusCode: number, - responseHeaders: Headers, - remixContext: EntryContext, -) { - return new Promise((resolve, reject) => { - let shellRendered = false; - const { pipe, abort } = renderToPipeableStream( - , - { - onShellReady() { - shellRendered = true; - const body = new PassThrough(); - const stream = createReadableStreamFromReadable(body); - - responseHeaders.set('Content-Type', 'text/html'); - - resolve( - new Response(stream, { - headers: responseHeaders, - status: responseStatusCode, - }), - ); - - pipe(body); - }, - onShellError(error: unknown) { - reject(error); - }, - onError(error: unknown) { - responseStatusCode = 500; - // Log streaming rendering errors from inside the shell. Don't log - // errors encountered during initial shell rendering since they'll - // reject and get logged in handleDocumentRequest. - if (shellRendered) { - console.error(error); - } - }, - }, - ); - - setTimeout(abort, ABORT_DELAY); - }); -} diff --git a/previews/default_app/root.tsx b/previews/default_app/root.tsx deleted file mode 100644 index e4e0dcee..00000000 --- a/previews/default_app/root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Links, - Meta, - Outlet, - Scripts, - ScrollRestoration, -} from '@remix-run/react'; - -export function Layout({ children }: { children: React.ReactNode }) { - return ( - - - - - - - - - {children} - - - - - ); -} - -export default function App() { - return ; -} diff --git a/previews/default_app/routes/_index.tsx b/previews/default_app/routes/_index.tsx deleted file mode 100644 index 03b5a37f..00000000 --- a/previews/default_app/routes/_index.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { MetaFunction } from '@remix-run/node'; - -export const meta: MetaFunction = () => { - return [ - { title: 'New Remix App' }, - { name: 'description', content: 'Welcome to Remix!' }, - ]; -}; - -export default function Index() { - return ( -
-

Welcome to Remix

- -
- ); -} diff --git a/previews/package-lock.json b/previews/package-lock.json index 6eb824f7..c1887ba6 100644 --- a/previews/package-lock.json +++ b/previews/package-lock.json @@ -14,7 +14,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "smile-identity-core": "^3.1.0", - "sst": "ion" + "sst": "3.0.74" }, "devDependencies": { "@remix-run/dev": "^2.9.2", @@ -3057,11 +3057,6 @@ "node": ">=14.0.0" } }, - "node_modules/@tsconfig/node20": { - "version": "20.1.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node20/-/node20-20.1.4.tgz", - "integrity": "sha512-sqgsT69YFeLWf5NtJ4Xq/xAF8p4ZQHlmGW74Nu2tD4+g5fAsposc4ZfaaPixVu4y01BEiDCWLRDCvDM5JOsRxg==" - }, "node_modules/@types/acorn": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/@types/acorn/-/acorn-4.0.6.tgz", @@ -10526,16 +10521,25 @@ } }, "node_modules/sst": { - "version": "3.0.33", - "resolved": "https://registry.npmjs.org/sst/-/sst-3.0.33.tgz", - "integrity": "sha512-7XLaGcufJ6M1/kfO7Ssd79/LV/KgzV5IFFKQ2Iu6ZWIlMYFH1rrL0TdsW2ZOBvpFM/2K8XKlErz8ZCNCnksQCg==", + "version": "3.0.74", + "resolved": "https://registry.npmjs.org/sst/-/sst-3.0.74.tgz", + "integrity": "sha512-SFZ3T3UmDVw/CZqSgXAO8bU2sbeNinq3fnuK9iKxWCMr0aZCKnEKgiHkhCzZmEz0llLftIWMYEcGOM2CmnA1nw==", "dependencies": { "@aws-sdk/client-lambda": "3.478.0", - "@tsconfig/node20": "^20.1.4", "aws4fetch": "^1.0.18", "jose": "5.2.3", "openid-client": "5.6.4" }, + "bin": { + "sst": "bin/sst.mjs" + }, + "optionalDependencies": { + "sst-darwin-arm64": "3.0.74", + "sst-darwin-x64": "3.0.74", + "sst-linux-arm64": "3.0.74", + "sst-linux-x64": "3.0.74", + "sst-linux-x86": "3.0.74" + }, "peerDependencies": { "hono": "4.x", "valibot": "0.30.x" @@ -10549,6 +10553,66 @@ } } }, + "node_modules/sst-darwin-arm64": { + "version": "3.0.74", + "resolved": "https://registry.npmjs.org/sst-darwin-arm64/-/sst-darwin-arm64-3.0.74.tgz", + "integrity": "sha512-QYgh7oLN4zjPbMmsT9M2IFpDCnMpjpaCz8fpcj769h0o+BKnK0DfUnZJK64FmRtaxiiBd+zWUZmeOJX8L3ma3Q==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/sst-darwin-x64": { + "version": "3.0.74", + "resolved": "https://registry.npmjs.org/sst-darwin-x64/-/sst-darwin-x64-3.0.74.tgz", + "integrity": "sha512-im5/SGbj2XrLkM4Tr5MA8jRoPVUWjdJsTij4QPTf+h9g46GvZPM6HIgTB5nhp5t7dVljlwyxOGsNc/lfLTqBag==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/sst-linux-arm64": { + "version": "3.0.74", + "resolved": "https://registry.npmjs.org/sst-linux-arm64/-/sst-linux-arm64-3.0.74.tgz", + "integrity": "sha512-dNjq909etfEfp/YAG1PZrQT3iuPSCq5Rc/Pf7xf+DFOjOQkPIGXSYxVJEYsQjUFawWCm0b3947pmqoHgxMfIRg==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/sst-linux-x64": { + "version": "3.0.74", + "resolved": "https://registry.npmjs.org/sst-linux-x64/-/sst-linux-x64-3.0.74.tgz", + "integrity": "sha512-LiiBO6M5C4Bml78JRCc/4jlI1Bv5YCaESCd+gnJ021L7y48Zf4g6frSTklqUX7HwCTfDMJ7ogZzfriEKBomwqQ==", + "cpu": [ + "x64" + ], + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/sst-linux-x86": { + "version": "3.0.74", + "resolved": "https://registry.npmjs.org/sst-linux-x86/-/sst-linux-x86-3.0.74.tgz", + "integrity": "sha512-wEGrmNfP+glrRtJ2/keLBRAUxujUJ9W4YXldGKPd3MWdI2ANLvWDZz/4ao1quH6Dm/PzG8f9IjWE2/MvdUBtRA==", + "cpu": [ + "x86" + ], + "optional": true, + "os": [ + "linux" + ] + }, "node_modules/statuses": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", diff --git a/previews/package.json b/previews/package.json index 3bb87dc9..23a80e01 100644 --- a/previews/package.json +++ b/previews/package.json @@ -18,7 +18,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "smile-identity-core": "^3.1.0", - "sst": "ion" + "sst": "3.0.74" }, "devDependencies": { "@remix-run/dev": "^2.9.2", diff --git a/previews/sst.config.ts b/previews/sst.config.ts index eaed049d..0fa2d0a4 100644 --- a/previews/sst.config.ts +++ b/previews/sst.config.ts @@ -1,5 +1,3 @@ -/// - export default $config({ app(input) { return {