Skip to content

Commit

Permalink
fix(paths): if no project root is found, use consuming root
Browse files Browse the repository at this point in the history
  • Loading branch information
varl committed Jun 14, 2021
1 parent 59c5675 commit c27bceb
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/utils/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@ const PACKAGE_ROOT = path.join(__dirname, '..', '..')
const CONFIG_DIR = path.join(PACKAGE_ROOT, 'config')
const TEMPLATE_DIR = path.join(PACKAGE_ROOT, 'templates')

const PROJECT_ROOT = findup.sync(
directory => {
const amiroot = [
'.git',
'.github',
'yarn.lock',
'package-lock.json',
].map(i => findup.sync.exists(path.join(directory, i)))
return amiroot.includes(true) && directory
},
{
cwd: CONSUMING_ROOT,
type: 'directory',
}
)
const PROJECT_ROOT =
findup.sync(
directory => {
const amiroot = [
'.git',
'.github',
'yarn.lock',
'package-lock.json',
].map(i => findup.sync.exists(path.join(directory, i)))
return amiroot.includes(true) && directory
},
{
cwd: CONSUMING_ROOT,
type: 'directory',
}
) || CONSUMING_ROOT

const GIT_DIR = path.join(PROJECT_ROOT, '.git')
const PROJECT_HOOKS_DIR = path.join(PROJECT_ROOT, '.hooks')
Expand Down

0 comments on commit c27bceb

Please sign in to comment.