1 | # compiled
|
2 | > Compiles the ES* bundle to your NodeJS version on install
|
3 |
|
4 | [![NPM][compiled-icon] ][compiled-url]
|
5 |
|
6 | [![Build status][compiled-ci-image] ][compiled-ci-url]
|
7 | [![semantic-release][semantic-image] ][semantic-url]
|
8 |
|
9 | Read [JavaScript needs the compile step (on install)](http://glebbahmutov.com/blog/javascript-needs-compile-step/) blog post.
|
10 |
|
11 | ## Install and use
|
12 |
|
13 | npm install -S compiled
|
14 |
|
15 | Define the following scripts in the `package.json`
|
16 | (I am assuming the root source file is `src/main.js`)
|
17 |
|
18 | ```json
|
19 | {
|
20 | "scripts": {
|
21 | "build": "build src/main.js",
|
22 | "postinstall": "compile"
|
23 | },
|
24 | "main": "dist/compiled.js"
|
25 | }
|
26 | ```
|
27 |
|
28 | ## Debug and development
|
29 |
|
30 | If you run this code using `DEBUG=compiled` variable, it will print debug log messages.
|
31 | For example
|
32 |
|
33 | $ DEBUG=compiled npm run build
|
34 | > compiled@0.0.0-semantic-release test-build /Users/kensho/git/compiled
|
35 | > node bin/build.js src/main.js
|
36 | compiled building from +0ms src/main.js
|
37 | compiled saved bundle +69ms dist/bundle.js
|
38 | compiled scanning for es features +39ms dist/bundle.js
|
39 | compiled used ES features +15ms [ 'arrow', 'letConst', 'templateString' ]
|
40 | compiled saved file with found es features +3ms dist/es6-features.json
|
41 |
|
42 | ### Small print
|
43 |
|
44 | Author: Gleb Bahmutov © 2016
|
45 |
|
46 | * [@bahmutov](https://twitter.com/bahmutov)
|
47 | * [glebbahmutov.com](http://glebbahmutov.com)
|
48 | * [blog](http://glebbahmutov.com/blog/)
|
49 |
|
50 | License: MIT - do anything with the code, but don't blame me if it does not work.
|
51 |
|
52 | Spread the word: tweet, star on github, etc.
|
53 |
|
54 | Support: if you find any problems with this module, email / tweet /
|
55 | [open issue](https://github.com/bahmutov/compiled/issues) on Github
|
56 |
|
57 | ## MIT License
|
58 |
|
59 | Copyright (c) 2016 Gleb Bahmutov
|
60 |
|
61 | Permission is hereby granted, free of charge, to any person
|
62 | obtaining a copy of this software and associated documentation
|
63 | files (the "Software"), to deal in the Software without
|
64 | restriction, including without limitation the rights to use,
|
65 | copy, modify, merge, publish, distribute, sublicense, and/or sell
|
66 | copies of the Software, and to permit persons to whom the
|
67 | Software is furnished to do so, subject to the following
|
68 | conditions:
|
69 |
|
70 | The above copyright notice and this permission notice shall be
|
71 | included in all copies or substantial portions of the Software.
|
72 |
|
73 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
74 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
75 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
76 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
77 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
78 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
79 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
80 | OTHER DEALINGS IN THE SOFTWARE.
|
81 |
|
82 | [compiled-icon]: https://nodei.co/npm/compiled.png?downloads=true
|
83 | [compiled-url]: https://npmjs.org/package/compiled
|
84 | [compiled-ci-image]: https://travis-ci.org/bahmutov/compiled.png?branch=master
|
85 | [compiled-ci-url]: https://travis-ci.org/bahmutov/compiled
|
86 | [semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
87 | [semantic-url]: https://github.com/semantic-release/semantic-release
|
88 |
|