返回 Skill 列表
extension
分类: AI Agent 能力无需 API Key

remove-pnpm-tarball

清除pnpm-lock.yaml文件中,异常产生的tarball:"字符串"这样的参数,造成阿里云流水线报错问题

person作者: oliayarhubModelScope

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

  1. Identify the pnpm-lock.yaml file in the project root directory
  2. Search for tarball entries using the pattern tarball: '.*?'
  3. Remove matching lines entirely from the file
  4. Preserve YAML structure by maintaining proper indentation and formatting

Implementation Steps

  1. Read the pnpm-lock.yaml file
  2. Use regex pattern /^\s*tarball:\s*['"].*?['"]\s*$/gm to match tarball lines
  3. Remove all matching lines
  4. 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: '...' or tarball: "..."
  • 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