@depup/pkg-dir 8.0.0-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @depup/pkg-dir
2
+
3
+ > Dependency-bumped version of [pkg-dir](https://www.npmjs.com/package/pkg-dir)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/pkg-dir
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [pkg-dir](https://www.npmjs.com/package/pkg-dir) @ 8.0.0 |
17
+ | Processed | 2026-03-17 |
18
+ | Smoke test | passed |
19
+ | Deps updated | 1 |
20
+
21
+ ## Dependency Changes
22
+
23
+ | Dependency | From | To |
24
+ |------------|------|-----|
25
+ | find-up-simple | ^1.0.0 | ^1.0.1 |
26
+
27
+ ---
28
+
29
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/pkg-dir
30
+
31
+ License inherited from the original package.
package/changes.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "bumped": {
3
+ "find-up-simple": {
4
+ "from": "^1.0.0",
5
+ "to": "^1.0.1"
6
+ }
7
+ },
8
+ "timestamp": "2026-03-17T19:39:24.471Z",
9
+ "totalUpdated": 1
10
+ }
package/index.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ export type Options = {
2
+ /**
3
+ The directory to start searching from.
4
+
5
+ @default process.cwd()
6
+ */
7
+ readonly cwd?: string;
8
+ };
9
+
10
+ /**
11
+ Find the root directory of a Node.js project or npm package.
12
+
13
+ @returns The project root path or `undefined` if it could not be found.
14
+
15
+ @example
16
+ ```
17
+ // /
18
+ // └── Users
19
+ // └── sindresorhus
20
+ // └── foo
21
+ // ├── package.json
22
+ // └── bar
23
+ // ├── baz
24
+ // └── example.js
25
+
26
+ // example.js
27
+ import {packageDirectory} from 'pkg-dir';
28
+
29
+ console.log(await packageDirectory());
30
+ //=> '/Users/sindresorhus/foo'
31
+ ```
32
+ */
33
+ export function packageDirectory(options?: Options): Promise<string | undefined>;
34
+
35
+ /**
36
+ Synchronously find the root directory of a Node.js project or npm package.
37
+
38
+ @returns The project root path or `undefined` if it could not be found.
39
+
40
+ @example
41
+ ```
42
+ // /
43
+ // └── Users
44
+ // └── sindresorhus
45
+ // └── foo
46
+ // ├── package.json
47
+ // └── bar
48
+ // ├── baz
49
+ // └── example.js
50
+
51
+ // example.js
52
+ import {packageDirectorySync} from 'pkg-dir';
53
+
54
+ console.log(packageDirectorySync());
55
+ //=> '/Users/sindresorhus/foo'
56
+ ```
57
+ */
58
+ export function packageDirectorySync(options?: Options): string | undefined;
package/index.js ADDED
@@ -0,0 +1,12 @@
1
+ import path from 'node:path';
2
+ import {findUp, findUpSync} from 'find-up-simple';
3
+
4
+ export async function packageDirectory({cwd} = {}) {
5
+ const filePath = await findUp('package.json', {cwd});
6
+ return filePath && path.dirname(filePath);
7
+ }
8
+
9
+ export function packageDirectorySync({cwd} = {}) {
10
+ const filePath = findUpSync('package.json', {cwd});
11
+ return filePath && path.dirname(filePath);
12
+ }
package/license ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@depup/pkg-dir",
3
+ "version": "8.0.0-depup.0",
4
+ "description": "[DepUp] Find the root directory of a Node.js project or npm package",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/pkg-dir",
7
+ "funding": "https://github.com/sponsors/sindresorhus",
8
+ "author": {
9
+ "name": "Sindre Sorhus",
10
+ "email": "sindresorhus@gmail.com",
11
+ "url": "https://sindresorhus.com"
12
+ },
13
+ "type": "module",
14
+ "exports": {
15
+ "types": "./index.d.ts",
16
+ "default": "./index.js"
17
+ },
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "scripts": {
22
+ "test": "xo && ava && tsd"
23
+ },
24
+ "files": [
25
+ "index.js",
26
+ "index.d.ts",
27
+ "changes.json",
28
+ "README.md"
29
+ ],
30
+ "keywords": [
31
+ "depup",
32
+ "dependency-bumped",
33
+ "updated-deps",
34
+ "pkg-dir",
35
+ "package",
36
+ "json",
37
+ "root",
38
+ "npm",
39
+ "entry",
40
+ "find",
41
+ "up",
42
+ "find-up",
43
+ "findup",
44
+ "look-up",
45
+ "look",
46
+ "file",
47
+ "search",
48
+ "match",
49
+ "resolve",
50
+ "parent",
51
+ "parents",
52
+ "folder",
53
+ "directory",
54
+ "walk",
55
+ "walking",
56
+ "path"
57
+ ],
58
+ "dependencies": {
59
+ "find-up-simple": "^1.0.1"
60
+ },
61
+ "devDependencies": {
62
+ "ava": "^5.3.1",
63
+ "tempy": "^3.1.0",
64
+ "tsd": "^0.29.0",
65
+ "xo": "^0.56.0"
66
+ },
67
+ "depup": {
68
+ "changes": {
69
+ "find-up-simple": {
70
+ "from": "^1.0.0",
71
+ "to": "^1.0.1"
72
+ }
73
+ },
74
+ "depsUpdated": 1,
75
+ "originalPackage": "pkg-dir",
76
+ "originalVersion": "8.0.0",
77
+ "processedAt": "2026-03-17T19:39:33.956Z",
78
+ "smokeTest": "passed"
79
+ }
80
+ }
package/readme.md ADDED
@@ -0,0 +1,57 @@
1
+ # pkg-dir
2
+
3
+ > Find the root directory of a Node.js project or npm package
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install pkg-dir
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```
14
+ /
15
+ └── Users
16
+ └── sindresorhus
17
+ └── foo
18
+ ├── package.json
19
+ └── bar
20
+ ├── baz
21
+ └── example.js
22
+ ```
23
+
24
+ ```js
25
+ // example.js
26
+ import {packageDirectory} from 'pkg-dir';
27
+
28
+ console.log(await packageDirectory());
29
+ //=> '/Users/sindresorhus/foo'
30
+ ```
31
+
32
+ ## API
33
+
34
+ ### packageDirectory(option?)
35
+
36
+ Returns a `Promise` for either the project root path or `undefined` if it could not be found.
37
+
38
+ ### packageDirectorySync(options?)
39
+
40
+ Returns the project root path or `undefined` if it could not be found.
41
+
42
+ #### options
43
+
44
+ Type: `object`
45
+
46
+ ##### cwd
47
+
48
+ Type: `string`\
49
+ Default: `process.cwd()`
50
+
51
+ The directory to start searching from.
52
+
53
+ ## Related
54
+
55
+ - [pkg-dir-cli](https://github.com/sindresorhus/pkg-dir-cli) - CLI for this module
56
+ - [pkg-up](https://github.com/sindresorhus/pkg-up) - Find the closest package.json file
57
+ - [find-up](https://github.com/sindresorhus/find-up) - Find a file by walking up parent directories