0.3.0 • Published 2 years ago

@springernature/util-context-installer v0.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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