@vaju/npm-scope-prefixer
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

npm-scope-prefixer

Greenkeeper badge

CLI/API tool to prefix scope on npm packages, helpful for deploying to multiple npm registries with different scopes.

Install

Requires Node >= 10.

From npm,

npm i -g @vaju/npm-scope-prefixer

From Github Package Registry. (Guide).

( Type definitions included for TypeScript)

CLI Usage

$ npm-scope-prefixer --help

Usage: npm-scope-prefixer [options]

Changes the package.json name property to new scope.

Options:
  -V, --version          output the version number
  -s, --scope <scope>    The new scope you want to use
  -p, --pkg-path <path>  Absolute or relative path to package.json. If not provided, package.json in the
                         CWD is used.
  -h, --help             output usage information

Example

$ npm-scope-prefixer --scope @billy
## Package name re-scoped ('@xxx/my-pkg' > '@billy/my-pkg')

The @ in --scope is optional. If you skip it, this package internally adds @.

Also, you can optionally add path to the package.json. If not provided, package.json in the current working directory is used.

$ npm-scope-prefixer -s billy -p my/path/to/package.json
## Package name re-scoped ('@xxx/my-pkg' > '@billy/my-pkg')

As an npm script

Install as dev dep.

npm i --save-dev @vaju/npm-scope-prefixer

package.json

{
  "scripts": {
    "rescope": "npm-scope-prefixer -s"
  }
}

machine/ci systems

npm run rescope @myorg

APIs

import { scopePrefixer } from 'npm-scope-prefixer';
// or
const { scopePrefixer } = require('npm-scope-prefixer');

// ...

await scopePrefixer(
  '@scope', // required
  'path/to/package.json' // optional
);

Licence

MIT © Vajahath Ahmed

Readme

Keywords

none

Package Sidebar

Install

npm i @vaju/npm-scope-prefixer

Weekly Downloads

11

Version

1.2.0

License

MIT

Unpacked Size

13.2 kB

Total Files

17

Last publish

Collaborators

  • vaju