# publish-flat

> Publish your project without the dist directory

Latest version **1.19.21** (published 2026-11-05) · GPL-3.0 license · 0 weekly downloads

## Install

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

Provides the commands `publish-flat`, `publish-flat-copy`.

## Health

**Score 65/100 (B)** — status: active.

Positive: esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.19.21 |
| Published | 2026-11-05 |
| First published | 2019-06-12 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | ESM |
| Node | >= 22.12.0 |
| Dependencies | 4 |
| Unpacked size | 46.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 17 |
| Author | Florian Imdahl |
| Maintainers | ffflorian |
| Keywords | cli, typescript |

## Links

- npm: https://www.npmjs.com/package/publish-flat
- Repository: https://github.com/ffflorian/node-packages
- Homepage: https://github.com/ffflorian/node-packages#readme
- Issues: https://github.com/ffflorian/node-packages/issues
- npm.io page: https://npm.io/package/publish-flat

## Dependencies (4)

- [logdown](https://npm.io/package/logdown.md) 3.3.1
- [commander](https://npm.io/package/commander.md) 15.0.0
- [npm-packlist](https://npm.io/package/npm-packlist.md) 11.3.0
- [@npmcli/arborist](https://npm.io/package/@npmcli/arborist.md) 10.0.4

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.19.21 (latest) — 2026-11-05
- 1.19.20 — 2026-10-29
- 1.19.19 — 2026-10-25
- 1.19.18 — 2026-10-22
- 1.19.17 — 2026-10-22
- 1.19.16 — 2026-10-16
- 1.19.15 — 2026-10-15
- 1.19.14 — 2026-10-08
- 1.19.13 — 2026-10-02
- 1.19.12 — 2026-09-29
- 1.19.11 — 2026-09-25
- 1.19.10 — 2026-09-17
- 1.19.9 — 2026-09-10
- 1.19.8 — 2026-08-07
- 1.19.7 — 2026-07-16
- … 94 more at https://npm.io/package/publish-flat/versions

## README

# publish-flat [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![npm version](https://img.shields.io/npm/v/publish-flat.svg?style=flat)](https://www.npmjs.com/package/publish-flat)

Publish your project flattened. No more `dist` in `require('project/dist/Options')`.

## Prerequisites

- [Node.js](https://nodejs.org)
- npm (preinstalled) or [yarn](https://yarnpkg.com)

## Installation

ℹ️ This is a pure [ESM](https://nodejs.org/api/esm.html#introduction) module.

Run `yarn add publish-flat` or `npm i publish-flat`.

## Description

Here is what it does:

1. Copies your dist files together with the other release files into a temporary directory
1. Aligns your `package.json` to work with the flattened structure
1. Publishes your project from the temporary directory (optional)

### Example

#### Before

##### Directory structure of the published project:

```
.
├── dist
│   ├── index.d.ts
│   ├── index.js
│   ├── index.js.map
│   ├── Options.d.ts
│   ├── Options.js
│   └── Options.js.map
└── package.json
```

##### In other people's code:

```ts
import {Options} from 'project/dist/Options';
```

#### After

##### Directory structure of the published project:

```
.
├── index.d.ts
├── index.js
├── index.js.map
├── Options.d.ts
├── Options.js
├── Options.js.map
└── package.json
```

##### In other people's code:

```ts
import {Options} from 'project/Options';
```

## Installation

```
yarn add publish-flat
```

## CLI Usage

```
Usage: publish-flat [options] [dir]

Publish your project without the dist directory

Options:
  -V, --version        output the version number
  -y, --yarn           Use yarn for publishing (default: false)
  -f, --flatten <dir>  Which directory to flatten (default: "dist")
  -o, --output <dir>   Set the output directory (default: temp directory)
  -p, --publish        Publish (default: false)
  -h, --help           output usage information
```

## API Usage

See [`cli.ts`](./src/cli.ts).

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