Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wisersolutions/transpile-js
Provides default Babel config and build scripts for other modules.
https://github.com/wisersolutions/transpile-js
Last synced: 3 days ago
JSON representation
Provides default Babel config and build scripts for other modules.
- Host: GitHub
- URL: https://github.com/wisersolutions/transpile-js
- Owner: WiserSolutions
- License: mit
- Created: 2018-09-25T08:07:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T11:11:21.000Z (over 1 year ago)
- Last Synced: 2024-04-14T04:48:48.291Z (7 months ago)
- Language: JavaScript
- Size: 850 KB
- Stars: 1
- Watchers: 38
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# transpile-js
Default Babel config and build scripts for other JavaScript packages
## Use
1. Install using:
```sh
npm install @wisersolutions/transpile-js
```
1. Create a `babel.config.js` or `.babelrc.js` file in the root folder of your package:
```javascript
module.exports = require('@wisersolutions/transpile-js/babel.config')
```
_This step is optional, but needed if you use any other tools that rely on Babel, such as
Eslint or Jest. However, if you do this, you need to install the used presets
(`@babel/preset-env` & `@babel/preset-react`) in your project as well._
1. Add a pre-publish task to `package.json` and set the entry points for the published package:
```json5
{
"main": "./lib/index.js",
"module": "./es/index.js",
"scripts": {
"prepublishOnly": "transpile-js"
}
}
```
(assuming your entry point is `src/index.js`).
1. Add `/es` and `/lib` to `.gitignore` and create (and populate if needed) a `.npmignore` file,
so that the transpiled code isn't added to VCS, but it _is_ published.## Development
### Install
Install dependencies using:
```sh
npm install
```### Develop
After you modify sources, run the following (or set up your IDE to do it for you):
- format the code using `npm run format`
- lint it using `npm run lint`and fix the errors, if there are any.
### Publish
Publishing is done in two steps:
1. Create a new version tag and push it to the repository:
```sh
npm version
git push --follow-tags
```
1. Build and publish the new version as a npm package:
```sh
npm publish --access public
```