- PackageInstaller
- PackageWatcher
- Model
- LocalPackage
- LocalPackageConfig
- LocalPackageDependencyTree
- LocalPackageDependencyTreeNode
- LocalPackageState
- PackageReference
- IO
- FSUtil
- PackageConfigReader
- PackageConfigWriter
- PackageFinder
- PackageReader
- UI
- PromptUtil
Method to prepare and install local packages into other local packages
Copy all the files of a local dependency to the node_modules folder of the targeted package
Parameters
currentPackage
LocalPackagedependencyPackage
LocalPackageclearDirectory
boolean If set to true, the directory in which the dependency is installed is cleared
Returns void
Create symlinks for the binary commands defined by a local dependency to the node_modules/.bin folder of the targeted package
Parameters
currentPackage
LocalPackagedependencyPackage
LocalPackage
Returns void
Find all the missing dependencies for the targeted node by checking if the corresponding directory exists in its node_module folder. When computing a list of required dependencies, it also includes the dependencies defined by all of the node's children packages.
Parameters
node
LocalPackageDependencyTreeNode<T>
Returns Array<PackageReference>
Install the remote dependencies via NPM for the targeted package
Parameters
currentPackage
LocalPackage
Returns void
Run the prepublish script (if it exists) via NPM for the targeted package
Parameters
currentPackage
LocalPackageState
Extends EventEmitter
Watch the files for the provided list of local packages
Parameters
packages
Array<LocalPackageConfig>
Register a callback for the change event
Parameters
callback
function (p: LocalPackageState): void
Unregister a callback for the change event
Parameters
callback
function (p: LocalPackageState): void
Find the package that best matches the provided file path
Parameters
filePath
string
Returns any
Models used throughout the project
Extends PackageReference
Contains the information from a parsed npm package
Parameters
params
Objectparams.name
string The package's nameparams.version
string The package's versionparams.path
string The package's pathparams.children
Array<PackageReference> The package's children (optional, default[]
)params.devDependencies
Array<PackageReference> The package's development children (optional, default[]
)params.script
Array<string> An array of scripts that can be run via NPM and the values are paths to the local file name (optional, default[]
)params.bin
Object<string, string> An object in which the keys are command name (optional, default{}
)
Get the available command name and their mapping to the local file name
Returns Object<string, string>
Get the children for the package.
Parameters
dev
boolean If set to true, also include the development children (optional, defaultfalse
)
Returns Array<PackageReference>
Get the scripts that can be run via NPM
Get the package's path
Returns string
Convert the instance properties to an object
Returns {name: string, version: string, path: string, dependencies: Array<PackageReference>?, devDependencies: Array<PackageReference>?, scripts: Array<string>?, bin: {}?}
Extends LocalPackage
A configured local package
Parameters
params
Objectparams.name
string The package's nameparams.version
string The package's versionparams.path
string The package's pathparams.children
Array<PackageReference> The package's children (optional, default[]
)params.devDependencies
Array<PackageReference> The package's development children (optional, default[]
)params.script
Array<string> An array of scripts that can be run via NPM (optional, default[]
)params.bin
Object<string, string> An object in which the keys are command name (optional, default{}
)params.watchEnabled
boolean If set to true, the package will be watched for changes and the values are paths to the local file name
True if the package should be watched
Returns boolean
This data structure stores the children (available locally) of packages. Each node is a local package and its children are children of that package which are available locally.
Parameters
root
LocalPackageDependencyTreeNode<T>
Get an iterator to go over each node in the tree
Parameters
includeRoot
boolean If set to false, the root node is not part of the iterator (optional, defaulttrue
)
Returns Iterable<LocalPackageDependencyTreeNode<T>>
Build a dependency tree from a root package and a list of local packages available locally.
Parameters
rootPackage
TlocalPackages
Array<T>
Returns LocalPackageDependencyTree<T>
A node within the LocalPackageDependencyTree. Each node corresponds to a local package and the node's children are its children
Parameters
localPackage
Tdependencies
Array<LocalPackageDependencyTreeNode<T>>depth
number The depth of the nodepack
The package for this nodechildren
The children for the package
Get the direct children of this node
Returns Array<LocalPackageDependencyTreeNode<T>>
Get the package corresponding to this node
Returns T
Get the depth of the node
Returns number
Get an iterator to go over all children under this node
Returns Iterable<LocalPackageDependencyTreeNode<T>>
Extends LocalPackage
A configured local package
Parameters
params
Objectparams.name
string The package's nameparams.version
string The package's versionparams.path
string The package's pathparams.children
Array<PackageReference> The package's children (optional, default[]
)params.devDependencies
Array<PackageReference> The package's development children (optional, default[]
)params.script
Array<string> An array of scripts that can be run via NPM (optional, default[]
)params.bin
Object<string, string> An object in which the keys are command name and the values are paths to the local file name (optional, default{}
)
True if the package is ready to be installed
Returns boolean
Update the ready state of the package
Parameters
ready
boolean
Returns LocalPackageState
True if watching the package for changes is enabled
Returns boolean
Enable/disable watching the package
Parameters
enabled
boolean (optional, defaulttrue
)
Returns LocalPackageState
Get the timeout handle
Returns number?
Set the timeout handle
Parameters
handle
number?
Returns LocalPackageState
A reference to an external npm package
Parameters
Get the package's name
Returns string
Get the package's version
Returns string
Convert the package reference to a descriptive string including its name and version.
Returns string
Classes to read/write files
Utility methods to interact with the local file system
Check if a file or directory exists
Parameters
absolutePath
string {string} The absolute path to the file or directory
Returns boolean True if the file or directory exists
Check if a file exists
Parameters
absolutePath
string {string} The absolute path to the file
Returns boolean True if the file exists
Check if a directory exists
Parameters
absolutePath
string {string} The absolute path to the directory
Returns boolean True if the directory exists
Utility methods to interact with the .ucrc file
Read the .ucrc file and instantiate an array of LocalPackageConfig
Parameters
projectPath
string
Returns Array<LocalPackageConfig>
Utility method for writing the .ldrc
Write the configuration to the .ldrc file
Parameters
rootPath
string The directory in which the .ldrc file will be writtendependencies
Array<LocalPackageConfig> The local package configurations
Contains utility methods to find local packages
Recursively search the provided paths for valid npm packages. It ignores any 'node_modules' folder.
Parameters
Returns Array<LocalPackage> The local packages found
Utility method to read/parse npm modules
Parse the package.json file in the provided package path and create an instance of LocalPackage
Parameters
packagePath
string
Returns LocalPackage
Determines if the provided path contains a valid npm module
Parameters
projectPath
string
Returns boolean
Create an array of PackageReference from the 'devDependencies' or 'children' entry of a package.json file.
Parameters
dependencies
Object<string, string> An object in which the keys are the package names and the values are the package version
Returns Array<PackageReference>
Classes to interact with the user
Utility methods to interact with the user via command line prompts
Prompt the user to confirm a message. If the message is accepted, the returned promise resolves successfully otherwise it is rejected.
Parameters
message
string The message to be displayed to the userskip
boolean If set to true, the prompt is not be displayed and the message is accepted
Returns Promise
Prompt the user to select a valid package path.
Parameters
defaultPath
string {string} The default path to the package
Returns Promise<string> A promise that resolves to a valid npm package path
Prompt the user to select 1 or more directories in which local project will be located
Parameters
defaultPath
string {string} The default path
Returns Promise<Array<string>> A promise that resolves to 1 or more existing directories
Show a prompt allowing the user to select a list of local packages that will be installed by this module.
Parameters
dependencies
Array<LocalPackage> {Array}
Returns Promise<Array<LocalPackage>>
Show a prompt allowing the user to select a list of local packages that will be watched by this module.
Parameters
dependencies
Array<LocalPackage> {Array}
Returns Promise