@robmarr/clean-package-name

v1.0.2
remove unwanted chars or the scope from an npm package name

clean-package-name

JavaScript Style Guide Coverage Status Pipeline Status npm version chat

A script that cleans up a package name for use in other scripts.

Usage

This script will attempt to read the package name from the environment via npm_package_name or by reading the local package.json.

It will then either trim problem characters from the name:

npx @robmarr/clean-package-name
// returns scope/clean-package-name
// (anything but letters, numbers, underscores, dashes and forward slashes are removed)

The npm scope of a package can be removed via the --no-scope option.

npx @robmarr/clean-package-name --no-scope
// returns clean-package-name
// (again removes problem characters but then returns everything after the first forward slash)

License

Unless stated otherwise all works are:

  • Copyright © Robin Marr

and licensed under:

npm i @robmarr/clean-package-name

Metadata

  • ISC
  • Whatever
  • Robin Marr
  • released 12/27/2021

Downloads

Maintainers