File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import path from 'path'
6
6
import { execPath } from 'process'
7
7
import util from 'util'
8
8
import { Inputs } from '../inputs'
9
+ import YAML from 'yaml'
9
10
10
11
export async function runSelfInstaller ( inputs : Inputs ) : Promise < number > {
11
12
const { version, dest, packageJsonFile, standalone } = inputs
@@ -49,7 +50,11 @@ async function readTarget(opts: {
49
50
50
51
if ( GITHUB_WORKSPACE ) {
51
52
try {
52
- ( { packageManager } = JSON . parse ( readFileSync ( path . join ( GITHUB_WORKSPACE , packageJsonFile ) , 'utf8' ) ) )
53
+ const content = readFileSync ( path . join ( GITHUB_WORKSPACE , packageJsonFile ) , 'utf8' ) ;
54
+ ( { packageManager } = packageJsonFile . endsWith ( ".yaml" )
55
+ ? YAML . parse ( content , { merge : true } )
56
+ : JSON . parse ( content )
57
+ )
53
58
} catch ( error : unknown ) {
54
59
// Swallow error if package.json doesn't exist in root
55
60
if ( ! util . types . isNativeError ( error ) || ! ( 'code' in error ) || error . code !== 'ENOENT' ) throw error
@@ -66,7 +71,7 @@ async function readTarget(opts: {
66
71
- version ${ packageManager } in the package.json with the key "packageManager"
67
72
Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_PM_VERSION` )
68
73
}
69
-
74
+
70
75
return `${ standalone ? '@pnpm/exe' : 'pnpm' } @${ version } `
71
76
}
72
77
You can’t perform that action at this time.
0 commit comments