1.0.11 • Published 3 years ago

@art-suite/source-root-finder v1.0.11

Weekly downloads
585
License
ISC
Repository
github
Last release
3 years ago

ArtSuite.SourceRootFinder

  • Purpose: given a path to a directory or file, find the root directory of that containing project.
  • Strategy: look in the specified directory and each parent directory for files matching the names of one of the indicatory files/directories (default: package.json and .git)

Install

npm install @art-suite/source-root-finder

Usage

{SourceRootFinder, findSourceRoot, findSourceRootSync} = require "@art-suite/source-root-finder"

# find with max async to not tie up the process; returns a Promise
findSourceRoot "./"
# .then (result) -> result === "~/myProject"

# just give me the results right now! - returns the string
findSourceRootSync "./"
# === "~/myProject"

# custom source-root-finder
myRubySourceRootFinder = indicatorFiles: ["Rakefile", ".gemspec"]
myRubySourceRootFinder.findSourceRootSync "~/dev/myRubyProject/src/deep/in/a/ruby/project"
# === "~/dev/myRubyProject"
1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago