Skip to content

Commit 085d188

Browse files
authored
fix(gatsby-plugin-manifest): create directories recursively (#27793)
* fix(gatsby-plugin-manifest): create directories recursively It's possible to have directories nested multiple layers deep or potentially that `public` isn't defined. * fix typo * fix tests
1 parent 8f8a419 commit 085d188

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/gatsby-plugin-manifest/src/__tests__/gatsby-node.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,12 @@ describe(`Test plugin manifest options`, () => {
166166
// No sharp calls because this is manual mode: user provides all icon sizes
167167
// rather than the plugin generating them
168168
expect(sharp).toHaveBeenCalledTimes(0)
169-
expect(fs.mkdirSync).toHaveBeenNthCalledWith(1, firstIconPath)
170-
expect(fs.mkdirSync).toHaveBeenNthCalledWith(2, secondIconPath)
169+
expect(fs.mkdirSync).toHaveBeenNthCalledWith(1, firstIconPath, {
170+
recursive: true,
171+
})
172+
expect(fs.mkdirSync).toHaveBeenNthCalledWith(2, secondIconPath, {
173+
recursive: true,
174+
})
171175
})
172176

173177
it(`invokes sharp if icon argument specified`, async () => {

packages/gatsby-plugin-manifest/src/gatsby-node.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const makeManifest = async ({
218218
const exists = fs.existsSync(iconPath)
219219
//create destination directory if it doesn't exist
220220
if (!exists) {
221-
fs.mkdirSync(iconPath)
221+
fs.mkdirSync(iconPath, { recursive: true })
222222
}
223223
paths[iconPath] = true
224224
}

0 commit comments

Comments
 (0)