Comptroller
Extends:
This is the main Comptroller class. It serves as the entry point into all of Comptroller's higher level functionality.
Static Method Summary
Static Public Methods | ||
public static |
mergePatches(a: Patch, b: Patch): Patch Merges patches generated by child packages in order to apply to the parent package. |
Constructor Summary
Public Constructor | ||
public |
Creates a new Comptroller instance. |
Member Summary
Public Members | ||
public get |
The child packages. |
|
public get |
The packages directory. |
Method Summary
Public Methods | ||
public |
getChildByName(name: string): Package | boolean A convenience method that locates a package in Comptroller#children by it's name in Package#packageJson. |
|
public |
async linkPackages() Links the packages to node_modules in a way that enables them to be resolved by other packages by name. |
|
public |
Logs patch operations. |
|
public |
readChildren(): Package[] Scans the Comptroller#packages directory, finds package.json files and generates Packages. |
|
public |
async updatePackages() Analyzes the dependencies and inherits of each package and applies the respective patches to each package. |
|
public |
updatePatches(patches: Patch[]): Patch[] Takes an array of raw patches (returned by Package#generateDependencyPatches or Package#generateInheritPatches) and updates them with the information in the Comptroller#packageJson |
|
public |
async updateSelf() Analyzes the dependencies of the root package and applies the respective patches. |
|
public |
async writePackages() Loops through all packages in Comptroller#children and writes it's package.json. |
Inherited Summary
From class Package | ||
public static |
generateExcludes(excludes: Array<string|object>): * Generates an exclude array |
|
public get |
An object representing the package's dependencies. |
|
public get |
The options to pass through to detective. |
|
public get |
A glob that matches the package's dev files |
|
public get |
An object representing the package's devDependencies. |
|
public get |
An array of package names to ignore in all operations. |
|
public get |
An array of globs that match files not to be included with the package's source files. |
|
public get |
An array of field names the package should inherit from it's parent package.json. |
|
public get |
An object representing the package's package.json. |
|
public get |
The "maximum fixed character width" parameter to pass to json-beautify. |
|
public get |
Whether or not unused dependencies should be pruned from the package.json. |
|
public get |
The package's root directory. |
|
public get |
A glob that matches the package's source files |
|
public |
async analyzeSourceDependencies(): Map<string, object> Analyzes the package's source files and returns all of the invoked dependencies mapped to the files invoking them. |
|
public |
applyPatch(patch: Patch) Applies a given patch to Package#packageJson. |
|
public |
generateDependencyPatches(dependencies: object): Patch[] Compares a dependency object (as returned from Package#analyzeSourceDependencies) with the dependencies listed in {@link Package@packageJson} and returns an array of patches. |
|
public |
Generates the patches that will satisfy Package#inherits |
|
public |
resolveDependency(dependency: string): string | boolean Takes a dependency name and resolves it to the actual dependency name, stripping any subdirectories from the dependency name (retaining @org style dependencies). |
|
public |
async writePackageJson() Writes Package#packageJson to it's respective package.json file. |
Static Public Methods
Public Constructors
public constructor() source
Creates a new Comptroller instance. It accepts all of the arguments in Package#constructor as well as...
Override:
Package#constructorParams:
Name | Type | Attribute | Description |
opts.config.packages | string |
|
The directory name where packages can be found. |
Public Members
Public Methods
public getChildByName(name: string): Package | boolean source
A convenience method that locates a package in Comptroller#children by it's name in Package#packageJson.
Params:
Name | Type | Attribute | Description |
name | string | The name of the child package. |
Return:
Package | boolean | The found package, or |
public async linkPackages() source
Links the packages to node_modules in a way that enables them to be resolved by other packages by name.
public readChildren(): Package[] source
Scans the Comptroller#packages directory, finds package.json files and generates Packages. Note that all package.json files must be in a direct subdirectory of the packages directory.
public async updatePackages() source
Analyzes the dependencies and inherits of each package and applies the respective patches to each package.
public updatePatches(patches: Patch[]): Patch[] source
Takes an array of raw patches (returned by Package#generateDependencyPatches or Package#generateInheritPatches) and updates them with the information in the Comptroller#packageJson
Params:
Name | Type | Attribute | Description |
patches | Patch[] | The patches to update. |
public async updateSelf() source
Analyzes the dependencies of the root package and applies the respective patches.
public async writePackages() source
Loops through all packages in Comptroller#children and writes it's package.json.