From 05a7e73f093da08c63daf1e2258824059ca77f1c Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Tue, 15 Oct 2024 14:17:35 -0600 Subject: [PATCH] Use fs.mkDirSync, see https://github.com/phetsims/chipper/issues/1436 --- js/grunt/buildRunnable.ts | 6 ++++-- js/grunt/copySupplementalPhetioFiles.ts | 2 +- js/grunt/tasks/clean.ts | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/grunt/buildRunnable.ts b/js/grunt/buildRunnable.ts index fb0103a9..a892f33b 100644 --- a/js/grunt/buildRunnable.ts +++ b/js/grunt/buildRunnable.ts @@ -16,6 +16,7 @@ import packageXHTML from './packageXHTML'; import reportUnusedStrings from './reportUnusedStrings'; import getDependencies from './getDependencies'; import getLocalesFromRepository from './getLocalesFromRepository'; +import fs from 'fs'; const assert = require( 'assert' ); const ChipperStringUtils = require( '../common/ChipperStringUtils' ); @@ -273,7 +274,7 @@ export default async function( repo: string, minifyOptions: MinifyOptions, allHT // Create the build-specific directory const buildDir = `../${repo}/build/${brand}`; - grunt.file.mkdir( buildDir ); + fs.mkdirSync( buildDir, { recursive: true } ); // {{locale}}.html if ( brand !== 'phet-io' ) { @@ -344,7 +345,8 @@ export default async function( repo: string, minifyOptions: MinifyOptions, allHT // XHTML build (ePub compatibility, etc.) const xhtmlDir = `${buildDir}/xhtml`; - grunt.file.mkdir( xhtmlDir ); + fs.mkdirSync( xhtmlDir, { recursive: true } ); + const xhtmlInitializationScript = getInitializationScript( _.assignIn( { locale: ChipperConstants.FALLBACK_LOCALE, includeAllLocales: true, diff --git a/js/grunt/copySupplementalPhetioFiles.ts b/js/grunt/copySupplementalPhetioFiles.ts index a783e0d7..7ed9feff 100644 --- a/js/grunt/copySupplementalPhetioFiles.ts +++ b/js/grunt/copySupplementalPhetioFiles.ts @@ -400,7 +400,7 @@ module.exports = async ( repo: string, version: string, simulationDisplayName: s */ const handleLib = async ( repo: string, buildDir: string, noTSC: boolean, filter: ( absPath: string, contents: string ) => string | null ) => { grunt.log.debug( 'Creating phet-io lib file from: ', PHET_IO_LIB_PRELOADS ); - grunt.file.mkdir( `${buildDir}lib` ); + fs.mkdirSync( `${buildDir}lib`, { recursive: true } ); // phet-written preloads const phetioLibCode = PHET_IO_LIB_PRELOADS.map( libFile => { diff --git a/js/grunt/tasks/clean.ts b/js/grunt/tasks/clean.ts index 1a86de08..06b585a0 100644 --- a/js/grunt/tasks/clean.ts +++ b/js/grunt/tasks/clean.ts @@ -8,6 +8,7 @@ import * as grunt from 'grunt'; import getRepo from '../../../../perennial-alias/js/grunt/tasks/util/getRepo'; +import fs from 'fs'; export const clean = ( async () => { const repo = getRepo(); @@ -18,4 +19,5 @@ export const clean = ( async () => { grunt.file.delete( buildDirectory ); } grunt.file.mkdir( buildDirectory ); + fs.mkdirSync( buildDirectory, { recursive: true } ); } )(); \ No newline at end of file