npm

Need private packages and team management tools?Check out npm Orgs. »

compiled

1.19.1 • Public • Published

compiled

Compiles the ES* bundle to your NodeJS version on install

NPM

Build status semantic-release

Read JavaScript needs the compile step (on install) blog post. If you want to precompile bundles instead of asking the client to do this, see pre-compiled.

Install and use

npm install -S compiled

Add the configuration to your project's package.json file (I am assuming the root source file is src/main.js)

"config"{
  "compiled": {
    "dir": "dist",
    "files": ["src/main.js"]
  }
}

You can list multiple files in files list - each bundle will be processed separately.

Define the following scripts in the package.json

{
    "scripts": {
        "build": "build",
        "postinstall": "compile"
    },
    "main": "dist/main.compiled.js"
}

Multiple bundles

Good example is the left-behind repo. It has the main code and a bin script. Each is compiled separately.

Force features

You can force features to the list, maybe they are not detected by the feature tests. For example, to support the new string repeat method

"config"{
  "compiled": {
    "dir": "dist",
    "files": ["src/main.js"],
    "features": ["StringMethods"]
  }
}

Use the names returned by ES feature tests

Debug and development

If you run this code using DEBUG=compiled variable, it will print debug log messages. For example

$ DEBUG=compiled npm run build
> compiled@0.0.0-semantic-release test-build /Users/kensho/git/compiled
> node bin/build.js src/main.js
  compiled building from +0ms src/main.js
  compiled saved bundle +69ms dist/bundle.js
  compiled scanning for es features +39ms dist/bundle.js
  compiled used ES features +15ms [ 'arrow', 'letConst', 'templateString' ]
  compiled saved file with found es features +3ms dist/es6-features.json

Small print

Author: Gleb Bahmutov © 2016

License: MIT - do anything with the code, but don't blame me if it does not work.

Spread the word: tweet, star on github, etc.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2016 Gleb Bahmutov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

install

npm i compiled

Downloadsweekly downloads

70

version

1.19.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability