Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

feat: remove cross-env if pnpm is used #305

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
shell-emulator=true
legacy-peer-deps=true
15 changes: 13 additions & 2 deletions remix.init/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ const cleanupCypressFiles = ({ fileEntries, packageManager }) =>
return [fs.writeFile(filePath, newContent)];
});

const cleanupScriptsForPnpm = (scripts) =>
Object.fromEntries(
Object.entries(scripts).map(([key, value]) => [
key,
value.replace("cross-env ", ""),
]),
);

const escapeRegExp = (string) =>
// $& means the whole matched string
string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
Expand Down Expand Up @@ -88,15 +96,18 @@ const updatePackageJson = ({ APP_NAME, packageJson, packageManager }) => {
devDependencies:
packageManager.name === "bun"
? removeUnusedDependencies(devDependencies, ["tsx"])
: devDependencies,
: packageManager.name === "pnpm"
? removeUnusedDependencies(devDependencies, ["cross-env"])
: devDependencies,
prisma: {
...prisma,
seed:
packageManager.name === "bun"
? prismaSeed.replace("tsx", "bun")
: prismaSeed,
},
scripts,
scripts:
packageManager.name === "pnpm" ? cleanupScriptsForPnpm(scripts) : scripts,
});
};

Expand Down