Skip to documentation

reference

Migration — @stackline/find-parent-dir

Project migration notes for @stackline/find-parent-dir 1.0.5. Review behavior, requirements and limitations.

Versioned project notes for @stackline/find-parent-dir 1.0.5. Original attribution is retained in the linked repository.

Migration

Keep existing imports

Install the Stackline package under the historical dependency key:

npm install find-parent-dir@npm:@stackline/find-parent-dir

Existing code remains unchanged:

const findParentDir = require('find-parent-dir')
const root = findParentDir.sync(__dirname, 'package.json')

The equivalent package.json entry is:

{
  "dependencies": {
    "find-parent-dir": "npm:@stackline/find-parent-dir@^1.0.1"
  }
}

Adopt the scoped name

npm install @stackline/find-parent-dir
const findParentDir = require('@stackline/find-parent-dir')

Optional modern APIs

import findParentDir, { promise, sync } from '@stackline/find-parent-dir'

const first = sync(process.cwd(), 'package.json')
const second = await promise(process.cwd(), '.git')

Error migration note

Code running beneath an inaccessible directory can now receive the actual filesystem error. This is the documented upstream behavior and prevents a search from silently continuing into a parent that the original request could not safely inspect. Handle callback errors, synchronous throws, or Promise rejections as appropriate.

Package reference