Skip to content

Commit

Permalink
Use switch/case to parse corepack
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecrs committed Feb 23, 2024
1 parent afe2e3b commit 6eefdb6
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 6 deletions.
35 changes: 35 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 22 additions & 6 deletions src/utils/devenv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,28 @@ export default async function(dir: Path) {
if (match) {
const { pkg, version } = match.groups as { pkg: string, version: string };

node = {
dependencies: {
...(pkg === 'npm' && { 'npmjs.com': version }),
...(pkg === 'yarn' && { 'yarnpkg.com': version }),
...(pkg === 'pnpm' && { 'pnpm.io': version }),
},
switch (pkg) {
case 'npm':
node = {
dependencies: {
'npmjs.com': version,
},
};
break;
case 'yarn':
node = {
dependencies: {
'yarnpkg.com': version,
},
};
break;
case 'pnpm':
node = {
dependencies: {
'pnpm.io': version,
},
};
break;
};
}
}
Expand Down

0 comments on commit 6eefdb6

Please sign in to comment.