# @videojs/babel-config

> A standard babel config, so that plugins don't need the same script in every repository.

Latest version **1.0.2** (published 2023-08-18) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @videojs/babel-config
pnpm add @videojs/babel-config
yarn add @videojs/babel-config
bun add @videojs/babel-config
```

Provides the commands `babel-config-es`, `babel-config-cjs`, `babel-config-run`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2023-08-18 |
| First published | 2020-09-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 10 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Brandon Casey |
| Maintainers | phale, ddashkevich, roman-bc, walterseymourbc, videojs-user, usmanonazim, mmcclure, misteroneill, misterben, lday, imbcmdth, hswaminathan, heff, gkatsev, gesinger, essk, dmlap, brandonocasey, awaldron, abarstow |

## Links

- npm: https://www.npmjs.com/package/@videojs/babel-config
- Repository: https://github.com/videojs/babel-config
- Issues: https://github.com/videojs/babel-config/issues
- npm.io page: https://npm.io/package/@videojs/babel-config

## Dependencies (6)

- [@babel/core](https://npm.io/package/@babel/core.md) ^7.11.6
- [@babel/preset-env](https://npm.io/package/@babel/preset-env.md) ^7.11.5
- [@babel/plugin-transform-runtime](https://npm.io/package/@babel/plugin-transform-runtime.md) ^7.11.5
- [babel-plugin-add-module-exports](https://npm.io/package/babel-plugin-add-module-exports.md) ^1.0.4
- [@babel/plugin-transform-object-assign](https://npm.io/package/@babel/plugin-transform-object-assign.md) ^7.10.4
- [@babel/plugin-transform-modules-commonjs](https://npm.io/package/@babel/plugin-transform-modules-commonjs.md) ^7.10.4

## Recent versions

- 1.0.2 (latest) — 2023-08-18
- 0.2.0 (experimental) — 2020-10-08
- 1.0.1 — 2023-04-11
- 1.0.0 — 2021-12-01
- 0.1.2 — 2020-10-05
- 0.1.1 — 2020-09-30
- 0.1.0 — 2020-09-30

## README

# @videojs/babel-config

[![Build Status](https://travis-ci.org/videojs/babel-config.svg?branch=master)](https://travis-ci.org/videojs/babel-config)
[![Greenkeeper badge](https://badges.greenkeeper.io/videojs/babel-config.svg)](https://greenkeeper.io/)
[![Slack Status](http://slack.videojs.com/badge.svg)](http://slack.videojs.com)

Currently babel configs are the same for most plugins, and most of them are built using this babel config via babel. We have some libraries though that are should not be built using rollup for nodejs consumption, that are currently doing so. So this config while still consumed by [videojs-generate-rollup-config](https://github.com/videojs/videojs-generate-rollup-config) can also be used standalone with babel-cli.

Lead Maintainer: Brandon Casey [@brandonocasey](https://github.com/brandonocasey)

Maintenance Status: Stable


<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Installation](#installation)
- [Usage](#usage)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Installation

```
$ npm install --save-dev @babel/cli @videojs/babel-config
```


## Usage

1. In your rollup config add a line to delete module builds:
```js
if (config.builds.module) {
  delete config.builds.module;
}
```
2. Add a npm scripts for cjs/es dists to your package.json:

```json
{
  "build:cjs": "babel-config-cjs -d ./cjs ./src",
  "build:es": "babel-config-es -d ./es ./src",
  "watch:cjs": "npm run build:cjs -- -w",
  "watch:es": "npm run build:es -- -w"
}
```

3. verify that `main` in `package.json` is set to the cjs dist. Something like `cjs/index.js`
4. verify that `module` in `package.json` is set to the es dist. Something like `es/index.js`
5. verify that `browser` in `package.json` is set to the browser dist. Something like `dist/project-name.js`
6. Add `es` and `cjs` to `vjsstandard.ignore` in `package.json`
7. Make sure that `es/` and `cjs/` are in `files` in `package.json`
8. Add `/es` and `/cjs` to `.gitignore`.
9. Add `./es` and `./cjs` to the npm script for `clean` after `mkdir -p` and `rm -rf`.

```sh
shx rm -rf ./dist ./test/dist ./cjs ./es && shx mkdir -p ./dist ./test/dist ./cjs ./es
```


## Important things
* When running through `babel-config-cjs`, `babel-config-es`, or `babel-config-run` if the `TEST_BUNDLE_ONLY` environment variable is set **nothing** will run! This is to maintain parity with [`videojs-generate-rollup-config`](https://github.com/videojs/videojs-generate-rollup-config).
* The `babel-config-cjs` binary runs babel cli with `--verbose` and `--config-file` set to the cjs config exported here.
* The `babel-config-es` binary runs babel cli with `--verbose` and `--config-file` set to the es config exported here.
* The `babel-config-run` binary runs babel cli with `--verbose` but no config file.

## Changing configuration
1. require the configuration you want to use `const config = require('@videojs/babel-config/cjs.js');`
2. Make changes to it and export: `module.export = config`.
3. Change the build scripts to  `babel-config-run --config-file <new-config> ...`

---
_Source: https://npm.io/package/@videojs/babel-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
