mirror of
https://github.com/pnpm/action-setup.git
synced 2026-07-05 03:45:43 +00:00
Compare commits
1 Commits
e227314085
...
545cf2ca6d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
545cf2ca6d |
BIN
dist/index.js
vendored
BIN
dist/index.js
vendored
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
import { addPath, exportVariable } from '@actions/core'
|
import { addPath, exportVariable } from '@actions/core'
|
||||||
import { spawn } from 'child_process'
|
import { spawn } from 'child_process'
|
||||||
import { rm, writeFile, mkdir, symlink } from 'fs/promises'
|
import { rm, writeFile, mkdir } from 'fs/promises'
|
||||||
import { readFileSync, existsSync } from 'fs'
|
import { readFileSync } from 'fs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import util from 'util'
|
import util from 'util'
|
||||||
import { Inputs } from '../inputs'
|
import { Inputs } from '../inputs'
|
||||||
@ -30,17 +30,22 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pnpmHome = path.join(dest, 'node_modules', '.bin')
|
const pnpmHome = path.join(dest, 'node_modules', '.bin')
|
||||||
|
console.log(`Adding to PATH: ${pnpmHome}`)
|
||||||
addPath(pnpmHome)
|
addPath(pnpmHome)
|
||||||
exportVariable('PNPM_HOME', pnpmHome)
|
exportVariable('PNPM_HOME', pnpmHome)
|
||||||
|
|
||||||
// Ensure pnpm bin link exists — npm ci sometimes doesn't create it
|
// Debug: list .bin contents
|
||||||
const pnpmBinLink = path.join(pnpmHome, 'pnpm')
|
const { readdirSync, lstatSync } = await import('fs')
|
||||||
if (!existsSync(pnpmBinLink)) {
|
try {
|
||||||
await mkdir(pnpmHome, { recursive: true })
|
const bins = readdirSync(pnpmHome)
|
||||||
const target = standalone
|
console.log(`.bin contents: ${bins.join(', ')}`)
|
||||||
? path.join('..', '@pnpm', 'exe', 'pnpm')
|
for (const bin of bins) {
|
||||||
: path.join('..', 'pnpm', 'bin', 'pnpm.cjs')
|
const binPath = path.join(pnpmHome, bin)
|
||||||
await symlink(target, pnpmBinLink)
|
const stat = lstatSync(binPath)
|
||||||
|
console.log(` ${bin}: symlink=${stat.isSymbolicLink()}, mode=${stat.mode.toString(8)}`)
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(`Failed to list .bin: ${e}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const bootstrapPnpm = standalone
|
const bootstrapPnpm = standalone
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user