Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: standalone binary #92

Merged
merged 8 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 57 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
- name: 'Test: install'
run: pnpm install

test_explicit_inputs:
name: Test with explicit inputs
test_dest:
name: Test with dest

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -65,6 +65,61 @@ jobs:
- name: 'Test: install'
run: pnpm install

test_standalone:
name: Test with standalone

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest

standalone:
- true
- false

steps:
- uses: actions/checkout@v3

- name: Run the action
uses: ./
with:
version: 7.0.0
standalone: ${{ matrix.standalone }}

- name: install Node.js
uses: actions/setup-node@v3
with:
# [email protected] is not compatible with Node.js 12
node-version: 12.22.12

- name: 'Test: which (pnpm)'
run: which pnpm

- name: 'Test: which (pnpx)'
if: matrix.standalone == false
run: which pnpx

- name: 'Test: install when standalone is true'
if: matrix.standalone
run: pnpm install

- 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: |
if pnpm install; then
echo "pnpm install should fail"
exit 1
else
echo "pnpm install failed as expected"
fi

test_run_install:
name: 'Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }})'

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,13 @@ If `run_install` is a YAML string representation of either an object or an array

### `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.
**Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json` to read "packageManager" configuration.

### `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, enabling using `pnpm` without Node.js.

This is useful when you want to use a incompatible pair of Node.js and pnpm.

## Outputs

Expand Down
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ inputs:
required: false
default: 'null'
package_json_file:
description: File path to the package.json to read "packageManager" configutation
description: File path to the package.json to read "packageManager" configuration
required: false
default: 'package.json'
standalone:
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
default: 'false'
runs:
using: node16
main: dist/index.js
Expand Down
4 changes: 2 additions & 2 deletions dist/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"@types/expand-tilde": "^2.0.0",
"@types/fs-extra": "^9.0.13",
"@types/js-yaml": "^4.0.5",
"@types/node": "^14.18.32",
"@types/node-fetch": "^2.6.2",
"@types/node": "^14.18.54",
"@types/node-fetch": "^2.6.4",
"ajv": "^6.12.6",
"expand-tilde": "^2.0.2",
"fs-extra": "^10.1.0",
Expand All @@ -21,6 +21,6 @@
"devDependencies": {
"@ts-schema-autogen/cli": "^0.1.2",
"@vercel/ncc": "^0.33.4",
"typescript": "^4.8.4"
"typescript": "^4.9.5"
}
}
Loading