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: don't mkdir directories that already exist #7899

Open
wants to merge 4 commits into
base: latest
Choose a base branch
from
Open
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions workspaces/arborist/lib/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
const rpj = require('read-package-json-fast')

const { dirname, resolve, relative, join } = require('node:path')
const { existsSync } = require("node:fs")

Check failure on line 15 in workspaces/arborist/lib/arborist/reify.js

View workflow job for this annotation

GitHub Actions / Lint

Strings must use singlequote
wraithgar marked this conversation as resolved.
Show resolved Hide resolved
const { depth: dfwalk } = require('treeverse')
const {
lstat,
Expand Down Expand Up @@ -123,10 +124,12 @@
// we do NOT want to set ownership on this folder, especially
// recursively, because it can have other side effects to do that
// in a project directory. We just want to make it if it's missing.
await mkdir(resolve(this.path), { recursive: true })
let resolvedPath = resolve(this.path);

Check failure on line 127 in workspaces/arborist/lib/arborist/reify.js

View workflow job for this annotation

GitHub Actions / Lint

'resolvedPath' is never reassigned. Use 'const' instead

Check failure on line 127 in workspaces/arborist/lib/arborist/reify.js

View workflow job for this annotation

GitHub Actions / Lint

Extra semicolon
if(!existsSync(resolvedPath))

Check failure on line 128 in workspaces/arborist/lib/arborist/reify.js

View workflow job for this annotation

GitHub Actions / Lint

Expected space(s) after "if"
await mkdir(resolvedPath, { recursive: true })

Check failure on line 129 in workspaces/arborist/lib/arborist/reify.js

View workflow job for this annotation

GitHub Actions / Lint

Expected { after 'if' condition

// do not allow the top-level node_modules to be a symlink
await this.#validateNodeModules(resolve(this.path, 'node_modules'))
await this.#validateNodeModules(resolve(resolvedPath, 'node_modules'))
}
await this[_loadTrees](options)

Expand Down
Loading