Skip to content

Commit f09eb1e

Browse files
authoredDec 9, 2024··
fix: make bun resolve to given file path when an absolute path is given (#114)
* Make bun resolve to single file path when an absolute path is given * Update test not to use the workspace folder
1 parent 8f1bc2e commit f09eb1e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎.github/workflows/test.yml

+4
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ jobs:
8585
file: package.json
8686
run: |
8787
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > package.json
88+
- name: /foo/package.json (bun@1.1.0)
89+
file: /foo/package.json
90+
run: |
91+
echo "$(jq '. += {"packageManager": "bun@1.1.0"}' package.json)" > /foo/package.json
8892
- name: package.json (yarn@bun@1.1.0)
8993
file: package.json
9094
run: |

‎src/utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { debug, warning } from "@actions/core";
22
import { info } from "node:console";
33
import { existsSync, readFileSync, renameSync } from "node:fs";
4-
import { join, basename } from "node:path";
4+
import { resolve, basename } from "node:path";
55

66
export function retry<T>(
77
fn: () => Promise<T>,
@@ -48,7 +48,7 @@ export function readVersionFromFile(file: string): string | undefined {
4848

4949
debug(`Reading version from ${file}`);
5050

51-
const path = join(cwd, file);
51+
const path = resolve(cwd, file);
5252
const base = basename(file);
5353

5454
if (!existsSync(path)) {

0 commit comments

Comments
 (0)
Please sign in to comment.