Skip to content

Commit

Permalink
Add babel config
Browse files Browse the repository at this point in the history
  • Loading branch information
mjmasn committed Apr 10, 2021
1 parent af8c33b commit 14fb181
Show file tree
Hide file tree
Showing 5 changed files with 2,344 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[*]
indent_size = 2
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# babel-config
Reusable Babel config
# @devsht/babel-config

Reusable Babel config with TypeScript & React support

## Installation

```
npm i -D @devsht/babel-config
```

or

```
yarn add --dev @devsht/babel-config
```

## Usage

Create a **babel.config.json** and add this package to the presets array.

```
{
"presets": ["@devsht/babel-config"]
}
```
17 changes: 17 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = function () {
return {
plugins: [
require('@babel/plugin-transform-runtime'),
require('@babel/plugin-proposal-class-properties'),
require('@babel/plugin-proposal-object-rest-spread'),
require('@babel/plugin-proposal-nullish-coalescing-operator'),
require('@babel/plugin-proposal-optional-chaining'),
require('babel-plugin-styled-components'),
],
presets: [
require('@babel/preset-env'),
[require('@babel/preset-react'), { runtime: 'automatic' }],
require('@babel/preset-typescript'),
],
};
};
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "@devsht/babel-config",
"version": "0.0.0",
"description": "Reusable Babel config",
"main": "index.js",
"repository": "[email protected]:devsht/babel-config.git",
"author": "Michael Mason <[email protected]>",
"prettier": "@devsht/prettier-config",
"devDependencies": {
"@devsht/prettier-config": "^1.0.0",
"prettier": "^2.2.1"
},
"dependencies": {
"@babel/cli": "^7.13.14",
"@babel/core": "^7.13.15",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.13.8",
"@babel/plugin-proposal-object-rest-spread": "^7.13.8",
"@babel/plugin-proposal-optional-chaining": "^7.13.12",
"@babel/plugin-transform-runtime": "^7.13.15",
"@babel/preset-env": "^7.13.15",
"@babel/preset-react": "^7.13.13",
"@babel/preset-typescript": "^7.13.0",
"@babel/runtime": "^7.13.10",
"babel-plugin-styled-components": "^1.12.0"
}
}
Loading

0 comments on commit 14fb181

Please sign in to comment.