Symlinker

Symlinker

Constructs and removes symbolic links between local packages a monolithic repository.

Constructor

new Symlinker(opts)

Source:
Parameters:
Name Type Description
opts SymlinkerOptions

configuration options.

Members

(static) PackageReference

Source:

A PackageReference class to use when manipulating packages. Can be overridden by a class that extends PackageReference.

Example

Overriding PackageReference

class CustomPackageReference extends PackageReference { }
Symlinker.PackageReference = CustomPackageReference;
let linker = new Symlinker();
let refs = linker.filter(...); // => Array<CustomPackageReference>

_opts :SymlinkerOptions

Source:

Configuration options.

Type:

Methods

create(manifest) → {Promise}

Source:

Create symbolic links for all local resources inside a package.

Parameters:
Name Type Description
manifest String

the path to a manifest (package.json) file.

Returns:

resolves when all symbolic links have been created.

Type
Promise

filter(source, dependencies, devDependencies) → {Array.<PackageReference>}

Source:

Given all package dependencies, provides the symbolic links that should be created, filtering out dependencies that shouldn't be symlinked.

Parameters:
Name Type Description
source String

the location of the manifest file being analyzed

dependencies null | Object.<String, String>

the list of dependencies for a package.

devDependencies null | Object.<String, String>

the list of development dependencies for a package.

Returns:

the packages that should be symbolicly linked.

Type
Array.<PackageReference>

parseManifest(manifest) → {Promise.<Object>}

Source:

Opens and reads a manifest file. fs.readFile used instead of require to ensure that the file isn't cached so changes to the file are caught.

Parameters:
Name Type Description
manifest String

the path to a manifest (package.json) file.

Returns:

resolves to the contents of the manifest file.

Type
Promise.<Object>

remove(manifest) → {Promise}

Source:

Remove symbolic links to all local resources inside a package. Reverses Symlinker#create, based on the listed dependencies and devDependencies. If a package has been renamed or otherwise changed, the symlink based on the old name will not be removed.

Parameters:
Name Type Description
manifest String

the path to a manifest (package.json) file.

Returns:

resolves when the symbolic links have been removed.

Type
Promise