# cujs

> A configurable wrapper around uglifyjs

Latest version **0.2.2** (published 2019-10-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install cujs
pnpm add cujs
yarn add cujs
bun add cujs
```

Provides the command `cujs`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2019-10-08 |
| First published | 2018-04-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 5 |
| Unpacked size | 9.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Raphael von der Grün |
| Maintainers | raphinesse |
| Keywords | cli, config, configurable, cosmiconfig, defaults, uglify, uglify-es, uglifyjs, zero-config |

## Links

- npm: https://www.npmjs.com/package/cujs
- Repository: https://github.com/raphinesse/cujs
- Homepage: https://github.com/raphinesse/cujs#readme
- Issues: https://github.com/raphinesse/cujs/issues
- npm.io page: https://npm.io/package/cujs

## Dependencies (5)

- [debug](https://npm.io/package/debug.md) ^4.1.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [npm-which](https://npm.io/package/npm-which.md) ^3.0.1
- [cosmiconfig](https://npm.io/package/cosmiconfig.md) ^5.2.0
- [shell-quote](https://npm.io/package/shell-quote.md) ^1.6.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 0.2.2 (latest) — 2019-10-08
- 0.2.1 — 2019-03-28
- 0.2.0 — 2018-04-11
- 0.1.1 — 2018-04-09
- 0.1.0 — 2018-04-09

## README

# cujs [![Build Status](https://travis-ci.org/raphinesse/cujs.svg?branch=master)](https://travis-ci.org/raphinesse/cujs)

> [siː juː ʤeɪ ɛs] – Cosmic UglifyJS

A CLI wrapper around `uglifyjs`. Configurable with sensible defaults.\
Make uglification ~~great~~ sane again!

It turns this
```json
{
  "name": "awesome-lib",
  "version": "0.42.0",
  "scripts": {
    "minify": "uglifyjs dist/awesome-lib.js -mco dist/awesome-lib.min.js --comments /^!/ --source-map \"content='dist/awesome-lib.js.map',url='awesome-lib.min.js.map'\""
  }
}
```

into this
```json
{
  "name": "awesome-lib",
  "version": "0.42.0",
  "scripts": {
    "minify": "cujs dist/awesome-lib.js"
  }
}
```

## Install

```
$ npm i -D cujs uglify-es
```

Instead of `uglify-es`, you can install any other package that provides a binary named `uglifyjs` with a compatible interface.


## Usage

`cujs` uses [cosmiconfig] to collect configuration before calling `uglifyjs`. That means, `cujs` will look for configuration (all the way up the directory tree until it hits the home directory) in the following places:

- `cujs` property in `package.json`
- `.cujsrc` file in JSON or YAML format
- `cujs.config.js` file exporting a JS object

You can use camelCase variants of all [options supported by `uglifyjs`][options] in your configuration. In addition to that, you can also configure input files with the `input` key instead of passing them as arguments. Consider this example `cujs.config.js`:

```js
module.exports = {
  input: ['foo.js', 'bar.js'],
  output: 'foo.min.js',
  compress: false,
  sourceMap: { url: "foo.min.js.map" },
}
```

This corresponds to the following `uglifyjs` arguments:
```shell
foo.js bar.js --output foo.min.js --no-compress --source-map url="foo.min.js.map"
```

### Defaults

`cujs` applies the following defaults that differ from those of `uglifyjs`:
```js
{
  mangle: true,
  compress: true,
  sourceMap: true,
  comments: /@preserve|@license|@cc_on|^!/i,
}
```
Furthermore, `cujs` tries to be smart about some things. For example, when sourcemaps are enabled, it infers `sourceMap.url` and looks for a input source map to use as `sourceMap.content`. However, if you explicitly set any of those keys, `cujs` won't touch them.

If in doubt, run as `DEBUG=cujs cujs` to see what's going on.


## License

MIT © Raphael von der Grün


[cosmiconfig]: https://github.com/davidtheclark/cosmiconfig#cosmiconfig
[options]: https://github.com/mishoo/UglifyJS2#command-line-options

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