Merge pull request #29 from pnpm/pnpm-v7

The pnpm home directory should be added to PATH and PNPM_HOME
This commit is contained in:
Khải 2022-02-08 19:47:28 +07:00 committed by GitHub
commit 93bd5a123d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 496 additions and 514 deletions

BIN
dist/index.js vendored

Binary file not shown.

View File

@ -7,21 +7,21 @@
"start": "pnpm run build && sh ./run.sh"
},
"dependencies": {
"node-fetch": "^2.6.1",
"expand-tilde": "^2.0.2",
"js-yaml": "^4.0.0",
"ajv": "^6.12.5",
"fs-extra": "^9.1.0",
"@actions/core": "^1.2.6",
"@actions/core": "^1.6.0",
"@types/expand-tilde": "^2.0.0",
"@types/node-fetch": "^2.5.8",
"@types/js-yaml": "^4.0.0",
"@types/fs-extra": "^9.0.8",
"@types/node": "^14.14.35"
"@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.5",
"@types/node": "^14.18.10",
"@types/node-fetch": "^2.5.12",
"ajv": "^6.12.6",
"expand-tilde": "^2.0.2",
"fs-extra": "^9.1.0",
"js-yaml": "^4.1.0",
"node-fetch": "^2.6.7"
},
"devDependencies": {
"typescript": "^4.2.3",
"@ts-schema-autogen/cli": "^0.1.2",
"@vercel/ncc": "^0.27.0"
"@vercel/ncc": "^0.27.0",
"typescript": "^4.5.5"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
import { addPath, exportVariable } from '@actions/core'
import { spawn } from 'child_process'
import { execPath } from 'process'
import { join } from 'path'
import path from 'path'
import { remove, ensureFile, writeFile } from 'fs-extra'
import fetch from 'node-fetch'
import { Inputs } from '../inputs'
@ -8,7 +9,7 @@ import { Inputs } from '../inputs'
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const { version, dest } = inputs
const target = version ? `pnpm@${version}` : 'pnpm'
const pkgJson = join(dest, 'package.json')
const pkgJson = path.join(dest, 'package.json')
await remove(dest)
await ensureFile(pkgJson)
@ -19,13 +20,19 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
stdio: ['pipe', 'inherit', 'inherit'],
})
const response = await fetch('https://pnpm.js.org/pnpm.js')
const response = await fetch('https://pnpm.io/pnpm.js')
response.body.pipe(cp.stdin)
return new Promise((resolve, reject) => {
const exitCode = await new Promise<number>((resolve, reject) => {
cp.on('error', reject)
cp.on('close', resolve)
})
if (exitCode === 0) {
const pnpmHome = path.join(dest, 'node_modules/.bin')
addPath(pnpmHome)
exportVariable('PNPM_HOME', pnpmHome)
}
return exitCode
}
export default runSelfInstaller