Skip to content

Commit

Permalink
fix: deno implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
yassilah committed Oct 22, 2024
1 parent 6b88bf5 commit 678a063
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ export async function addDependency(

if (resolvedOptions.packageManager.name === "deno") {
for (let i = 0; i < names.length; i++) {
if (!/^.*?:.+$/.test(names[i])) {
console.info(
`No prefix found for ${names[i]}. Defaulting to "npm:${names[i]}".`,
);
if (!/^(npm|jsr|file):.+$/.test(names[i])) {
names[i] = `npm:${names[i]}`;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ export async function detectPackageManager(
resolve(cwd || "."),
async (path) => {
// 1. Use `packageManager` field from package.json / deno.json
const denoJSONPath = join(path, "deno.json");
if (existsSync(denoJSONPath)) {
return packageManagers.find((pm) => pm.name === "deno");
}

if (!options.ignorePackageJSON) {
const packageJSONPath = join(path, "package.json");
if (existsSync(packageJSONPath)) {
Expand All @@ -114,6 +109,11 @@ export async function detectPackageManager(
};
}
}

const denoJSONPath = join(path, "deno.json");
if (existsSync(denoJSONPath)) {
return packageManagers.find((pm) => pm.name === "deno");
}
}

// 2. Use implicit file detection
Expand Down

0 comments on commit 678a063

Please sign in to comment.