# top-pkg-dir

> Find top most root directory of a Node.js project or npm package.

Latest version **0.0.3** (published 2019-07-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install top-pkg-dir
pnpm add top-pkg-dir
yarn add top-pkg-dir
bun add top-pkg-dir
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2019-07-16 |
| First published | 2019-07-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.8.0 |
| Dependencies | 1 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Özüm Eldoğan |
| Maintainers | ozum |
| Keywords | package, json, top, most, root, npm, entry, find, up, find-up, findup, look-up, look, file, search, match, resolve, parent, parents, folder, directory, dir, walk, walking, path |

## Links

- npm: https://www.npmjs.com/package/top-pkg-dir
- Repository: https://github.com/ozum/measy
- Homepage: https://github.com/ozum/top-pkg-dir#readme
- Issues: https://github.com/ozum/top-pkg-dir/issues
- npm.io page: https://npm.io/package/top-pkg-dir

## Dependencies (1)

- [pkg-dir](https://npm.io/package/pkg-dir.md) ^4.2.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.3 (latest) — 2019-07-16
- 0.0.2 — 2019-07-12
- 0.0.1 — 2019-07-10

## README

# top-pkg-dir

Find top most root directory of a Node.js project or npm package.

# Example

```
└─ Development
   └─ Projects
      └─ project-a
         ├─ package.json
         ├─ lib
         └─ node_modules
            ├─ project-b
            └─ lib
               └─ example.js
```

**example.js**

```js
import topPkgDir from "top-pkg-dir";

async function() {
  const topProjectDir = await topPkgDir(); // '/Development/Projects/project-a'
}
```

# API

## topPkgDir(cwd?)

Returns a `Promise` for either the top most project root path or `undefined` if it couldn't be found.

## topPkgDir.sync(cwd?)

Returns the top most project root path or `undefined` if it couldn't be found.

### cwd

Type: `string`<br>
Default: `process.cwd()`

Directory to start from.

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