diff options
Diffstat (limited to 'build/tasks/build.js')
-rw-r--r-- | build/tasks/build.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/build/tasks/build.js b/build/tasks/build.js index c169ce925..5ed1b9c32 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -6,10 +6,10 @@ "use strict"; -const fs = require( "fs" ); -const path = require( "path" ); -const util = require( "util" ); -const exec = util.promisify( require( "child_process" ).exec ); +const fs = require( "node:fs/promises" ); +const path = require( "node:path" ); +const util = require( "node:util" ); +const exec = util.promisify( require( "node:child_process" ).exec ); const rollup = require( "rollup" ); const excludedFromSlim = require( "./lib/slim-exclude" ); const rollupFileOverrides = require( "./lib/rollup-plugin-file-overrides" ); @@ -38,7 +38,7 @@ const removeWith = { }; async function read( filename ) { - return fs.promises.readFile( path.join( srcFolder, filename ), "utf8" ); + return fs.readFile( path.join( srcFolder, filename ), "utf8" ); } // Remove the src folder and file extension @@ -54,7 +54,7 @@ function moduleName( filename ) { async function readdirRecursive( dir, all = [] ) { let files; try { - files = await fs.promises.readdir( path.join( srcFolder, dir ), { + files = await fs.readdir( path.join( srcFolder, dir ), { withFileTypes: true } ); } catch ( e ) { @@ -151,7 +151,7 @@ async function writeCompiled( { code, dir, filename, version } ) { // yyyy-mm-ddThh:mmZ .replace( /@DATE/g, new Date().toISOString().replace( /:\d+\.\d+Z$/, "Z" ) ); - await fs.promises.writeFile( path.join( dir, filename ), compiledContents ); + await fs.writeFile( path.join( dir, filename ), compiledContents ); console.log( `[${ getTimestamp() }] ${ filename } v${ version } created.` ); } @@ -194,7 +194,7 @@ async function build( { version += "+slim"; } - await fs.promises.mkdir( dir, { recursive: true } ); + await fs.mkdir( dir, { recursive: true } ); // Exclude slim modules when slim is true const [ excluded, included ] = await checkExclude( @@ -343,7 +343,7 @@ async function build( { // We normally process for dist during minification to save // file reads. However, some files are not minified and then // we need to do it separately. - const contents = await fs.promises.readFile( + const contents = await fs.readFile( path.join( dir, filename ), "utf8" ); |