# npm-publish-files

> Copy special files `npm publish` always includes to a sub directory

Latest version **1.3.1** (published 2021-03-18) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install npm-publish-files
pnpm add npm-publish-files
yarn add npm-publish-files
bun add npm-publish-files
```

Provides the command `npm-publish-files`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2021-03-18 |
| First published | 2019-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.10 |
| Dependencies | 4 |
| Unpacked size | 24.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Iiro Jäppinen |
| Maintainers | iiroj |
| Keywords | copy, dir, files, ignore, npm, publish |

## Links

- npm: https://www.npmjs.com/package/npm-publish-files
- Repository: https://github.com/iiroj/npm-publish-files
- Issues: https://github.com/iiroj/npm-publish-files/issues
- npm.io page: https://npm.io/package/npm-publish-files

## Dependencies (4)

- [globby](https://npm.io/package/globby.md) ^11.0.2
- [commander](https://npm.io/package/commander.md) ^7.1.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.4
- [npm-packlist](https://npm.io/package/npm-packlist.md) ^2.1.4

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.3.1 (latest) — 2021-03-18
- 1.2.4 — 2021-03-18
- 1.3.0 — 2021-02-21
- 1.2.5 — 2021-02-19
- 1.2.3 — 2020-06-17
- 1.2.2 — 2020-03-25
- 1.2.1 — 2020-03-17
- 1.2.0 — 2020-03-17
- 1.1.2 — 2020-03-14
- 1.1.1 — 2020-03-06
- 1.1.0 — 2020-03-03
- 1.0.21 — 2019-12-30
- 1.0.20 — 2019-12-01
- 1.0.19 — 2019-09-25
- 1.0.18 — 2019-09-22
- … 20 more at https://npm.io/package/npm-publish-files/versions

## README

# npm-publish-files

[![GitHub Actions](https://github.com/iiroj/npm-publish-files/workflows/Tags/badge.svg)](https://github.com/iiroj/npm-publish-files/actions)
[![version](https://img.shields.io/npm/v/npm-publish-files.svg)](https://www.npmjs.com/package/npm-publish-files)
[![code size](https://img.shields.io/github/languages/code-size/iiroj/npm-publish-files.svg)](https://github.com/iiroj/npm-publish-files)
[![dependencies](https://img.shields.io/david/iiroj/npm-publish-files.svg)](https://github.com/iiroj/npm-publish-files/blob/master/package.json)
[![devDependencies](https://img.shields.io/david/dev/iiroj/npm-publish-files.svg)](https://github.com/iiroj/npm-publish-files/blob/master/package.json)

```sh
❯ npx npm-publish-files --help
Usage: npm-publish-files [options] <dir>

Copy special files `npm publish` always includes to a sub directory

Options:
  -V, --version         output the version number
  -f, --force           overwrite existing files (default: false)
  -c, --clean           remove files instead of copying (default: false)
  -i, --include <glob>  glob for additional files (default: [])
  -x, --exclude <glob>  glob to prevent copying files (default: [])
  -h, --help            display help for command
```

If you want to build a large npm project into a sub folder `dist/`, but then treat that as the root directory for the published package, you will need to copy all other special files npm includes in the publish. Let `npm-publish-files` do that for you!

### Setup

This script will make sure all necessary files are copied to `dist/` before running `npm publish`:

```json
{
  "scripts": {
    "prepublishOnly": "npm-publish-files --force dist"
  }
}
```

Any additional files specified in the ["file" property of package.json](https://docs.npmjs.com/files/package.json#files) will also be copied.

After this your are free to run `npm publish dist`.

## Files Copied

`npm-publish-files` uses the [npm-packlist](https://github.com/npm/npm-packlist) package under the hood to determine which files to copy. Please read its readme to better understand the algorhithm.

To copy additional files, supply one or more globs with the `--include` option. All matched files will be copied to `<dir>`.

To exclude files from being copied, supply one or more globs with the `--exclude` option. These will be applied last, so they filter both the default files, as well as those matched via the `--include` option.

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