mirror of
https://github.com/pnpm/action-setup.git
synced 2024-11-12 04:28:04 +00:00
Compare commits
2 Commits
9695a8b930
...
d91cff1832
Author | SHA1 | Date | |
---|---|---|---|
|
d91cff1832 | ||
|
f4b921d2c3 |
18
.github/workflows/test.yaml
vendored
18
.github/workflows/test.yaml
vendored
@ -65,8 +65,8 @@ jobs:
|
|||||||
- name: 'Test: install'
|
- name: 'Test: install'
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
test_nodejs_bundled:
|
test_standalone:
|
||||||
name: Test with nodejs_bundled
|
name: Test with standalone
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
|
|
||||||
nodejs_bundled:
|
standalone:
|
||||||
- true
|
- true
|
||||||
- false
|
- false
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: 7.0.0
|
version: 7.0.0
|
||||||
nodejs_bundled: ${{ matrix.nodejs_bundled }}
|
standalone: ${{ matrix.standalone }}
|
||||||
|
|
||||||
- name: install Node.js
|
- name: install Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
@ -101,15 +101,15 @@ jobs:
|
|||||||
run: which pnpm
|
run: which pnpm
|
||||||
|
|
||||||
- name: 'Test: which (pnpx)'
|
- name: 'Test: which (pnpx)'
|
||||||
if: matrix.nodejs_bundled == false
|
if: matrix.standalone == false
|
||||||
run: which pnpx
|
run: which pnpx
|
||||||
|
|
||||||
- name: 'Test: install when nodejs_bundled is true'
|
- name: 'Test: install when standalone is true'
|
||||||
if: matrix.nodejs_bundled
|
if: matrix.standalone
|
||||||
run: pnpm install
|
run: pnpm install
|
||||||
|
|
||||||
- name: 'Test: install when nodejs_bundled is false'
|
- name: 'Test: install when standalone is false'
|
||||||
if: matrix.nodejs_bundled == false
|
if: matrix.standalone == false
|
||||||
# Since the default shell on windows runner is pwsh, we specify bash explicitly
|
# Since the default shell on windows runner is pwsh, we specify bash explicitly
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
|
@ -42,9 +42,9 @@ If `run_install` is a YAML string representation of either an object or an array
|
|||||||
|
|
||||||
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json` to read "packageManager" configuration.
|
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json` to read "packageManager" configuration.
|
||||||
|
|
||||||
### `nodejs_bundled`
|
### `standalone`
|
||||||
|
|
||||||
**Optional** (_type:_ `boolean`, _default:_ `false`) When set to true, [@pnpm/exe](https://www.npmjs.com/package/@pnpm/exe), which is a Node.js bundled package, will be installed.
|
**Optional** (_type:_ `boolean`, _default:_ `false`) When set to true, [@pnpm/exe](https://www.npmjs.com/package/@pnpm/exe), which is a Node.js bundled package, will be installed, enabling using `pnpm` without Node.js.
|
||||||
|
|
||||||
This is useful when you want to use a incompatible pair of Node.js and pnpm.
|
This is useful when you want to use a incompatible pair of Node.js and pnpm.
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@ inputs:
|
|||||||
description: File path to the package.json to read "packageManager" configuration
|
description: File path to the package.json to read "packageManager" configuration
|
||||||
required: false
|
required: false
|
||||||
default: 'package.json'
|
default: 'package.json'
|
||||||
nodejs_bundled:
|
standalone:
|
||||||
description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed.
|
description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed, enabling using pnpm without Node.js.
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
runs:
|
runs:
|
||||||
|
BIN
dist/index.js
vendored
BIN
dist/index.js
vendored
Binary file not shown.
2
run.sh
2
run.sh
@ -4,5 +4,5 @@ export HOME="$(pwd)"
|
|||||||
export INPUT_VERSION=4.11.1
|
export INPUT_VERSION=4.11.1
|
||||||
export INPUT_DEST='~/pnpm.temp'
|
export INPUT_DEST='~/pnpm.temp'
|
||||||
export INPUT_RUN_INSTALL=null
|
export INPUT_RUN_INSTALL=null
|
||||||
export INPUT_NODEJS_BUNDLED=false
|
export INPUT_standalone=false
|
||||||
exec node dist/index.js
|
exec node dist/index.js
|
||||||
|
@ -7,7 +7,7 @@ export interface Inputs {
|
|||||||
readonly dest: string
|
readonly dest: string
|
||||||
readonly runInstall: RunInstall[]
|
readonly runInstall: RunInstall[]
|
||||||
readonly packageJsonFile: string
|
readonly packageJsonFile: string
|
||||||
readonly nodeJsBundled: boolean
|
readonly standalone: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const options: InputOptions = {
|
const options: InputOptions = {
|
||||||
@ -21,7 +21,7 @@ export const getInputs = (): Inputs => ({
|
|||||||
dest: parseInputPath('dest'),
|
dest: parseInputPath('dest'),
|
||||||
runInstall: parseRunInstall('run_install'),
|
runInstall: parseRunInstall('run_install'),
|
||||||
packageJsonFile: parseInputPath('package_json_file'),
|
packageJsonFile: parseInputPath('package_json_file'),
|
||||||
nodeJsBundled: getBooleanInput('nodejs_bundled'),
|
standalone: getBooleanInput('standalone'),
|
||||||
})
|
})
|
||||||
|
|
||||||
export default getInputs
|
export default getInputs
|
||||||
|
@ -6,7 +6,7 @@ import { execPath } from 'process'
|
|||||||
import { Inputs } from '../inputs'
|
import { Inputs } from '../inputs'
|
||||||
|
|
||||||
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||||
const { version, dest, packageJsonFile, nodeJsBundled } = inputs
|
const { version, dest, packageJsonFile, standalone } = inputs
|
||||||
|
|
||||||
// prepare self install
|
// prepare self install
|
||||||
await remove(dest)
|
await remove(dest)
|
||||||
@ -15,7 +15,7 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
|||||||
await writeFile(pkgJson, JSON.stringify({ private: true }))
|
await writeFile(pkgJson, JSON.stringify({ private: true }))
|
||||||
|
|
||||||
// prepare target pnpm
|
// prepare target pnpm
|
||||||
const target = await readTarget({ version, packageJsonFile, nodeJsBundled })
|
const target = await readTarget({ version, packageJsonFile, standalone })
|
||||||
const cp = spawn(execPath, [path.join(__dirname, 'pnpm.js'), 'install', target, '--no-lockfile'], {
|
const cp = spawn(execPath, [path.join(__dirname, 'pnpm.js'), 'install', target, '--no-lockfile'], {
|
||||||
cwd: dest,
|
cwd: dest,
|
||||||
stdio: ['pipe', 'inherit', 'inherit'],
|
stdio: ['pipe', 'inherit', 'inherit'],
|
||||||
@ -36,11 +36,11 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
|||||||
async function readTarget(opts: {
|
async function readTarget(opts: {
|
||||||
readonly version?: string | undefined
|
readonly version?: string | undefined
|
||||||
readonly packageJsonFile: string
|
readonly packageJsonFile: string
|
||||||
readonly nodeJsBundled: boolean
|
readonly standalone: boolean
|
||||||
}) {
|
}) {
|
||||||
const { version, packageJsonFile, nodeJsBundled } = opts
|
const { version, packageJsonFile, standalone } = opts
|
||||||
|
|
||||||
if (version) return `${ nodeJsBundled ? '@pnpm/exe' : 'pnpm' }@${version}`
|
if (version) return `${ standalone ? '@pnpm/exe' : 'pnpm' }@${version}`
|
||||||
|
|
||||||
const { GITHUB_WORKSPACE } = process.env
|
const { GITHUB_WORKSPACE } = process.env
|
||||||
if (!GITHUB_WORKSPACE) {
|
if (!GITHUB_WORKSPACE) {
|
||||||
@ -62,7 +62,7 @@ Please specify it by one of the following ways:
|
|||||||
throw new Error('Invalid packageManager field in package.json')
|
throw new Error('Invalid packageManager field in package.json')
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nodeJsBundled){
|
if(standalone){
|
||||||
return packageManager.replace('pnpm@', '@pnpm/exe@')
|
return packageManager.replace('pnpm@', '@pnpm/exe@')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user