Skip to content

Commit d128f68

Browse files
committed
chore: get this mostly working...
Signed-off-by: Logan McAnsh <[email protected]>
1 parent dae9232 commit d128f68

File tree

55 files changed

+8249
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+8249
-390
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ yarn.lock
88
pnpm-lock.yaml
99
pnpm-lock.yml
1010

11-
!./yarn.lock
11+
!/yarn.lock
12+
!yarn-pnp/yarn.lock

__scripts/test.mjs

Lines changed: 36 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import os from "node:os";
55

66
import { execa } from "execa";
77
import { detect, getCommand } from "@antfu/ni";
8-
import PackageJson from "@npmcli/package-json";
98
import fse from "fs-extra";
109
import PQueue from "p-queue";
10+
import PackageJson from "@npmcli/package-json";
1111

1212
console.log({ concurrency: os.cpus().length });
1313

14-
const queue = new PQueue({ concurrency: os.cpus().length });
14+
const queue = new PQueue({ concurrency: os.cpus().length, autoStart: false });
1515

1616
const TO_IGNORE = [".git", ".github", "__scripts", "yarn.lock", "package.json"];
1717

@@ -40,9 +40,7 @@ if (process.env.CI) {
4040
.filter((entry) => entry.isDirectory())
4141
.filter((entry) => !TO_IGNORE.includes(entry.name))
4242
.map((entry) => entry.name)
43-
.filter((entry) => {
44-
return fse.existsSync(path.join(entry, "package.json"));
45-
});
43+
.filter((entry) => fse.existsSync(path.join(entry, "package.json")));
4644
}
4745

4846
const list = new Intl.ListFormat("en", { style: "long", type: "conjunction" });
@@ -53,43 +51,47 @@ for (const example of examples) {
5351
queue.add(async () => {
5452
const pkgJson = await PackageJson.load(example);
5553

56-
const remixDeps = Object.keys(pkgJson.content.dependencies).filter((d) => {
57-
return d.startsWith("@remix-run/");
58-
});
59-
60-
const remixDevDeps = Object.keys(pkgJson.content.devDependencies).filter(
61-
(d) => {
62-
return d.startsWith("@remix-run/");
63-
}
64-
);
65-
54+
// TODO: figure out why this is blowing up
6655
pkgJson.update({
6756
dependencies: {
6857
...pkgJson.content.dependencies,
69-
...Object.fromEntries(remixDeps.map((d) => [d, `latest`])),
70-
},
71-
devDependencies: {
72-
...pkgJson.content.devDependencies,
73-
...Object.fromEntries(remixDevDeps.map((d) => [d, `latest`])),
58+
"@vanilla-extract/css": "1.9.2",
7459
},
7560
});
7661

7762
await pkgJson.save();
7863

7964
/** @type {import('execa').Options} */
80-
const options = { cwd: example };
65+
const options = { cwd: example, reject: false };
8166

67+
// detect package manager
8268
const detected = await detect({ cwd: example });
8369

84-
const install = await getCommand(detected, "install", ["--silent"]);
70+
const hasSetup = !!pkgJson.content.scripts?.__setup;
71+
72+
if (hasSetup) {
73+
const setup = await getCommand(detected, "run", ["__setup"]);
74+
const setupArgs = setup.split(" ").slice(1);
75+
console.log("🔧 Running setup script for", example);
76+
const setupResult = await execa(detected, setupArgs, options);
77+
if (setupResult.exitCode) {
78+
console.error(setupResult.stderr);
79+
throw new Error(`Error running setup script for ${example}`);
80+
}
81+
}
82+
83+
const install = await getCommand(detected, "install", [
84+
"--silent",
85+
"--legacy-peer-deps",
86+
]);
87+
// this is silly, but is needed in order for execa to work
8588
const installArgs = install.split(" ").slice(1, -1);
86-
console.log(`📥 Installing ${example} with ${install}`);
89+
console.log(`📥 Installing ${example} with "${install}"`);
8790
const installResult = await execa(detected, installArgs, options);
8891

8992
if (installResult.exitCode) {
90-
console.error(`Error installing ${example}`);
9193
console.error(installResult.stderr);
92-
return;
94+
throw new Error(`Error installing ${example}`);
9395
}
9496

9597
const hasPrisma = fse.existsSync(
@@ -105,56 +107,34 @@ for (const example of examples) {
105107
);
106108

107109
if (prismaGenerate.exitCode) {
108-
console.error(`Error generating prisma types for ${example}`);
109110
console.error(prismaGenerate.stderr);
110-
return;
111+
throw new Error(`Error generating prisma types for ${example}`);
111112
}
112113
}
113114

114115
const build = await getCommand(detected, "run", ["build"]);
115116
const buildArgs = build.split(" ").slice(1);
116-
console.log(`📦 Building ${example} with ${build}`);
117+
console.log(`📦 Building ${example} with "${build}"`);
117118
const buildResult = await execa(detected, buildArgs, options);
118119

119120
if (buildResult.exitCode) {
120-
console.error(`Error building ${example}`);
121121
console.error(buildResult.stderr);
122-
return;
122+
throw new Error(`Error building ${example}`);
123123
}
124124

125125
const typecheck = await getCommand(detected, "run", ["typecheck"]);
126126
const typecheckArgs = typecheck.split(" ").slice(1);
127-
console.log(`🕵️ Typechecking ${example} with ${typecheck}`);
127+
console.log(`🕵️ Typechecking ${example} with "${typecheck}"`);
128128
const typecheckResult = await execa(detected, typecheckArgs, options);
129129

130130
if (typecheckResult.exitCode) {
131-
console.error(`Error typechecking ${example}`);
132131
console.error(typecheckResult.stderr);
133-
return;
132+
throw new Error(`Error typechecking ${example}`);
134133
}
135-
136-
pkgJson.update({
137-
dependencies: {
138-
...pkgJson.content.dependencies,
139-
...Object.fromEntries(remixDeps.map((d) => [d, `*`])),
140-
},
141-
devDependencies: {
142-
...pkgJson.content.devDependencies,
143-
...Object.fromEntries(remixDevDeps.map((d) => [d, `*`])),
144-
},
145-
});
146-
147-
await pkgJson.save();
148134
});
149135
}
150136

151-
try {
152-
queue.start();
153-
} catch (error) {
154-
console.error(error);
155-
process.exit(1);
156-
}
157-
158-
// const rejected = promises.filter((s) => s.status === "rejected");
159-
// rejected.forEach((s) => console.error(s.reason));
160-
// process.exit(rejected.length > 0 ? 1 : 0);
137+
queue.start();
138+
queue.on("error", (error) => {
139+
console.error("🚨", error);
140+
});

_official-blog-tutorial/tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"exclude": ["./cypress", "./cypress.config.ts"],
33
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
44
"compilerOptions": {
5+
"allowJs": true,
6+
"forceConsistentCasingInFileNames": true,
57
"lib": ["DOM", "DOM.Iterable", "ES2019"],
68
"types": ["vitest/globals"],
79
"isolatedModules": true,

_official-jokes/app/routes/login.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ function validatePassword(password: unknown) {
2727
}
2828
}
2929

30-
function validateUrl(url: string) {
30+
function validateUrl(url: FormDataEntryValue) {
31+
if (typeof url !== "string") return;
3132
const urls = ["/jokes", "/", "https://remix.run"];
3233
if (urls.includes(url)) {
3334
return url;

basic/app/routes/demos/params/$id.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const loader = async ({ params }: LoaderArgs) => {
2929
// Sometimes your code just blows up and you never anticipated it. Remix will
3030
// automatically catch it and send the UI to the error boundary.
3131
if (params.id === "kaboom") {
32+
// @ts-expect-error
3233
lol();
3334
}
3435

client-only-components/app/components/complex-component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useState } from "react";
22

33
export function ComplexComponent() {
4-
const [count, setCount] = useState(() => {
4+
const [count, setCount] = useState<number>(() => {
55
const stored = localStorage.getItem("count");
66
if (!stored) return 0;
77
return JSON.parse(stored);

combobox-resource-route/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"@remix-run/node": "~1.14.2",
1313
"@remix-run/react": "~1.14.2",
1414
"@remix-run/serve": "~1.14.2",
15-
"match-sorter": "^6.3.1",
1615
"isbot": "^3.6.5",
16+
"match-sorter": "^6.3.1",
1717
"react": "^18.2.0",
1818
"react-dom": "^18.2.0"
1919
},

emotion/app/entry.server.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function handleRequest(
1111
request: Request,
1212
responseStatusCode: number,
1313
responseHeaders: Headers,
14-
remixContext: EntryContext
14+
remixContext: any
1515
) {
1616
const cache = createEmotionCache();
1717
const { extractCriticalToChunks } = createEmotionServer(cache);

firebase/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"typescript": "^4.8.4"
3131
},
3232
"engines": {
33-
"node": "16"
33+
"node": ">=16"
3434
}
3535
}

graphql-api/app/routes/character/$id.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ export const loader = async ({ params }: LoaderArgs) => {
2121
* the Remix loader & route params.
2222
*/
2323
export default function Character() {
24-
const loader = useLoaderData<typeof loader>();
25-
const { data } = loader;
24+
const { data } = useLoaderData<typeof loader>();
2625

2726
const character = data.character;
2827

0 commit comments

Comments
 (0)