esmc
🔥 Modern JavaScript, today. ✨ Blazingly fast zero-config compiler, built on @Babel and @ESLint (and @FlowType).
If you have any how-to kind of questions, please read the Contributing Guide and Code of Conduct documents.
For bugs reports and feature requests, please create an issue or ping @tunnckoCore at Twitter.
Project is semantically & automatically released on CircleCI with new-release and its New Release GitHub App.
Table of Contents
Install
This project requires Node.js ^8.9.0 || ^10.6.0. Install it using yarn or npm.
We highly recommend to use Yarn when you think to contribute to this project.
$ yarn add esmc # or globally $ yarn global add esmc
Usage
- Put your files in
src/
- Run it easily with
esmc
- Done.
Basically it creates:
dist/nodejs
folder for Node.js 8.9- or any passed version to
ESMC_NODE_VERSION
environment variable - pass
dist/nodejs/index.js
to yourpkg.module
field, if you are not using--no-esm
flag
- or any passed version to
dist/browsers
folder for>= 1%, not dead, not IE <= 11, last 1 Opera versions
browsers- or anything passed to
ESMC_BROWSERSLIST
environment variable - pass
dist/browsers/index.js
to your favorite bundler
- or anything passed to
dist/nodejs/__index.js
using esm, so you can just use it in CJS- pass it to your
pkg.main
field if you are not using--no-esm
flag, - otherwise just pass
dist/nodejs/index.js
there
- pass it to your
- generates
.js.flow
files only ondist/nodejs
folder, if--flow
is passed
Notes
By default does not compiles to CommonJS. That's intentional, because bundlers handles ES Modules great. If you want pure CommonJS pass --no-esm
flag.
- It's mostly instantaneous, because it compiles only files that are changed
- Babel config is basically externalized as babel-preset-esmc
- pass
--no-build
to disable Babel transpilation - note that you cannot use
--no-build
and--no-esm
together
- pass
- Linting is done, based on eslint-config-esmc
- If you love static typing, just pass
--flow
flag and it will run type checking before any compilation phase- note that you may want to further configure .flowconfig file
- All errors, of any phase, are styled similar to ESLint's
codeframe
reporter, so everything is just freaking awesome - It does not compiles common tests file patterns (if they are in your source directory)
- To run your files using the same config, you can pass
esmc/register
as--require
hook - You can use
esmc lint
to only lint your files, using ESLint - You can use
esmc build
to only compile your source files, using Babel - Use
--force
flag to start fresh (it deletesdist
and cleans up the caches)
To try it out, clone the repo, yarn install
and run yarn cli
- this will
compile everything from example-src/
folder as was described above.
- Make some lint error and run it
yarn cli
- Make some type error there and run
yarn cli --flow
- Make some build error and run
yarn cli
You will see that style of all errors are similar to ESLint's codeframe
reporter.
See Also
Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your existance!
- asia: Blazingly fast, magical and minimalist testing framework, for Today and Tomorrow | homepage
- babel-preset-esmc: Sharebale and the default Babel preset for the
esmc
compiler | homepage - charlike: Small, fast, simple and streaming project scaffolder for myself, but not… more | homepage
- eslint-config-esmc: Shareable and the default config for the
esmc
compiler | homepage - gitcommit: Lightweight and joyful
git commit
replacement. Conventional Commits compliant. | homepage - new-release: A stable alternative to semantic-release. Only handles NPM publishing and nothing… more | homepage
- xaxa: Zero-config linting, powered by few amazing unicorns, AirBnB & Prettier. | homepage
Contributing
Please read the Contributing Guide and Code of Conduct documents for advices.
For bugs reports and feature requests, please create an issue or ping @tunnckoCore at Twitter.
Contributors
Thanks to the hard work of these wonderful people this project is alive and it also follows the all-contributors specification.
Pull requests, stars and all kind of contributions are always welcome. 🌠
Users
You can see who uses esmc
in the USERS.md file. Please feel free adding this file if it not exists.
If you or your organization are using this project, consider adding yourself to the list of users.
Thank You! ❤️
License
Copyright (c) 2018-present, Charlike Mike Reagent <olsten.larck@gmail.com>
.
Released under the Apache-2.0 License.
This file was generated by verb-generate-readme, v0.7.0, on August 07, 2018.