Skip to content

Conversation

mohiuddin-khan-shiam
Copy link

Replaced custom recursive directory creation and deprecated fs.rmdirSync logic with the native APIs introduced in Node ≥10:

  • ensureDir now calls fs.mkdirSync(dirname, { recursive: true })
    – creates full path atomically
    – avoids race conditions and extra loops

  • removeDir now ends with fs.rmSync(dirPath, { recursive: true, force: true })
    – officially supported replacement for fs.rmdirSync
    – handles non-empty directories and future Node versions

This simplifies the code, removes deprecation warnings on Node 16+, and prevents build/packaging scripts from failing on newer runtimes.

odiomarcelino and others added 2 commits June 29, 2025 18:18
Replaced custom recursive directory creation and deprecated `fs.rmdirSync` logic with the native APIs introduced in Node ≥10:

* [ensureDir](cci:1://file:///c:/Users/T2430514/Downloads/monaco-editor/build/fs.ts:12:0-21:1) now calls `fs.mkdirSync(dirname, { recursive: true })`
  – creates full path atomically
  – avoids race conditions and extra loops

* [removeDir](cci:1://file:///c:/Users/T2430514/Downloads/monaco-editor/build/fs.ts:44:0-79:1) now ends with `fs.rmSync(dirPath, { recursive: true, force: true })`
  – officially supported replacement for `fs.rmdirSync`
  – handles non-empty directories and future Node versions

This simplifies the code, removes deprecation warnings on Node 16+, and prevents build/packaging scripts from failing on newer runtimes.

Co-Authored-By: S. M. Mohiuddin Khan Shiam <[email protected]>
Replaced custom recursive directory creation and deprecated `fs.rmdirSync` logic with the native APIs introduced in Node ≥10:

* [ensureDir](cci:1://file:///c:/Users/T2430514/Downloads/monaco-editor/build/fs.ts:12:0-21:1) now calls `fs.mkdirSync(dirname, { recursive: true })`  
  – creates full path atomically  
  – avoids race conditions and extra loops

* [removeDir](cci:1://file:///c:/Users/T2430514/Downloads/monaco-editor/build/fs.ts:44:0-79:1) now ends with `fs.rmSync(dirPath, { recursive: true, force: true })`  
  – officially supported replacement for `fs.rmdirSync`  
  – handles non-empty directories and future Node versions

This simplifies the code, removes deprecation warnings on Node 16+, and prevents build/packaging scripts from failing on newer runtimes.
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