Creates an instance of Package.
Returns the content of package.json
in package directory. This field
stays null when Package
first initiated. If you want to use this before
any other method that affects package.json (install
, uninstall
-with save
option-, init
), you need to run forceReloadJson()
.
Returns the package directory.
Pipes the configured streams to the childProcess and handles the persistence of the pipe operation.
Force reload the package.json. Returns empty object when
opts.returnEmptyOnErr
is set to true
.
Get dependency as instance of Package.
Check wether the package has the given dependency or not.
Check devDependencies
instead of dependencies
in
package.json.
Install new dependency.
Pipe npm command output to the given stream. This process can be persistent or non-persistent. Persistent means the piping operation will be applied on the next actions too. This method should be called before the others.
Run npm script in package directory.
Uninstall package(s).
Remove dependency from the dependencies
list of
package.json.
Remove dependency from the devDependencies
list of
package.json.
Creates writable directory and returns new instance of Package pointing to created directory.
Returns the unformatted package name.
Generated using TypeDoc
This is the main class for managing npm packages on local file-system. You can do most of the stuff you do in
npm
cli using this class.Events:
Package