Wondering what’s next for npm?Check out our public roadmap! »

ember-wrap

0.1.4 • Public • Published

ember-wrap

Note: this isn't an Ember addon, it's a shell script. 😛

ember-wrap is a shell script that transforms node modules into standalone JavaScript files. It is a workaround for some of ember-browserify's shortcomings, namely trouble with transpiling ES6 syntax and poor compatibility with addons. Once the standalone JS files are generated, you can move them to vendor/ and import them in your ember-cli-build.js as usual.

Install

$ npm install -g ember-wrap

Example

Let's try installing git-data, which is a module that uses ES6.

Within an Ember project:

$ npm install git-data
$ wrap git-data
$ ls vendor/ # now has git-data.js and git-data-shim.js 

Add the following to your ember-cli-build.js:

app.import('vendor/git-data.js')
app.import('vendor/git-data-shim.js')

And import the module freely in your Ember project:

import GitData from 'git-data'
window['git-data'] // => undefined

If necessary, you can run wrap in npm's postinstall hook. This is useful if you want to keep a dependency up-to-date.

// place this in package.json
{
  "scripts": {
    "postinstall": "wrap git-data"
  }
}

Docs


  Usage: wrap [options] <module>

  Options:

    -o, --outdir <dirname>    [default: vendor/]

      Output directory.

  Examples:

    Note that the modules below use ES6 features.

    $ npm install git-data
    $ wrap git-data

    $ npm install joi
    $ wrap joi

    $ wrap --outdir somedir/ joi

License

MIT

Keywords

none

Install

npm i ember-wrap

DownloadsWeekly Downloads

2

Version

0.1.4

License

MIT

Last publish

Collaborators

  • avatar