1.0.2 • Published 7 years ago

add-package-prefix v1.0.2

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

add-package-prefix

build status code coverage code style styled with prettier made with lass license

Add a (scope-friendly) prefix to an npm package name

Useful when you have a tool that allows package name shorthands. e.g., babel plugins are resolved by either the direct package name or babel-plugin-${packageName}.

Table of Contents

Install

npm:

npm install add-package-prefix

yarn:

yarn add add-package-prefix

Usage

addPackagePrefix(prefix : string, packageName : string)

Prefixes the packageName with the given prefix, ignoring any package scope. Automatically converts spaces to hyphens. prefix will not be added if packageName already contains the prefix.

const addPackagePrefix = require('add-package-prefix');

addPackagePrefix('babel-plugin', 'my-cool-project');        // => 'babel-plugin-my-cool-project'
addPackagePrefix('webpack-plugin', '@scope/awesome-thing'); // => '@scope/webpack-plugin-awesome-thing'
addPackagePrefix('yep yep', 'this is fun');                 // => 'yep-yep-this-is-fun'
addPackagePrefix('babel-plugin', 'babel-plugin-something'); // => 'babel-plugin-something'

Contributors

Name
YellowKirby

License

MIT © YellowKirby

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago