mirror of
https://github.com/pnpm/action-setup.git
synced 2026-03-01 07:51:02 +08:00
fix: use JSON parser for package.json instead of JSON5
This commit is contained in:
parent
bfbaba77ef
commit
be2217eb08
@ -65,7 +65,9 @@ async function readTarget(opts: {
|
|||||||
const content = readFileSync(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8');
|
const content = readFileSync(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8');
|
||||||
({ packageManager } = packageJsonFile.endsWith(".yaml")
|
({ packageManager } = packageJsonFile.endsWith(".yaml")
|
||||||
? YAML.parse(content, { merge: true })
|
? YAML.parse(content, { merge: true })
|
||||||
: JSON5.parse(content)
|
: packageJsonFile.endsWith(".json5")
|
||||||
|
? JSON5.parse(content)
|
||||||
|
: JSON.parse(content)
|
||||||
)
|
)
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
// Swallow error if package.json doesn't exist in root
|
// Swallow error if package.json doesn't exist in root
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user