Remove pnpm-lock.yaml Tarball Entries
This skill is designed to clean up pnpm-lock.yaml files by removing tarball references. Tarball entries typically appear as:
tarball: "file:///path/to/package.tgz"
or
tarball: "https://example.com/package.tgz"
Usage
- Identify the pnpm-lock.yaml file in the project root directory
- Search for tarball entries using the pattern
tarball: '.*?' - Remove matching lines entirely from the file
- Preserve YAML structure by maintaining proper indentation and formatting
Implementation Steps
- Read the pnpm-lock.yaml file
- Use regex pattern
/^\s*tarball:\s*['"].*?['"]\s*$/gmto match tarball lines - Remove all matching lines
- Write the cleaned content back to the file
Example
Before:
packages:
/some-package@1.0.0:
resolution:
integrity: sha256-abc123
tarball: "file:///local/path/to/package.tgz"
dependencies: {}
After:
packages:
/some-package@1.0.0:
resolution:
integrity: sha256-abc123
dependencies: {}
Script Usage
This skill includes a helper script to automate the tarball removal:
# Run the script on your pnpm-lock.yaml file
python scripts/remove_tarball.py /path/to/pnpm-lock.yaml
The script will:
- Read the pnpm-lock.yaml file
- Find and remove all lines matching
tarball: '...'ortarball: "..." - Preserve the YAML structure and all other content
- Print a summary of how many tarball entries were removed
Notes
- Only removes lines that match the tarball pattern exactly
- Preserves all other content including integrity hashes, dependencies, and metadata
- Works with both local file paths (file://) and remote URLs (https://)
- Handles both single and double quoted values
扫码联系在线客服