mirror of
https://github.com/pnpm/action-setup.git
synced 2026-03-16 23:36:11 +08:00
Compare commits
4 Commits
update-nod
...
dev-engine
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9d2a4eef5 | ||
|
|
fc06bc1257 | ||
|
|
b906affcce | ||
|
|
9b5745cdf0 |
@@ -37,6 +37,6 @@ outputs:
|
||||
bin_dest:
|
||||
description: Location of `pnpm` and `pnpx` command
|
||||
runs:
|
||||
using: node20
|
||||
using: node24
|
||||
main: dist/index.js
|
||||
post: dist/index.js
|
||||
|
||||
8
dist/index.js
vendored
8
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/glob": "^0.5.0",
|
||||
"@types/expand-tilde": "^2.0.2",
|
||||
"@types/node": "^20.11.5",
|
||||
"@types/node": "^22.0.0",
|
||||
"expand-tilde": "^2.0.2",
|
||||
"yaml": "^2.3.4",
|
||||
"zod": "^3.22.4"
|
||||
|
||||
18
pnpm-lock.yaml
generated
18
pnpm-lock.yaml
generated
@@ -24,8 +24,8 @@ importers:
|
||||
specifier: ^2.0.2
|
||||
version: 2.0.2
|
||||
'@types/node':
|
||||
specifier: ^20.11.5
|
||||
version: 20.17.17
|
||||
specifier: ^22.0.0
|
||||
version: 22.19.11
|
||||
expand-tilde:
|
||||
specifier: ^2.0.2
|
||||
version: 2.0.2
|
||||
@@ -137,8 +137,8 @@ packages:
|
||||
'@types/expand-tilde@2.0.2':
|
||||
resolution: {integrity: sha512-wlsMYiapmIR4Eq/Z0qysN8xaDMjSkO6AIDNFx9oxgWGeKVA1jU+NzwPRZErBNP5z6/dx6QNkNpKglBGPO9OkTA==}
|
||||
|
||||
'@types/node@20.17.17':
|
||||
resolution: {integrity: sha512-/WndGO4kIfMicEQLTi/mDANUu/iVUhT7KboZPdEqqHQ4aTS+3qT3U5gIqWDFV+XouorjfgGqvKILJeHhuQgFYg==}
|
||||
'@types/node@22.19.11':
|
||||
resolution: {integrity: sha512-BH7YwL6rA93ReqeQS1c4bsPpcfOmJasG+Fkr6Y59q83f9M1WcBRHR2vM+P9eOisYRcN3ujQoiZY8uk5W+1WL8w==}
|
||||
|
||||
'@typespec/ts-http-runtime@0.3.0':
|
||||
resolution: {integrity: sha512-sOx1PKSuFwnIl7z4RN0Ls7N9AQawmR9r66eI5rFCzLDIs8HTIYrIpH9QjYWoX0lkgGrkLxXhi4QnK7MizPRrIg==}
|
||||
@@ -335,8 +335,8 @@ packages:
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
undici-types@6.19.8:
|
||||
resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
|
||||
undici-types@6.21.0:
|
||||
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
|
||||
|
||||
undici@5.29.0:
|
||||
resolution: {integrity: sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==}
|
||||
@@ -539,9 +539,9 @@ snapshots:
|
||||
|
||||
'@types/expand-tilde@2.0.2': {}
|
||||
|
||||
'@types/node@20.17.17':
|
||||
'@types/node@22.19.11':
|
||||
dependencies:
|
||||
undici-types: 6.19.8
|
||||
undici-types: 6.21.0
|
||||
|
||||
'@typespec/ts-http-runtime@0.3.0':
|
||||
dependencies:
|
||||
@@ -717,7 +717,7 @@ snapshots:
|
||||
|
||||
typescript@5.7.3: {}
|
||||
|
||||
undici-types@6.19.8: {}
|
||||
undici-types@6.21.0: {}
|
||||
|
||||
undici@5.29.0:
|
||||
dependencies:
|
||||
|
||||
@@ -57,21 +57,28 @@ async function readTarget(opts: {
|
||||
const { version, packageJsonFile, standalone } = opts
|
||||
const { GITHUB_WORKSPACE } = process.env
|
||||
|
||||
let packageManager
|
||||
let packageManager: string | undefined
|
||||
let devEngines: { packageManager?: { name?: string; version?: string } } | undefined
|
||||
|
||||
if (GITHUB_WORKSPACE) {
|
||||
try {
|
||||
const content = readFileSync(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8');
|
||||
({ packageManager } = packageJsonFile.endsWith(".yaml")
|
||||
const manifest = packageJsonFile.endsWith(".yaml")
|
||||
? parseYaml(content, { merge: true })
|
||||
: JSON.parse(content)
|
||||
)
|
||||
packageManager = manifest.packageManager
|
||||
devEngines = manifest.devEngines
|
||||
} catch (error: unknown) {
|
||||
// Swallow error if package.json doesn't exist in root
|
||||
if (!util.types.isNativeError(error) || !('code' in error) || error.code !== 'ENOENT') throw error
|
||||
}
|
||||
}
|
||||
|
||||
// If packageManager field is not set, try devEngines.packageManager
|
||||
if (typeof packageManager !== 'string' && devEngines?.packageManager?.name === 'pnpm' && devEngines.packageManager.version) {
|
||||
packageManager = `pnpm@${devEngines.packageManager.version}`
|
||||
}
|
||||
|
||||
if (version) {
|
||||
if (
|
||||
typeof packageManager === 'string' &&
|
||||
@@ -98,7 +105,8 @@ Otherwise, please specify the pnpm version in the action configuration.`)
|
||||
throw new Error(`No pnpm version is specified.
|
||||
Please specify it by one of the following ways:
|
||||
- in the GitHub Action config with the key "version"
|
||||
- in the package.json with the key "packageManager"`)
|
||||
- in the package.json with the key "packageManager"
|
||||
- in the package.json with the key "devEngines.packageManager"`)
|
||||
}
|
||||
|
||||
if (!packageManager.startsWith('pnpm@')) {
|
||||
|
||||
Reference in New Issue
Block a user