Compare commits

..

No commits in common. "0b715c7ebbf3cf2174d1386336c5f6d3d8d5504a" and "c3b53f6a16e57305370b4ae5a540c2077a1d50dd" have entirely different histories.

6 changed files with 27 additions and 27 deletions

14
.github/FUNDING.yml vendored
View File

@ -1,2 +1,12 @@
custom:
- https://opencollective.com/pnpm
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: khai96_
open_collective: # Collective unavailable
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # disabled
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -38,10 +38,6 @@ If `run_install` is a YAML string representation of either an object or an array
**Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--frozen-lockfile, --strict-peer-dependencies]`.
### `package_json_file`
**Optional** File path to the `package.json` to read "packageManager" configutation. If not specified, `package.json` in the project root directory is used.
## Outputs
### `dest`
@ -66,9 +62,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v2.2.4
with:
version: 8
version: 6.0.2
```
### Install pnpm and a few npm packages
@ -83,11 +79,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v2.2.4
with:
version: 8
version: 6.0.2
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
@ -114,21 +110,22 @@ jobs:
with:
node-version: 16
- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
run_install: false
- name: Get pnpm store directory
shell: bash
id: pnpm-cache
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

View File

@ -6,7 +6,6 @@ branding:
inputs:
version:
description: Version of pnpm to install
required: false
dest:
description: Where to store pnpm files
required: false
@ -15,10 +14,6 @@ inputs:
description: If specified, run `pnpm install`
required: false
default: 'null'
package_json_file:
description: File path to the package.json to read "packageManager" configutation
required: false
default: 'package.json'
runs:
using: node16
main: dist/index.js

BIN
dist/index.js vendored

Binary file not shown.

View File

@ -6,7 +6,6 @@ export interface Inputs {
readonly version?: string
readonly dest: string
readonly runInstall: RunInstall[]
readonly packageJsonFile: string
}
const options: InputOptions = {
@ -19,7 +18,6 @@ export const getInputs = (): Inputs => ({
version: getInput('version'),
dest: parseInputPath('dest'),
runInstall: parseRunInstall('run_install'),
packageJsonFile: parseInputPath('package_json_file'),
})
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 } = inputs
const { version, dest } = 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)
const cp = spawn(execPath, [path.join(__dirname, 'pnpm.js'), 'install', target, '--no-lockfile'], {
cwd: dest,
stdio: ['pipe', 'inherit', 'inherit'],
@ -33,7 +33,7 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
return exitCode
}
async function readTarget(packageJsonFile: string, version?: string | undefined) {
async function readTarget(version?: string | undefined) {
if (version) return `pnpm@${version}`
const { GITHUB_WORKSPACE } = process.env
@ -44,12 +44,12 @@ please run the actions/checkout before pnpm/action-setup.
Otherwise, please specify the pnpm version in the action configuration.`)
}
const { packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, packageJsonFile), 'utf8'))
const { packageManager } = JSON.parse(await readFile(path.join(GITHUB_WORKSPACE, 'package.json'), 'utf8'))
if (typeof packageManager !== 'string') {
throw new Error(`No pnpm version is specified.
Please specify it by one of the following ways:
- in the GitHub Action config with the key "version"
- in the package.json with the key "packageManager"`)
- in the package.json with the key "packageManager" (See https://nodejs.org/api/corepack.html)`)
}
if (!packageManager.startsWith('pnpm@')) {