https://github.com/thepassle/babel-plugin-demo
Example repo for developing babel-plugins
https://github.com/thepassle/babel-plugin-demo
Last synced: 9 days ago
JSON representation
Example repo for developing babel-plugins
- Host: GitHub
- URL: https://github.com/thepassle/babel-plugin-demo
- Owner: thepassle
- Created: 2020-04-14T14:48:19.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T03:24:21.000Z (about 2 years ago)
- Last Synced: 2024-12-20T01:21:18.750Z (2 months ago)
- Language: JavaScript
- Size: 1010 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Babel-plugin-demo
This repo is an example repo to follow along to the blogpost [Babel, Beyond Assumptions](https://medium.com/ing-blog/babel-beyond-assumptions-cf04b2dc1006).
## Usage
Install dependencies:
```bash
npm i
```Run the babel plugin:
```bash
npm start
```
You can now see the results of the plugin in `./demo/test-out.js`.Run the integration tests:
```bash
npm test
```### Adding more tests
You can add more tests by adding more `before` and `after` files in the test directory. The integration tests will run the babel plugin on the files in the `before` directory, and compare the resulting code with the files in the `after` directory.
Note that in this example I call prettier on the output of the babel plugin, so the before/after examples are clear to read for humans. If you dont need this, because you want to run a plugin at buildtime only, you can remove the call to prettier in `integration.test.js` and remove `npm run format` at the end of the `npm start` script.