Skip to content

Conversation

sw1tch3roo
Copy link

@sw1tch3roo sw1tch3roo commented Jul 6, 2025

This PR fixes a build issue on Unix-like systems (e.g., macOS, Linux) where the command mkdir in packages/playground-examples/scripts/copyFiles.js fails because the parent directories may not exist.

Added a check to ensure the target directory exists before calling mkdir.

Replaced mkdir with mkdir -p to avoid errors when the directory tree doesn't exist.

Tested locally: the build now completes successfully on macOS.

Thank you for reviewing this fix!

P.S. This issue doesn't occur on Windows because mkdir there behaves like mkdir -p by default, but it fails on Unix-based systems without the -p flag.

@jakebailey
Copy link
Member

I exclusively develop this repo on Linux and have never hit this; when would the directory not exist?

@@ -9,7 +9,7 @@
const jsonDir = join(__dirname, "..", "generated");
const outDir = join(__dirname, "..", "..", "typescriptlang-org", "static", "js", "examples");

if (!existsSync(outDir)) execSync(`mkdir ${outDir}`);
if (!existsSync(outDir)) execSync(`mkdir -p ${outDir}`);

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
absolute path
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants