mirror of
https://github.com/pnpm/action-setup.git
synced 2026-03-04 08:01:02 +08:00
Compare commits
No commits in common. "7ce3debe10cbecf199af0bfe86044856ec559160" and "1ecf7e8d5f1cef7afb0eebe41854487b9af02015" have entirely different histories.
7ce3debe10
...
1ecf7e8d5f
@ -43,22 +43,14 @@ async function readTarget(opts: {
|
||||
const { version, packageJsonFile, standalone } = opts
|
||||
const { GITHUB_WORKSPACE } = process.env
|
||||
|
||||
let packageManager
|
||||
let packageManager;
|
||||
|
||||
if (GITHUB_WORKSPACE) {
|
||||
try {
|
||||
({ packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8')))
|
||||
} catch (error) {
|
||||
// Swallow error if package.json doesn't exist in root
|
||||
if (error.code !== 'ENOENT') throw error
|
||||
}
|
||||
({ packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8')))
|
||||
}
|
||||
|
||||
if (version) {
|
||||
if (
|
||||
typeof packageManager === 'string' &&
|
||||
packageManager.replace('pnpm@', '') !== version
|
||||
) {
|
||||
if (typeof packageManager === 'string') {
|
||||
throw new Error(`Multiple versions of pnpm specified:
|
||||
- version ${version} in the GitHub Action config with the key "version"
|
||||
- version ${packageManager} in the package.json with the key "packageManager"
|
||||
@ -86,7 +78,7 @@ Please specify it by one of the following ways:
|
||||
throw new Error('Invalid packageManager field in package.json')
|
||||
}
|
||||
|
||||
if (standalone) {
|
||||
if (standalone){
|
||||
return packageManager.replace('pnpm@', '@pnpm/exe@')
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user