The perfectly simple version of Babel configured for packing your packages
Babler is available through the npm registry:
$ npm install @oneisland/babler
The Babler configuration can be extended from within the .babelrc.js in your project directory by passing any Babel options to the babelConfig
function.
// Import the babel config
const { babelConfig } = require('@oneisland/babler');
// Export the babel config (passing some options)
module.exports = babelConfig({
// Set the presets to stage-0
presets: ['@babel/preset-stage-0']
// Allow comments
comments: true,
// Prevent minification of codes
minified: false
});
The Babler CLI can be executed from within any npm script.
When installing Babler, a prepublishOnly
script will be added to your package.json
(if one does not already exist).
{
"name": "babler-test",
"version": "0.0.1",
"description": "A test package using Babler",
"main": "dist/index.js",
"scripts": {
"prepublishOnly": "oneisland-babler dist"
}
}
The argument dist
passed to the Babler CLI represents the output folder for the code after it has been run through Babler.
Babler supports path alias resolving similar to Webpack.
On execution, Babler will resolve path aliases using the baseUrl
and paths
in your jsconfig.json.
Babler will also add a git pre-commit
hook if possible which will run your prepublishOnly
script.
Copyright (c) 2019-present, OneIsland Limited