Skip to content

Commit

Permalink
feat: remove cross-env if pnpm is used
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Nov 7, 2024
1 parent 3c1526a commit 2f297bb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
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

0 comments on commit 2f297bb

Please sign in to comment.