Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: maximum call stack size exceeded at paths.js (findYarnLock function) #811

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading