developerasun / myCodeBox-web

Open source code box for web developers.
Apache License 2.0
5 stars 0 forks source link

[RESEARCH] Javascript/package manager: pnpm CLI commands #262

Open developerasun opened 2 years ago

developerasun commented 2 years ago

topic : understanding pnpm cli commands

read this

  1. pnpm run

Runs a script defined in the package's manifest file.

  1. pnpm test

Runs an arbitrary command specified in the package's test property of its scripts object. The intended usage of the property is to specify a command that runs unit or integration testing for your program.

  1. pnpm exec

    Execute a shell command in scope of a project. node_modules/.bin is added to the PATH, so pnpm exec allows executing commands of dependencies.

Any options for the exec command should be listed before the exec keyword. Options listed after the exec keyword are passed to the executed command.

# Good. pnpm will run recursively:
pnpm -r exec jest
# Bad, pnpm will not run recursively but jest will be executed with the -r option:
pnpm exec jest -r
  1. pnpm dlx

Fetches a package from the registry without installing it as a dependency, hotloads it, and runs whatever default command binary it exposes. For example, to use create-react-app anywhere to bootstrap a react app without needing to install it under another project, you can run:

pnpm dlx create-react-app ./my-app

This will fetch create-react-app from the registry and run it with the given arguments.

  1. pnpm create

Create a project from a create- or @foo/create- starter kit.

  1. pnpm start

Runs an arbitrary command specified in the package's start property of its scripts object. If no start property is specified on the scripts object, it will attempt to run node server.js as a default, failing if neither are present.

reference