feat: rename `nodejs_bundled` to `standalone`

as @zkochan suggested
This commit is contained in:
khai96_ 2023-07-26 17:50:17 +07:00
parent 9695a8b930
commit f4b921d2c3
7 changed files with 21 additions and 21 deletions

View File

@ -65,8 +65,8 @@ jobs:
- name: 'Test: install'
run: pnpm install
test_nodejs_bundled:
name: Test with nodejs_bundled
test_standalone:
name: Test with standalone
runs-on: ${{ matrix.os }}
@ -78,7 +78,7 @@ jobs:
- macos-latest
- windows-latest
nodejs_bundled:
standalone:
- true
- false
@ -89,7 +89,7 @@ jobs:
uses: ./
with:
version: 7.0.0
nodejs_bundled: ${{ matrix.nodejs_bundled }}
standalone: ${{ matrix.standalone }}
- name: install Node.js
uses: actions/setup-node@v3
@ -101,15 +101,15 @@ jobs:
run: which pnpm
- name: 'Test: which (pnpx)'
if: matrix.nodejs_bundled == false
if: matrix.standalone == false
run: which pnpx
- name: 'Test: install when nodejs_bundled is true'
if: matrix.nodejs_bundled
- name: 'Test: install when standalone is true'
if: matrix.standalone
run: pnpm install
- name: 'Test: install when nodejs_bundled is false'
if: matrix.nodejs_bundled == false
- name: 'Test: install when standalone is false'
if: matrix.standalone == false
# Since the default shell on windows runner is pwsh, we specify bash explicitly
shell: bash
run: |

View File

@ -42,7 +42,7 @@ 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.
### `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.

View File

@ -19,7 +19,7 @@ inputs:
description: File path to the package.json to read "packageManager" configuration
required: false
default: 'package.json'
nodejs_bundled:
standalone:
description: When set to true, @pnpm/exe, which is a Node.js bundled package, will be installed.
required: false
default: 'false'

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
run.sh
View File

@ -4,5 +4,5 @@ export HOME="$(pwd)"
export INPUT_VERSION=4.11.1
export INPUT_DEST='~/pnpm.temp'
export INPUT_RUN_INSTALL=null
export INPUT_NODEJS_BUNDLED=false
export INPUT_standalone=false
exec node dist/index.js

View File

@ -7,7 +7,7 @@ export interface Inputs {
readonly dest: string
readonly runInstall: RunInstall[]
readonly packageJsonFile: string
readonly nodeJsBundled: boolean
readonly standalone: boolean
}
const options: InputOptions = {
@ -21,7 +21,7 @@ export const getInputs = (): Inputs => ({
dest: parseInputPath('dest'),
runInstall: parseRunInstall('run_install'),
packageJsonFile: parseInputPath('package_json_file'),
nodeJsBundled: getBooleanInput('nodejs_bundled'),
standalone: getBooleanInput('standalone'),
})
export default getInputs

View File

@ -6,7 +6,7 @@ import { execPath } from 'process'
import { Inputs } from '../inputs'
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
const { version, dest, packageJsonFile, nodeJsBundled } = inputs
const { version, dest, packageJsonFile, standalone } = inputs
// prepare self install
await remove(dest)
@ -15,7 +15,7 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
await writeFile(pkgJson, JSON.stringify({ private: true }))
// 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'], {
cwd: dest,
stdio: ['pipe', 'inherit', 'inherit'],
@ -36,11 +36,11 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
async function readTarget(opts: {
readonly version?: string | undefined
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
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')
}
if(nodeJsBundled){
if(standalone){
return packageManager.replace('pnpm@', '@pnpm/exe@')
}