feat: standalone binary (#92)
Some checks failed
Test Action / Test with default inputs (ubuntu-latest, 4.11.1) (push) Successful in 25s
Test Action / Test with dest (ubuntu-latest, 4.11.1) (push) Successful in 16s
Test Action / Test with standalone (ubuntu-latest, false) (push) Successful in 10s
Test Action / Test with standalone (ubuntu-latest, true) (push) Successful in 25s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Successful in 30s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Successful in 23s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:empty object value:{}]) (push) Successful in 31s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:null value:null]) (push) Successful in 21s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Successful in 23s
Test Action / Test with default inputs (macos-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with default inputs (windows-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with dest (macos-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with dest (windows-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with standalone (macos-latest, false) (push) Has been cancelled
Test Action / Test with standalone (macos-latest, true) (push) Has been cancelled
Test Action / Test with standalone (windows-latest, false) (push) Has been cancelled
Test Action / Test with standalone (windows-latest, true) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:empty object value:{}]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:null value:null]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:empty object value:{}]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:null value:null]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Has been cancelled
Some checks failed
Test Action / Test with default inputs (ubuntu-latest, 4.11.1) (push) Successful in 25s
Test Action / Test with dest (ubuntu-latest, 4.11.1) (push) Successful in 16s
Test Action / Test with standalone (ubuntu-latest, false) (push) Successful in 10s
Test Action / Test with standalone (ubuntu-latest, true) (push) Successful in 25s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Successful in 30s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Successful in 23s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:empty object value:{}]) (push) Successful in 31s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:null value:null]) (push) Successful in 21s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Successful in 23s
Test Action / Test with default inputs (macos-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with default inputs (windows-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with dest (macos-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with dest (windows-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with standalone (macos-latest, false) (push) Has been cancelled
Test Action / Test with standalone (macos-latest, true) (push) Has been cancelled
Test Action / Test with standalone (windows-latest, false) (push) Has been cancelled
Test Action / Test with standalone (windows-latest, true) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:empty object value:{}]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:null value:null]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:empty object value:{}]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:null value:null]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Has been cancelled
* feat: add an option to install the self-contained binary version of pnpm * test: add a test about nodejs_bundled * style: remove an empty line * chore: use newer pnpm * chore: update dependencies * feat: rename `nodejs_bundled` to `standalone` as @zkochan suggested * docs: add --------- Co-authored-by: Takashi Sato <takashi@tks.st>
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { getInput, InputOptions } from '@actions/core'
|
||||
import { getBooleanInput, getInput, InputOptions } from '@actions/core'
|
||||
import expandTilde from 'expand-tilde'
|
||||
import { RunInstall, parseRunInstall } from './run-install'
|
||||
|
||||
@ -7,6 +7,7 @@ export interface Inputs {
|
||||
readonly dest: string
|
||||
readonly runInstall: RunInstall[]
|
||||
readonly packageJsonFile: string
|
||||
readonly standalone: boolean
|
||||
}
|
||||
|
||||
const options: InputOptions = {
|
||||
@ -20,6 +21,7 @@ export const getInputs = (): Inputs => ({
|
||||
dest: parseInputPath('dest'),
|
||||
runInstall: parseRunInstall('run_install'),
|
||||
packageJsonFile: parseInputPath('package_json_file'),
|
||||
standalone: getBooleanInput('standalone'),
|
||||
})
|
||||
|
||||
export default getInputs
|
||||
|
@ -6,7 +6,7 @@ import { execPath } from 'process'
|
||||
import { Inputs } from '../inputs'
|
||||
|
||||
export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
const { version, dest, packageJsonFile } = 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(packageJsonFile, version)
|
||||
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'],
|
||||
@ -33,8 +33,14 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
return exitCode
|
||||
}
|
||||
|
||||
async function readTarget(packageJsonFile: string, version?: string | undefined) {
|
||||
if (version) return `pnpm@${version}`
|
||||
async function readTarget(opts: {
|
||||
readonly version?: string | undefined
|
||||
readonly packageJsonFile: string
|
||||
readonly standalone: boolean
|
||||
}) {
|
||||
const { version, packageJsonFile, standalone } = opts
|
||||
|
||||
if (version) return `${ standalone ? '@pnpm/exe' : 'pnpm' }@${version}`
|
||||
|
||||
const { GITHUB_WORKSPACE } = process.env
|
||||
if (!GITHUB_WORKSPACE) {
|
||||
@ -55,6 +61,11 @@ Please specify it by one of the following ways:
|
||||
if (!packageManager.startsWith('pnpm@')) {
|
||||
throw new Error('Invalid packageManager field in package.json')
|
||||
}
|
||||
|
||||
if(standalone){
|
||||
return packageManager.replace('pnpm@', '@pnpm/exe@')
|
||||
}
|
||||
|
||||
return packageManager
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user