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 bug in cloning of repos, where worktree directory could not be cr… #673

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions .changeset/hungry-owls-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@jpmorganchase/mosaic-plugins': patch
---

Fix bug where `ensureDir` created a directory and broke the cloning of repos
13 changes: 6 additions & 7 deletions packages/plugins/src/DocumentAssetsPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ const DocumentAssetsPlugin: PluginType<Page, DocumentAssetsPluginOptions> = {
if (!resolvedOutputDir.startsWith(resolvedCwd)) {
throw new Error(`outputDir must be within the current working directory: ${outputDir}`);
}
await fsExtra.ensureDir(srcDir);
await fsExtra.ensureDir(outputDir);

for (const assetSubDir of assetSubDirs) {
const resolvedAssetSubDir = path.resolve(resolvedSrcDir, assetSubDir);
Expand All @@ -103,15 +101,16 @@ const DocumentAssetsPlugin: PluginType<Page, DocumentAssetsPluginOptions> = {
cwd: resolvedSrcDir,
onlyDirectories: true
});
if (globbedImageDirs.length === 0) {
console.warn(`Warning: No entries found for ${assetSubDir}. It may not exist.`);
continue;
}
} catch (err) {
console.error(`Error globbing ${assetSubDir} in ${srcDir}:`, err);
continue;
}

if (globbedImageDirs?.length === 0) {
continue;
throw err;
mark-tate marked this conversation as resolved.
Show resolved Hide resolved
}

await fsExtra.ensureDir(outputDir);
for (const globbedImageDir of globbedImageDirs) {
let imageFiles;
let globbedPath;
Expand Down
Loading