Describe the bug
When vp staged passes files to vp fmt that are all excluded by fmt ignorePatterns in vite.config.ts, vp fmt exits non-zero with "Expected at least one target file" instead of exiting 0.
This happens when a CI bot commits only package-lock.json. The staged config matches it via *.json, passes it to vp fmt, which filters it out via ignorePatterns, then errors because zero files remain.
Config:
staged: {
"*.{json,md,mdx,css,html,yml,yaml}": ["vp fmt"],
},
fmt: {
ignorePatterns: ["package-lock.json", ...],
},
Expected: vp fmt exits 0 when all inputs are excluded by its own ignore patterns.
Actual: exits non-zero with "Expected at least one target file".
Reproduction
https://github.com/nickytonline/vp-fmt-repro
Steps to reproduce
- Install Vite+:
curl -fsSL https://viteplus.dev/install.sh | bash
- Clone the https://github.com/nickytonline/vp-fmt-repro repo and run
vp install
- Make any change to
package-lock.json (e.g. add a trailing newline)
- Stage and commit:
git add package-lock.json
git commit -m "test"
System Info
vp v0.1.14
vite-plus v0.1.14
oxfmt v0.42.0
Node.js v22.22.2
npm v11.12.1
Used Package Manager
npm
Logs
See https://github.com/nickytonline/nickytdotco/actions/runs/23727201068/job/69113096665#logs
Run ./bin/pr-blog-posts.sh
./bin/pr-blog-posts.sh
shell: /usr/bin/bash -e {0}
env:
GITHUB_TOKEN: ***
Switched to branch 'chore_automated_update_blog_posts_1774842949'
M package-lock.json
Creating PR "chore (automated): update blog posts" for branch chore_automated_update_blog_posts_1774842949
[STARTED] Backing up original state...
[COMPLETED] Backed up original state in git stash (77fcc62)
[STARTED] Running tasks for staged files...
[STARTED] Config object — 1 file
[STARTED] *.{js,ts,jsx,tsx,astro,mjs,cjs} — 0 files
[STARTED] *.{json,md,mdx,css,html,yml,yaml} — 1 file
[SKIPPED] *.{js,ts,jsx,tsx,astro,mjs,cjs} — no files
[STARTED] vp fmt
[FAILED] vp fmt [FAILED]
[FAILED] vp fmt [FAILED]
[COMPLETED] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
[COMPLETED] Reverting to original state because of errors...
[STARTED] Cleaning up temporary files...
[COMPLETED] Cleaning up temporary files...
✖ vp fmt:
Expected at least one target file
VITE+ - pre-commit script failed (code 1)
remote:
remote: Create a pull request for 'chore_automated_update_blog_posts_1774842949' on GitHub by visiting:
remote: https://github.com/nickytonline/nickytdotco/pull/new/chore_automated_update_blog_posts_1774842949
remote:
To https://github.com/nickytonline/nickytdotco
* [new branch] chore_automated_update_blog_posts_1774842949 -> chore_automated_update_blog_posts_1774842949
pull request create failed: GraphQL: No commits between main and chore_automated_update_blog_posts_1774842949 (createPullRequest)
no pull requests found for branch "chore_automated_update_blog_posts_1774842949"
Error: Process completed with exit code 1.
Validations
Describe the bug
When vp staged passes files to vp fmt that are all excluded by fmt ignorePatterns in vite.config.ts, vp fmt exits non-zero with "Expected at least one target file" instead of exiting 0.
This happens when a CI bot commits only package-lock.json. The staged config matches it via *.json, passes it to vp fmt, which filters it out via ignorePatterns, then errors because zero files remain.
Config:
Expected: vp fmt exits 0 when all inputs are excluded by its own ignore patterns.
Actual: exits non-zero with "Expected at least one target file".
Reproduction
https://github.com/nickytonline/vp-fmt-repro
Steps to reproduce
curl -fsSL https://viteplus.dev/install.sh | bashvp installpackage-lock.json(e.g. add a trailing newline)System Info
Used Package Manager
npm
Logs
See https://github.com/nickytonline/nickytdotco/actions/runs/23727201068/job/69113096665#logs Run ./bin/pr-blog-posts.sh ./bin/pr-blog-posts.sh shell: /usr/bin/bash -e {0} env: GITHUB_TOKEN: *** Switched to branch 'chore_automated_update_blog_posts_1774842949' M package-lock.json Creating PR "chore (automated): update blog posts" for branch chore_automated_update_blog_posts_1774842949 [STARTED] Backing up original state... [COMPLETED] Backed up original state in git stash (77fcc62) [STARTED] Running tasks for staged files... [STARTED] Config object — 1 file [STARTED] *.{js,ts,jsx,tsx,astro,mjs,cjs} — 0 files [STARTED] *.{json,md,mdx,css,html,yml,yaml} — 1 file [SKIPPED] *.{js,ts,jsx,tsx,astro,mjs,cjs} — no files [STARTED] vp fmt [FAILED] vp fmt [FAILED] [FAILED] vp fmt [FAILED] [COMPLETED] Running tasks for staged files... [STARTED] Applying modifications from tasks... [SKIPPED] Skipped because of errors from tasks. [STARTED] Reverting to original state because of errors... [COMPLETED] Reverting to original state because of errors... [STARTED] Cleaning up temporary files... [COMPLETED] Cleaning up temporary files... ✖ vp fmt: Expected at least one target file VITE+ - pre-commit script failed (code 1) remote: remote: Create a pull request for 'chore_automated_update_blog_posts_1774842949' on GitHub by visiting: remote: https://github.com/nickytonline/nickytdotco/pull/new/chore_automated_update_blog_posts_1774842949 remote: To https://github.com/nickytonline/nickytdotco * [new branch] chore_automated_update_blog_posts_1774842949 -> chore_automated_update_blog_posts_1774842949 pull request create failed: GraphQL: No commits between main and chore_automated_update_blog_posts_1774842949 (createPullRequest) no pull requests found for branch "chore_automated_update_blog_posts_1774842949" Error: Process completed with exit code 1.Validations