# nccpo

> A tool to further optimize packages built with @zeit/ncc

Latest version **0.0.1** (published 2019-10-04) · MIT license · 0 weekly downloads

## Install

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

Provides the commands `nccp`, `nccpo`.

## 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.0.1 |
| Published | 2019-10-04 |
| First published | 2019-10-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10.16 |
| Dependencies | 10 |
| Unpacked size | 9.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Patrick Camacho |
| Maintainers | camacho |
| Keywords | ncc, compile, pack, optimize, static analysis, performance, bundle, bundling, speed, size, package, dependencies |

## Links

- npm: https://www.npmjs.com/package/nccpo
- Repository: https://github.com/camacho/nccpo
- Issues: https://github.com/camacho/nccpo/issues
- npm.io page: https://npm.io/package/nccpo

## Dependencies (10)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [execa](https://npm.io/package/execa.md) ^2.0.4
- [uuid4](https://npm.io/package/uuid4.md) ^1.1.4
- [pkg-dir](https://npm.io/package/pkg-dir.md) ^4.2.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [minimist](https://npm.io/package/minimist.md) ^1.2.0
- [temp-dir](https://npm.io/package/temp-dir.md) ^2.0.0
- [wrapline](https://npm.io/package/wrapline.md) ^2.0.1
- [yarn-or-npm](https://npm.io/package/yarn-or-npm.md) ^3.0.1
- [format-package](https://npm.io/package/format-package.md) ^5.2.0

## Alternatives

- [raw-loader](https://npm.io/package/raw-loader.md) — 4.3M weekly downloads
- [plop](https://npm.io/package/plop.md) — 1.4M weekly downloads
- [webpack-deadcode-plugin](https://npm.io/package/webpack-deadcode-plugin.md) — 80.3K weekly downloads
- [@storybook/preact-vite](https://npm.io/package/@storybook/preact-vite.md) — 54.2K weekly downloads
- [vite-plugin-transform](https://npm.io/package/vite-plugin-transform.md) — 2.4K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2019-10-04
- 0.0.0 — 2019-10-02

## README

<p align="center">
  <img height="314" width="347" src="./assets/logo@0.5x.png">
</p>

# ncc package optimization

`nccpo` sits on top of the [`@zeit/ncc`](https://github.com/zeit/ncc) project, and adds additional optimization to the generated builds by stripping away bundled `package.json` dependencies and automatically `pack`-ing the build.

Following in the steps of `zeit`'s philosophy of zero configuration, there is no configuration needed to run `nccpo`:

```
nccpo build ./src/index.ts -o dist [-- pack arguments]
```

All other commands are passed directly to the [`@zeit/ncc`](https://github.com/zeit/ncc) module, making `nccp` a full stand-in:

```sh
npx nccpo run src/index.ts
```

## Installation

The package can be installed globally or run by `npx`

<!-- AUTO-GENERATED-CONTENT:START (INSTALL) -->

```sh
yarn add nccpo @zeit/ncc@^0.20.5
```

<!-- AUTO-GENERATED-CONTENT:END (INSTALL) -->

## Usage

This module provides a simple CLI command, `nccpo`, that fronts the [`@zeit/ncc`](https://github.com/zeit/ncc) project with a bit of additional build behavior.

If combined with [Yarn](https://yarnpkg.com/) or [`npm`](https://npmjs.org), it can be run as:

```sh
yarn nccpo help
# or
npx nccpo help
```

It can also be used as part of an [npm script](https://docs.npmjs.com/misc/scripts):

```json
{
  "scripts": {
    "build": "tsc",
    "predist": "yarn test",
    "dist": "nccpo build src/index.js -o dist",
    "prepublishOnly": "yarn dist"
  },
  "devDependencies": {
    "@camacho/nccp": "latest"
  }
}
```

```sh
yarn format:pkg
```

### CLI

The CLI accepts the `@zeit/ncc` build arguments:

```sh
yarn @camacho/nccp build src/index.ts -o dist
```

## Integrating

## Development

The repository comes with several built in tools to help maintain the package. All the scripts are run through `yarn`.

### Building

To create a production ready version of the application, run:

```sh
yarn dist
```

To create a fresh, unbundled build of the application, run:

```sh
yarn build
```

To go into watch mode (which is not necessary for testing):

```sh
yarn dev
```

### Docs

Documentation helps lower the barrier of entry and get new users involved. It can also make them feel welcome to the project and more willing to contribute or ask questions.

To keep the documentation up to date, run:

```sh
yarn docs
```

### Formatting

To help remove any worries about content consistency, formatting is managed automatically with [`prettier`](https://github.com/prettier/prettier), and [`format-package`](https://github.com/camacho/format-package).

These formatters can be run with:

```sh
yarn format
```

### Linting

The code linters help catch simple bugs and keep the codebase consistent. They can be run with:

```sh
yarn lint
```

#### Commit Messages

Commit messages are linted with [`commitlint`](https://github.com/conventional-changelog/commitlint) to help with consistency and enable [`semantic-release`](https://github.com/semantic-release/semantic-release) in the future.

### Git Hooks

A series of GitHooks have been setup and are managed through [`husky`](https://github.com/typicode/husky) and [`lint-staged`](https://github.com/okonet/lint-staged). These hooks automate dependency installation, formatting, testing, commit linting, and a host of other behavior.

### Scripts

These scripts can be run via `yarn` or `npm run`:

<!-- AUTO-GENERATED-CONTENT:START (SCRIPTS) -->

| Script           | Description                                                                                                      |
| ---------------- | ---------------------------------------------------------------------------------------------------------------- |
| `build`          | transpile TypeScript files in the `src` directory into JavaScript files in the `build` directory                 |
| `clean`          | clean `build` and `dist` directory                                                                               |
| `dev`            | run [`ts-node-dev`](https://github.com/whitecolor/ts-node-dev) with `src/cli/index.ts` entrypoint                |
| `dist`           | package a dist version of the repository (dogfooding)                                                            |
| `docs`           | update auto-generated-content blocks in [Markdown](https://guides.github.com/features/mastering-markdown/) files |
| `format`         | format repository code                                                                                           |
| `format-package` | format package.json files using [format-package](<(https://github.com/camacho/format-package)>)                  |
| `format-source`  | format source content using [prettier](<(https://github.com/prettier/prettier)>)                                 |
| `gamut`          | run the full gamut of checks - reset environment, generate docs, format and lint code, run tests, and build      |
| `lint`           | lint the application code                                                                                        |
| `prepublishOnly` | build the package before publishing                                                                              |
| `prerelease`     | `yarn gamut`                                                                                                     |
| `release`        | `semantic-release`                                                                                               |
| `reset`          | clean `dist`, `build`, and `node_modules` directories                                                            |
| `start`          | run the compiled application from `dist` directory                                                               |
| `start-dev`      | run the application using `ncc run`                                                                              |
| `type-check`     | check source types                                                                                               |

<!-- AUTO-GENERATED-CONTENT:END -->

**Note** - This repo depends on [husky](https://github.com/typicode/husky) and [lint-staged](https://github.com/okonet/lint-staged) to automatically format code and update documents. If these commands are not run, code changes will most likely fail.

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