Skip to content

Commit

Permalink
Use fs.mkDirSync, see #1436
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid committed Oct 15, 2024
1 parent 4666a07 commit 05a7e73
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions js/grunt/buildRunnable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
Expand Down Expand Up @@ -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' ) {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion js/grunt/copySupplementalPhetioFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
2 changes: 2 additions & 0 deletions js/grunt/tasks/clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -18,4 +19,5 @@ export const clean = ( async () => {
grunt.file.delete( buildDirectory );
}
grunt.file.mkdir( buildDirectory );
fs.mkdirSync( buildDirectory, { recursive: true } );
} )();

0 comments on commit 05a7e73

Please sign in to comment.