mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-18 04:28:28 +02:00
feat: read engines from package.json
closes https://github.com/oven-sh/setup-bun/issues/115
This commit is contained in:
parent
34f777aec1
commit
b7ad40d98c
1 changed files with 4 additions and 2 deletions
|
@ -28,8 +28,10 @@ export function addExtension(path: string, ext: string): string {
|
||||||
}
|
}
|
||||||
|
|
||||||
const FILE_VERSION_READERS = {
|
const FILE_VERSION_READERS = {
|
||||||
"package.json": (content: string) =>
|
"package.json": (content: string) => {
|
||||||
JSON.parse(content).packageManager?.split("bun@")?.[1],
|
const pkg = JSON.parse(content);
|
||||||
|
return pkg.packageManager?.split("bun@")?.[1] ?? pkg.engines?.bun;
|
||||||
|
},
|
||||||
".tool-versions": (content: string) =>
|
".tool-versions": (content: string) =>
|
||||||
content.match(/^bun\s*(?<version>.*?)$/m)?.groups?.version,
|
content.match(/^bun\s*(?<version>.*?)$/m)?.groups?.version,
|
||||||
".bumrc": (content: string) => content, // https://github.com/owenizedd/bum
|
".bumrc": (content: string) => content, // https://github.com/owenizedd/bum
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue