Skip to content

Instantly share code, notes, and snippets.

@melMass
Created October 26, 2022 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melMass/fd07c2c2404c169aca55561499e8461f to your computer and use it in GitHub Desktop.
Save melMass/fd07c2c2404c169aca55561499e8461f to your computer and use it in GitHub Desktop.
(WIP) This is an half baked completion meant to ask further question to nushell's contributors.
# Installs a package.By default, any new package is installed as a prod dependency
export extern "pnpm add" [
]
# Generates a pnpm-lock.yaml from an npm package-lock.json (or npm-shrinkwrap.json) file
export extern "pnpm import" [
]
# Install all dependencies for a project
export extern "pnpm install" [
]
# Runs a pnpm install followed immediately by a pnpm test
export extern "pnpm install-test" [
]
# Removes extraneous packages
export extern "pnpm prune" [
]
# Rebuild a package
export extern "pnpm rebuild" [
]
# Removes packages from node_modules and from the project's package.json
export extern "pnpm remove" [
]
# Connect the local project to another one
export extern "pnpm link" [
]
# Unlinks a package. Like yarn unlink but pnpm re-installs the dependency after removing the external link
export extern "pnpm unlink" [
]
# Updates packages to their latest version based on the specified range
export extern "pnpm update" [
]
# Checks for known security issues with the installed packages
export extern "pnpm audit" [
--audit-level # low|moderate|high|critical default: low
--dev # Only audit "devDependencies"
--fix # Add overrides to the package.json file in order to force non-vulnerable versions of the dependencies
--json # Output audit report in JSON format
]
# Print all the versions of packages that are installed, as well as their dependencies, in a tree-structure
export extern "pnpm list" [
]
# Check for outdated packages
export extern "pnpm outdated" [
]
# Executes a shell command in scope of a project
export extern "pnpm exec" [
]
# Runs an arbitrary command specified in the package's "start" property of its "scripts" object
export extern "pnpm start" [
]
# Runs a package's "test" script, if one was provided
export extern "pnpm test" [
--recursive(-r) # Run the tests in every package found in subdirectories or every workspace package
]
# Create a tarball from a package
export extern "pnpm pack" [
--pack-destination # The default is the current working directory.
]
# Publishes a package to the npm registry.
export extern "pnpm publish" [
dir?: string # tarball or dir
--tag # Registers the published package with the given tag. By default, the "latest" tag is used.
--dry-run # Does everything a publish would do except actually publishing to the registry
--no-git-checks # Don't check if current branch is your publish branch, clean, and up to date
]
export extern "pnpm" [
script?: string@"nu-complete pnpm run"
]
def "nu-complete pnpm run" [] {
open ./package.json
|get scripts
|columns
}
# Runs a defined package script
export extern "pnpm run" [
script: string@"nu-complete pnpm run"
--workspace(-w) # Run the command on the root workspace project
--dir(-C) # Change to directory <dir>
--if-present # Avoid exiting with a non-zero exit code when the script is undefined
--help # Output usage information
--ignore-scripts
--script-shell
...common
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment