Skip to content

fix(husky): use pnpx #1975

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx lint-staged
pnpx lint-staged
2 changes: 1 addition & 1 deletion docs/FAQs.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Here we'll outline the steps required to migrate a CTA app to a GitHub Action:
```diff
+pnpm run build
+git add dist
npx lint-staged
pnpx lint-staged
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be reverted, but I kept this change because pnpx is just better. It's faster and what the project will be using after this commit.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

faster

Is it, though? Trying out an arbitrary text addition of \nExample.\n to the bottom of README.md:

joshgoldberg ~/repos/create-typescript-app $ hyperfine "npx lint-staged" --warmup 3
Benchmark 1: npx lint-staged
  Time (mean ± σ):     843.7 ms ±   9.0 ms    [User: 833.9 ms, System: 206.5 ms]
  Range (min … max):   832.7 ms … 864.0 ms    10 runs
 
joshgoldberg ~/repos/create-typescript-app $ hyperfine "pnpx lint-staged" --warmup 3
Benchmark 1: pnpx lint-staged
  Time (mean ± σ):     974.1 ms ±  22.9 ms    [User: 854.3 ms, System: 185.1 ms]
  Range (min … max):   943.5 ms … 1007.2 ms    10 runs

System info:

  • OS: macOS Ventura 13.2
  • Hardware: Mac Studio, Apple M1 Max, 32 GB
  • Node: 22.12.0
  • npm: 10.9.0
  • pnpm: 10.5.2

```

2. Create an [`action.yml` metadata file](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action#creating-an-action-metadata-file).
Expand Down
6 changes: 3 additions & 3 deletions src/blocks/blockPrettier.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe("blockPrettier", () => {
".gitignore": "_
",
"pre-commit": [
"npx lint-staged
"pnpx lint-staged
",
{
"executable": true,
Expand Down Expand Up @@ -203,7 +203,7 @@ describe("blockPrettier", () => {
".gitignore": "_
",
"pre-commit": [
"npx lint-staged
"pnpx lint-staged
",
{
"executable": true,
Expand Down Expand Up @@ -333,7 +333,7 @@ describe("blockPrettier", () => {
".gitignore": "_
",
"pre-commit": [
"npx lint-staged
"pnpx lint-staged
",
{
"executable": true,
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/blockPrettier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pnpm format --write
files: {
".husky": {
".gitignore": "_\n",
"pre-commit": ["npx lint-staged\n", { executable: true }],
"pre-commit": ["pnpx lint-staged\n", { executable: true }],
},
".prettierignore": formatIgnoreFile(
["/.husky", "/lib", "/pnpm-lock.yaml", ...ignores].sort(),
Expand Down