From d128f68cdaa7c7afe45ba10d825bd355488d4de5 Mon Sep 17 00:00:00 2001 From: Logan McAnsh Date: Tue, 31 Jan 2023 23:39:32 -0500 Subject: [PATCH] chore: get this mostly working... Signed-off-by: Logan McAnsh --- .gitignore | 3 +- __scripts/test.mjs | 92 +- _official-blog-tutorial/tsconfig.json | 2 + _official-jokes/app/routes/login.tsx | 3 +- basic/app/routes/demos/params/$id.tsx | 1 + .../app/components/complex-component.tsx | 2 +- combobox-resource-route/package.json | 2 +- emotion/app/entry.server.tsx | 2 +- firebase/package.json | 2 +- graphql-api/app/routes/character/$id.tsx | 3 +- graphql-api/app/routes/character/error.tsx | 4 +- graphql-api/app/routes/index.tsx | 2 +- image-resize/app/components/image.tsx | 3 +- .../app/utils/backend.server.ts | 9 + leaflet/package.json | 6 +- mantine/app/entry.server.tsx | 2 + nprogress/package.json | 2 +- .../routes/dashboard/projects/$projectId.tsx | 5 + .../projects/$projectId/list/$listId.tsx | 1 + pm-app/app/routes/dashboard/projects/new.tsx | 43 +- .../dashboard/todo-lists/$listId/index.tsx | 1 + .../app/routes/dashboard/todo-lists/new.tsx | 2 + pm-app/app/routes/sign-in.tsx | 1 + pm-app/app/ui/button.tsx | 2 + pm-app/app/ui/link.tsx | 3 + quirrel/package.json | 2 +- .../app/components/textEditor.client.tsx | 2 +- react-quill/package.json | 3 +- .../app/sessions/upstash.server.ts | 3 +- remix-auth-supabase-github/app/auth.server.ts | 2 + remix-auth-supabase/app/auth.server.ts | 1 + route-modal/app/routes/invoices/$id/edit.tsx | 20 +- route-modal/app/routes/invoices/add.tsx | 29 +- rust/README.md | 2 +- rust/package.json | 3 +- sanity/app/root.tsx | 8 +- sanity/package.json | 2 +- socket.io/package.json | 2 +- stitches/app/entry.server.tsx | 1 + strapi/package.json | 1 - .../app/routes/api/stripe-web-hook.tsx | 1 + .../app/utils/stripe.server.tsx | 1 + styled-components/app/entry.server.tsx | 1 + styletron/app/entry.server.tsx | 1 + supabase-subscription/app/routes/realtime.tsx | 2 +- theme-ui/app/entry.client.tsx | 4 +- theme-ui/app/root.tsx | 4 +- theme-ui/package.json | 4 +- theme-ui/tsconfig.json | 1 + turborepo-vercel/packages/ui/tsconfig.json | 4 +- twind/app/entry.server.tsx | 2 + xata/app/routes/index.tsx | 4 +- yarn-pnp/package.json | 6 +- yarn-pnp/yarn.lock | 7823 +++++++++++++++++ yarn.lock | 502 +- 55 files changed, 8249 insertions(+), 390 deletions(-) create mode 100644 yarn-pnp/yarn.lock diff --git a/.gitignore b/.gitignore index b57c85441..fde832d35 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ yarn.lock pnpm-lock.yaml pnpm-lock.yml -!./yarn.lock +!/yarn.lock +!yarn-pnp/yarn.lock diff --git a/__scripts/test.mjs b/__scripts/test.mjs index cf6171ced..5dad8af30 100755 --- a/__scripts/test.mjs +++ b/__scripts/test.mjs @@ -5,13 +5,13 @@ import os from "node:os"; import { execa } from "execa"; import { detect, getCommand } from "@antfu/ni"; -import PackageJson from "@npmcli/package-json"; import fse from "fs-extra"; import PQueue from "p-queue"; +import PackageJson from "@npmcli/package-json"; console.log({ concurrency: os.cpus().length }); -const queue = new PQueue({ concurrency: os.cpus().length }); +const queue = new PQueue({ concurrency: os.cpus().length, autoStart: false }); const TO_IGNORE = [".git", ".github", "__scripts", "yarn.lock", "package.json"]; @@ -40,9 +40,7 @@ if (process.env.CI) { .filter((entry) => entry.isDirectory()) .filter((entry) => !TO_IGNORE.includes(entry.name)) .map((entry) => entry.name) - .filter((entry) => { - return fse.existsSync(path.join(entry, "package.json")); - }); + .filter((entry) => fse.existsSync(path.join(entry, "package.json"))); } const list = new Intl.ListFormat("en", { style: "long", type: "conjunction" }); @@ -53,43 +51,47 @@ for (const example of examples) { queue.add(async () => { const pkgJson = await PackageJson.load(example); - const remixDeps = Object.keys(pkgJson.content.dependencies).filter((d) => { - return d.startsWith("@remix-run/"); - }); - - const remixDevDeps = Object.keys(pkgJson.content.devDependencies).filter( - (d) => { - return d.startsWith("@remix-run/"); - } - ); - + // TODO: figure out why this is blowing up pkgJson.update({ dependencies: { ...pkgJson.content.dependencies, - ...Object.fromEntries(remixDeps.map((d) => [d, `latest`])), - }, - devDependencies: { - ...pkgJson.content.devDependencies, - ...Object.fromEntries(remixDevDeps.map((d) => [d, `latest`])), + "@vanilla-extract/css": "1.9.2", }, }); await pkgJson.save(); /** @type {import('execa').Options} */ - const options = { cwd: example }; + const options = { cwd: example, reject: false }; + // detect package manager const detected = await detect({ cwd: example }); - const install = await getCommand(detected, "install", ["--silent"]); + const hasSetup = !!pkgJson.content.scripts?.__setup; + + if (hasSetup) { + const setup = await getCommand(detected, "run", ["__setup"]); + const setupArgs = setup.split(" ").slice(1); + console.log("🔧 Running setup script for", example); + const setupResult = await execa(detected, setupArgs, options); + if (setupResult.exitCode) { + console.error(setupResult.stderr); + throw new Error(`Error running setup script for ${example}`); + } + } + + const install = await getCommand(detected, "install", [ + "--silent", + "--legacy-peer-deps", + ]); + // this is silly, but is needed in order for execa to work const installArgs = install.split(" ").slice(1, -1); - console.log(`📥 Installing ${example} with ${install}`); + console.log(`📥 Installing ${example} with "${install}"`); const installResult = await execa(detected, installArgs, options); if (installResult.exitCode) { - console.error(`Error installing ${example}`); console.error(installResult.stderr); - return; + throw new Error(`Error installing ${example}`); } const hasPrisma = fse.existsSync( @@ -105,56 +107,34 @@ for (const example of examples) { ); if (prismaGenerate.exitCode) { - console.error(`Error generating prisma types for ${example}`); console.error(prismaGenerate.stderr); - return; + throw new Error(`Error generating prisma types for ${example}`); } } const build = await getCommand(detected, "run", ["build"]); const buildArgs = build.split(" ").slice(1); - console.log(`📦 Building ${example} with ${build}`); + console.log(`📦 Building ${example} with "${build}"`); const buildResult = await execa(detected, buildArgs, options); if (buildResult.exitCode) { - console.error(`Error building ${example}`); console.error(buildResult.stderr); - return; + throw new Error(`Error building ${example}`); } const typecheck = await getCommand(detected, "run", ["typecheck"]); const typecheckArgs = typecheck.split(" ").slice(1); - console.log(`🕵️ Typechecking ${example} with ${typecheck}`); + console.log(`🕵️ Typechecking ${example} with "${typecheck}"`); const typecheckResult = await execa(detected, typecheckArgs, options); if (typecheckResult.exitCode) { - console.error(`Error typechecking ${example}`); console.error(typecheckResult.stderr); - return; + throw new Error(`Error typechecking ${example}`); } - - pkgJson.update({ - dependencies: { - ...pkgJson.content.dependencies, - ...Object.fromEntries(remixDeps.map((d) => [d, `*`])), - }, - devDependencies: { - ...pkgJson.content.devDependencies, - ...Object.fromEntries(remixDevDeps.map((d) => [d, `*`])), - }, - }); - - await pkgJson.save(); }); } -try { - queue.start(); -} catch (error) { - console.error(error); - process.exit(1); -} - -// const rejected = promises.filter((s) => s.status === "rejected"); -// rejected.forEach((s) => console.error(s.reason)); -// process.exit(rejected.length > 0 ? 1 : 0); +queue.start(); +queue.on("error", (error) => { + console.error("🚨", error); +}); diff --git a/_official-blog-tutorial/tsconfig.json b/_official-blog-tutorial/tsconfig.json index 9bacef832..39808a96f 100644 --- a/_official-blog-tutorial/tsconfig.json +++ b/_official-blog-tutorial/tsconfig.json @@ -2,6 +2,8 @@ "exclude": ["./cypress", "./cypress.config.ts"], "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"], "compilerOptions": { + "allowJs": true, + "forceConsistentCasingInFileNames": true, "lib": ["DOM", "DOM.Iterable", "ES2019"], "types": ["vitest/globals"], "isolatedModules": true, diff --git a/_official-jokes/app/routes/login.tsx b/_official-jokes/app/routes/login.tsx index a64402bb3..24116e3bd 100644 --- a/_official-jokes/app/routes/login.tsx +++ b/_official-jokes/app/routes/login.tsx @@ -27,7 +27,8 @@ function validatePassword(password: unknown) { } } -function validateUrl(url: string) { +function validateUrl(url: FormDataEntryValue) { + if (typeof url !== "string") return; const urls = ["/jokes", "/", "https://remix.run"]; if (urls.includes(url)) { return url; diff --git a/basic/app/routes/demos/params/$id.tsx b/basic/app/routes/demos/params/$id.tsx index 0c16fb95b..adf3260b8 100644 --- a/basic/app/routes/demos/params/$id.tsx +++ b/basic/app/routes/demos/params/$id.tsx @@ -29,6 +29,7 @@ export const loader = async ({ params }: LoaderArgs) => { // Sometimes your code just blows up and you never anticipated it. Remix will // automatically catch it and send the UI to the error boundary. if (params.id === "kaboom") { + // @ts-expect-error lol(); } diff --git a/client-only-components/app/components/complex-component.tsx b/client-only-components/app/components/complex-component.tsx index c1ce4cc15..a6270f5ee 100644 --- a/client-only-components/app/components/complex-component.tsx +++ b/client-only-components/app/components/complex-component.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; export function ComplexComponent() { - const [count, setCount] = useState(() => { + const [count, setCount] = useState(() => { const stored = localStorage.getItem("count"); if (!stored) return 0; return JSON.parse(stored); diff --git a/combobox-resource-route/package.json b/combobox-resource-route/package.json index 89075dc0f..649c12153 100644 --- a/combobox-resource-route/package.json +++ b/combobox-resource-route/package.json @@ -12,8 +12,8 @@ "@remix-run/node": "~1.14.2", "@remix-run/react": "~1.14.2", "@remix-run/serve": "~1.14.2", - "match-sorter": "^6.3.1", "isbot": "^3.6.5", + "match-sorter": "^6.3.1", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/emotion/app/entry.server.tsx b/emotion/app/entry.server.tsx index b4a28d3f4..f665406c8 100644 --- a/emotion/app/entry.server.tsx +++ b/emotion/app/entry.server.tsx @@ -11,7 +11,7 @@ export default function handleRequest( request: Request, responseStatusCode: number, responseHeaders: Headers, - remixContext: EntryContext + remixContext: any ) { const cache = createEmotionCache(); const { extractCriticalToChunks } = createEmotionServer(cache); diff --git a/firebase/package.json b/firebase/package.json index e13e6b6ca..91f1a8d55 100644 --- a/firebase/package.json +++ b/firebase/package.json @@ -30,6 +30,6 @@ "typescript": "^4.8.4" }, "engines": { - "node": "16" + "node": ">=16" } } diff --git a/graphql-api/app/routes/character/$id.tsx b/graphql-api/app/routes/character/$id.tsx index 74fad2027..5fefda6a5 100644 --- a/graphql-api/app/routes/character/$id.tsx +++ b/graphql-api/app/routes/character/$id.tsx @@ -21,8 +21,7 @@ export const loader = async ({ params }: LoaderArgs) => { * the Remix loader & route params. */ export default function Character() { - const loader = useLoaderData(); - const { data } = loader; + const { data } = useLoaderData(); const character = data.character; diff --git a/graphql-api/app/routes/character/error.tsx b/graphql-api/app/routes/character/error.tsx index 0e2a88d1a..c385e6512 100644 --- a/graphql-api/app/routes/character/error.tsx +++ b/graphql-api/app/routes/character/error.tsx @@ -43,12 +43,12 @@ export const loader = async () => { * an array of errors coming back from the GraphQL API. */ export default function CharacterError() { - const loader = useLoaderData(); + const data = useLoaderData(); return (

Ex: GraphQL Error

- +

Uh oh, we've intentionally triggered an error, expand the details above to see what's going on. diff --git a/graphql-api/app/routes/index.tsx b/graphql-api/app/routes/index.tsx index 6e9fcb42e..994dcfb39 100644 --- a/graphql-api/app/routes/index.tsx +++ b/graphql-api/app/routes/index.tsx @@ -27,7 +27,7 @@ export default function Index() { above to see what the Remix loader returned.


- {characters.map((character) => { + {characters.map((character: any) => { if (!character) return null; const { image } = character; diff --git a/image-resize/app/components/image.tsx b/image-resize/app/components/image.tsx index efdcb890f..a117386a1 100644 --- a/image-resize/app/components/image.tsx +++ b/image-resize/app/components/image.tsx @@ -6,8 +6,9 @@ export interface ImageProps extends React.ComponentPropsWithRef<"img"> { width?: number; // either width or height is required height?: number; fit?: keyof FitEnum; // contain is default - alt: string; + alt?: string; } + export const Image = forwardRef( ({ children, width, height, fit, src, alt = "", ...other }, forwardedRef) => { const query = new URLSearchParams(); diff --git a/infinite-scrolling/app/utils/backend.server.ts b/infinite-scrolling/app/utils/backend.server.ts index afd821a7d..55d263320 100644 --- a/infinite-scrolling/app/utils/backend.server.ts +++ b/infinite-scrolling/app/utils/backend.server.ts @@ -1,3 +1,12 @@ +interface Item { + id: string; + value: string; +} + +declare global { + var __items: Item[]; +} + const items = (global.__items = global.__items ?? Array.from({ length: 50_000 }, (_, i) => ({ diff --git a/leaflet/package.json b/leaflet/package.json index 922e6710f..36b00c3dd 100644 --- a/leaflet/package.json +++ b/leaflet/package.json @@ -11,11 +11,11 @@ "@remix-run/node": "~1.14.2", "@remix-run/react": "~1.14.2", "@remix-run/serve": "~1.14.2", - "leaflet": "^1.8.0", - "react-leaflet": "^4.0.2", "isbot": "^3.6.5", + "leaflet": "^1.8.0", "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "react-leaflet": "^4.0.2" }, "devDependencies": { "@remix-run/dev": "~1.14.2", diff --git a/mantine/app/entry.server.tsx b/mantine/app/entry.server.tsx index e74f9d0a6..8fb5a1c28 100644 --- a/mantine/app/entry.server.tsx +++ b/mantine/app/entry.server.tsx @@ -41,6 +41,7 @@ const handleBotRequest = ( const { pipe, abort } = renderToPipeableStream( injectStylesIntoStaticMarkup( + // @ts-expect-error ), { @@ -83,6 +84,7 @@ const handleBrowserRequest = ( const { pipe, abort } = renderToPipeableStream( injectStylesIntoStaticMarkup( + // @ts-expect-error ), { diff --git a/nprogress/package.json b/nprogress/package.json index ad17b0033..18ac0cf82 100644 --- a/nprogress/package.json +++ b/nprogress/package.json @@ -11,8 +11,8 @@ "@remix-run/node": "~1.14.2", "@remix-run/react": "~1.14.2", "@remix-run/serve": "~1.14.2", - "nprogress": "^0.2.0", "isbot": "^3.6.5", + "nprogress": "^0.2.0", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/pm-app/app/routes/dashboard/projects/$projectId.tsx b/pm-app/app/routes/dashboard/projects/$projectId.tsx index dae5a64a5..5c1726053 100644 --- a/pm-app/app/routes/dashboard/projects/$projectId.tsx +++ b/pm-app/app/routes/dashboard/projects/$projectId.tsx @@ -296,12 +296,15 @@ export default function ProjectRoute() { @@ -387,7 +390,9 @@ export default function ProjectRoute() { diff --git a/pm-app/app/routes/dashboard/projects/$projectId/list/$listId.tsx b/pm-app/app/routes/dashboard/projects/$projectId/list/$listId.tsx index b4eb4d7ae..56b84c849 100644 --- a/pm-app/app/routes/dashboard/projects/$projectId/list/$listId.tsx +++ b/pm-app/app/routes/dashboard/projects/$projectId/list/$listId.tsx @@ -117,6 +117,7 @@ function TodoListRoute() { const fetchers = useFetchers(); const taskFetcherMap = new Map(); + // @ts-expect-error const allTodos: Todo[] = todoList.todos; for (const fetcher of fetchers) { if (fetcher.type === "actionSubmission") { diff --git a/pm-app/app/routes/dashboard/projects/new.tsx b/pm-app/app/routes/dashboard/projects/new.tsx index 79aafe16c..212698942 100644 --- a/pm-app/app/routes/dashboard/projects/new.tsx +++ b/pm-app/app/routes/dashboard/projects/new.tsx @@ -98,7 +98,7 @@ export const action = async ({ request }: ActionArgs) => { function NewProject() { const { allUsers, user } = useLoaderData(); - const { fieldErrors, fields, formError } = useActionData(); + const actionData = useActionData(); const selectableUsers = React.useMemo(() => { return allUsers.filter((u) => u.id !== user.id); @@ -130,10 +130,14 @@ function NewProject() {
- {formError ? ( + {actionData && "formError" in actionData && actionData.formError ? (
@@ -162,10 +174,20 @@ function NewProject() { -