Use standard node utils instead of our custom ones

This commit is contained in:
Matt Bierner
2025-11-12 15:26:54 -08:00
parent c80e00292f
commit 7f47e28c2b

View File

@@ -3,14 +3,14 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
//@ts-check // @ts-check
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const util = require('../../../build/lib/util');
const playwright = require('@playwright/test'); const playwright = require('@playwright/test');
const yaserver = require('yaserver'); const yaserver = require('yaserver');
const http = require('http'); const http = require('http');
const { glob } = require('glob');
const DEBUG_TESTS = false; const DEBUG_TESTS = false;
const SRC_DIR = path.join(__dirname, '../../../out-monaco-editor-core/esm'); const SRC_DIR = path.join(__dirname, '../../../out-monaco-editor-core/esm');
@@ -76,10 +76,9 @@ async function startServer() {
} }
async function extractSourcesWithoutCSS() { async function extractSourcesWithoutCSS() {
await util.rimraf(DST_DIR); fs.rmSync(DST_DIR, { recursive: true, force: true });
const files = util.rreddir(SRC_DIR); for (const file of glob.sync('**/*', { cwd: SRC_DIR, nodir: true })) {
for (const file of files) {
const srcFilename = path.join(SRC_DIR, file); const srcFilename = path.join(SRC_DIR, file);
if (!/\.js$/.test(srcFilename)) { if (!/\.js$/.test(srcFilename)) {
continue; continue;
@@ -90,7 +89,7 @@ async function extractSourcesWithoutCSS() {
let contents = fs.readFileSync(srcFilename).toString(); let contents = fs.readFileSync(srcFilename).toString();
contents = contents.replace(/import '[^']+\.css';/g, ''); contents = contents.replace(/import '[^']+\.css';/g, '');
util.ensureDir(path.dirname(dstFilename)); fs.mkdirSync(path.dirname(dstFilename), { recursive: true });
fs.writeFileSync(dstFilename, contents); fs.writeFileSync(dstFilename, contents);
} }
} }