Skip to content

Commit

Permalink
fix(link): set recursive option for mkdir
Browse files Browse the repository at this point in the history
  • Loading branch information
henri-hulski committed Jun 16, 2023
1 parent 095a0d8 commit a4af81e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/actions/linkAsModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const linkOne = function linkAsModule(sourcePackage, pkgAsModule) {
return new Promise((resolve, reject) => {
const dir = dirname(pkgAsModule)
if (!existsSync(dir)) {
mkdirSync(dir)
mkdirSync(dir, { recursive: true })
}
symlinkDir(sourcePackage, pkgAsModule).then(
() => {
Expand Down Expand Up @@ -43,7 +43,7 @@ export function linkAsModule({ config }) {
}
const nodeModules = resolve(commonPath, 'node_modules')
if (!existsSync(nodeModules)) {
runCommand(mkdir, [nodeModules])
runCommand(mkdir, [nodeModules, { recursive: true }])
}

return runAll(
Expand Down
4 changes: 2 additions & 2 deletions src/actions/linkAsModule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ it('should link as modules', done => {
}

const commands = [
{ cmd: 'mkdir', args: ['/foo/bar/node_modules'] },
{ cmd: 'mkdir', args: ['/foo/bar/node_modules', { recursive: true }] },
...Object.keys(packagesPaths).map(name => ({
cmd: 'linkAsModule',
args: [packagesPaths[name], resolve('/foo/bar', 'node_modules', name)],
Expand Down Expand Up @@ -57,7 +57,7 @@ it('should not link as modules inside part of name', done => {

const commands = [
// /foo/bar, not /foo/bar/@repo-cooker-test
{ cmd: 'mkdir', args: ['/foo/bar/node_modules'] },
{ cmd: 'mkdir', args: ['/foo/bar/node_modules', { recursive: true }] },
...Object.keys(packagesPaths).map(name => ({
cmd: 'linkAsModule',
args: [packagesPaths[name], resolve('/foo/bar', 'node_modules', name)],
Expand Down

0 comments on commit a4af81e

Please sign in to comment.