@springernature/util-context-installer

0.3.0 • Public • Published

Context Installer

NPM version Node version MIT License

This package allows dynamic installation of the brand-context NPM package used in the Elements Design System.
It crawls the filesystem for packages (by searching for package.json files) and checks if a brand-context version is defined. If it finds one, it install it as a dependency relative to the module where it was found.

Internally it uses the util-package-installer module.

Options

installPath

Type: String
Required: false
Default: __dirname
Path to start crawling the filesystem

reporting

Type: Boolean
Required: false
Default: true
Output reporting to the CLI

contextName

Type: String
Required: false
Default: @springernature/brand-context
Name of the brand context on NPM

Examples

Simple usage (async/await style)

Crawl the filesystem starting from the directory containing the currently executing file.

const install = require('@springernature/util-context-installer');

(async () => {
    try {
        await install();
    } catch (error) {
        console.error(error);
    }
})();

With options (async/await style)

Crawl the filesystem starting from the current working directory, suppress CLI output, and specify a custom brand context name.

const install = require('@springernature/util-context-installer');

(async () => {
    try {
        await install(process.cwd(), false, '@myusername/brand-context');
    } catch (error) {
        console.error(error);
    }
})();

License

MIT License © 2022, Springer Nature

Dependencies (5)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @springernature/util-context-installer

    Weekly Downloads

    1

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    12.3 kB

    Total Files

    9

    Last publish

    Collaborators

    • ndv3997
    • sndigital
    • rseidelsohn
    • testingsabrina
    • roshandeorukhkar-sn
    • benjclark
    • sonniesedge
    • rlau
    • dotcode
    • joseluisbolos
    • hollsk
    • moddular
    • jpw
    • nickcall
    • howlingmad
    • davidpauljunior
    • morgaan