1.0.1 • Published 8 years ago

umd-name-transform v1.0.1

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

umd-name-transform

Transform stream for UMD bundle names

no-sudden-unpublish

Why

Lets say you have a scoped npm package with some esnext code and you want to say use rollup to bundle it for the browser with UMD.

rollup -c --name '@somescope/somepackagename' -o dist/somepackagename.js

the result will be

factory((global.@somescope/somepackagename = {})

This module attempts to fix that so that results looks like

factory((global['@somescope/somepackagename']= {})

Also will convert dashes to camelcase my-module-with-dashes to myModuleWithDashes

Install

npm install umd-name-transform --save-dev

Usage

rollup -c --name '@somecope/somepackagename' | umd-name-transform -o dist/somepackagename.js

This will transform the output from rollup and write to dist/somepackagename.js

Note this module assumes that you have created the given directories in the above case its dist if your are using cli:

mkdir -p nameOfDir && rollup -c --name '@somecope/somepackagename' | umd-name-transform -o nameOfDir/somepackagename.js

TODO

  • Programmatic API support