-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add npmrc support check for Bun package manager (fixes: #93)
This commit introduces a check to determine if the Bun package manager supports npmrc. If the version of Bun is 1.1.18 or higher, it is considered to support npmrc. This information is used to decide whether to create a bunfig.toml file or not. The tests have been updated accordingly to check for either bunfig.toml or .npmrc based on the version of Bun.
- Loading branch information
Showing
4 changed files
with
42 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import * as kl from "kolorist"; | |
import { | ||
DenoJson, | ||
enableYarnBerry, | ||
isBunSupportNpmrc, | ||
isDirectory, | ||
isFile, | ||
runInTempDir, | ||
|
@@ -443,8 +444,17 @@ describe("install", () => { | |
"bun lockfile not created", | ||
); | ||
|
||
const config = await readTextFile(path.join(dir, "bunfig.toml")); | ||
assert.match(config, /"@jsr"\s+=/, "bunfig.toml not created"); | ||
if (await isBunSupportNpmrc(dir)) { | ||
const npmrcPath = path.join(dir, ".npmrc"); | ||
const npmRc = await readTextFile(npmrcPath); | ||
assert.ok( | ||
npmRc.includes("@jsr:registry=https://npm.jsr.io"), | ||
"Missing npmrc registry", | ||
); | ||
} else { | ||
const config = await readTextFile(path.join(dir, "bunfig.toml")); | ||
assert.match(config, /"@jsr"\s+=/, "bunfig.toml not created"); | ||
} | ||
}, | ||
); | ||
}); | ||
|
@@ -453,8 +463,18 @@ describe("install", () => { | |
["i", "--bun", "@std/[email protected]"], | ||
async (dir) => { | ||
await runJsr(["i", "--bun", "@std/[email protected]"], dir); | ||
const config = await readTextFile(path.join(dir, "bunfig.toml")); | ||
assert.match(config, /"@jsr"\s+=/, "bunfig.toml not created"); | ||
|
||
if (await isBunSupportNpmrc(dir)) { | ||
const npmrcPath = path.join(dir, ".npmrc"); | ||
const npmRc = await readTextFile(npmrcPath); | ||
assert.ok( | ||
npmRc.includes("@jsr:registry=https://npm.jsr.io"), | ||
"Missing npmrc registry", | ||
); | ||
} else { | ||
const config = await readTextFile(path.join(dir, "bunfig.toml")); | ||
assert.match(config, /"@jsr"\s+=/, "bunfig.toml not created"); | ||
} | ||
}, | ||
); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters