[BUG] `npm pack` includes `.<file>.swo` and other vim editor files
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
npm pack will include .package.json.swo (created in vim if you have multiple editors on the same file).
By default .*.swp will be ignored -- this issue is proposing adding .*.swo and possibly the entire swap space. The pattern follows the rules in findswapname. https://github.com/vim/vim/blob/master/src/memline.c#L5138 :
/*
* Change the ".swp" extension to find another file that can be used.
* First decrement the last char: ".swo", ".swn", etc.
* If that still isn't enough decrement the last but one char: ".svz"
* Can happen when editing many "No Name" buffers.
*/
The JS regex for names is/^\..*\.s(([a-v][a-z])|(w[a-p]))$/
Expected Behavior
The .package.json.swo file should be ignored
Steps To Reproduce
touch .package.json.swo && npm pack
Environment
- npm: 8.3.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with npm pack's ignore rules and the existing handling for .*.swp files. Compare the matcher with the Vim findswapname pattern described in the issue, then reproduce with touch .package.json.swo && npm pack; done means the .swo file and the other swap-file names covered by the stated pattern are excluded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100