Skip to content

Commit

Permalink
fix: support yarn.lock discovery on non-unix (#811)
Browse files Browse the repository at this point in the history
Fixes an issue which manifested as "maximum call stack size exceeded at paths.js (findYarnLock function)"
  • Loading branch information
CelsoDeCarvalho committed Aug 21, 2023
1 parent a3490e0 commit 22a6863
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cli/src/lib/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ const shellSource = path.dirname(
)
const shellAppDirname = 'src/D2App'

const findYarnLock = (base) => {
if (base === '/') {
const findYarnLock = (base, rootDirectory) => {
if (base === rootDirectory) {
return null
}

const yarnLock = path.join(base, './yarn.lock')
if (fs.existsSync(yarnLock)) {
return yarnLock
}
return findYarnLock(path.dirname(base))
return findYarnLock(path.dirname(base), rootDirectory)
}

module.exports = (cwd = process.cwd()) => {
const base = path.resolve(cwd)
const rootDirectory = path.parse(cwd).root
const paths = {
babelConfig: path.join(__dirname, '../../config/babel.config.js'),
configDefaultsApp: path.join(
Expand All @@ -44,7 +44,7 @@ module.exports = (cwd = process.cwd()) => {

base,
package: path.join(base, './package.json'),
yarnLock: findYarnLock(base),
yarnLock: findYarnLock(base, rootDirectory),
dotenv: path.join(base, './.env'),
config: path.join(base, './d2.config.js'),
readme: path.join(base, './README.md'),
Expand Down

0 comments on commit 22a6863

Please sign in to comment.