Skip to content

Commit 591425b

Browse files
fix: correct dependency installs and package removals for hydration
I know I should file issues for these but I'm tired.
1 parent a2fc03a commit 591425b

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
1-
import { execaCommand } from "execa";
1+
import fs from "node:fs/promises";
22

3-
const ignoreGlobs = [
3+
const globPaths = [
4+
...extensions(".babelrc", "cjs", "cts", "js", "json", "mjs"),
5+
...extensions(".eslintrc", "js", "json", "yml"),
6+
...extensions(".prettierrc", "json", "json5", "yaml", "yml"),
7+
...extensions("babel.config", "cjs", "cts", "js", "json", "mjs"),
8+
...extensions("jest.config", "cjs", "js", "json", "mjs", "ts"),
49
"./src/**/*.js",
5-
".eslintrc.j*",
10+
".babelrc",
611
".npmignore",
7-
".prettierrc.*",
8-
"babel.*",
912
"CODE_OF_CONDUCT.md",
1013
"CONTRIBUTING.md",
1114
"DEVELOPMENT.md",
1215
"dist",
13-
"jest.*",
1416
"lib",
1517
"package-lock.json",
1618
"yarn.lock",
1719
];
1820

21+
function extensions(base: string, ...extensions: string[]) {
22+
return extensions.map((extension) => [base, extension].join("."));
23+
}
24+
1925
export async function clearUnnecessaryFiles() {
20-
try {
21-
await execaCommand(
22-
`rm -rf ${ignoreGlobs.map((glob) => `"${glob}"`).join(" ")}`
23-
);
24-
} catch {
25-
// (we ignore failures if nothing matched)
26+
for (const globPath of globPaths) {
27+
await fs.rm(globPath, { force: true, recursive: true });
2628
}
2729
}

src/hydrate/steps/finalizeDependencies.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ export async function finalizeDependencies({
5555
}
5656

5757
for (const command of [
58-
`pnpm add ${devDependencies.join(" ")} -D`,
58+
`pnpm add ${devDependencies.map(atLatest).join(" ")} -D`,
5959
`npx all-contributors generate`,
6060
`pnpm uninstall all-contributors-cli -D`,
6161
"pnpm run format:write",
6262
]) {
63-
await execaCommand(command);
63+
await execaCommand(command, { stdio: "inherit" });
6464
}
6565
}
66+
67+
const atLatest = (packageName: string) => `${packageName}@latest`;

0 commit comments

Comments
 (0)