aboutsummaryrefslogtreecommitdiffstats
path: root/build/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'build/tasks')
-rw-r--r--build/tasks/compare_size.mjs8
-rw-r--r--build/tasks/lib/isCleanWorkingDir.js4
-rw-r--r--build/tasks/minify.js10
-rw-r--r--build/tasks/node_smoke_tests.js8
-rw-r--r--build/tasks/npmcopy.js10
-rw-r--r--build/tasks/promises_aplus_tests.js6
-rw-r--r--build/tasks/qunit-fixture.js6
7 files changed, 26 insertions, 26 deletions
diff --git a/build/tasks/compare_size.mjs b/build/tasks/compare_size.mjs
index c8e55bb42..ea239fb27 100644
--- a/build/tasks/compare_size.mjs
+++ b/build/tasks/compare_size.mjs
@@ -1,5 +1,5 @@
import chalk from "chalk";
-import fs from "node:fs";
+import fs from "node:fs/promises";
import { promisify } from "node:util";
import zlib from "node:zlib";
import { exec as nodeExec } from "node:child_process";
@@ -34,7 +34,7 @@ function getBranchHeader( branch, commit ) {
async function getCache( loc ) {
let cache;
try {
- const contents = await fs.promises.readFile( loc, "utf8" );
+ const contents = await fs.readFile( loc, "utf8" );
cache = JSON.parse( contents );
} catch ( err ) {
return {};
@@ -60,7 +60,7 @@ function cacheResults( results ) {
}
function saveCache( loc, cache ) {
- return fs.promises.writeFile( loc, JSON.stringify( cache ) );
+ return fs.writeFile( loc, JSON.stringify( cache ) );
}
function compareSizes( existing, current, padLength ) {
@@ -104,7 +104,7 @@ export async function compareSize( { cache = ".sizecache.json", files } = {} ) {
const results = await Promise.all(
files.map( async function( filename ) {
- let contents = await fs.promises.readFile( filename, "utf8" );
+ let contents = await fs.readFile( filename, "utf8" );
// Remove the short SHA and .dirty from comparisons.
// The short SHA so commits can be compared against each other
diff --git a/build/tasks/lib/isCleanWorkingDir.js b/build/tasks/lib/isCleanWorkingDir.js
index 16c87fd9d..3ad8f89bc 100644
--- a/build/tasks/lib/isCleanWorkingDir.js
+++ b/build/tasks/lib/isCleanWorkingDir.js
@@ -1,7 +1,7 @@
"use strict";
-const util = require( "util" );
-const exec = util.promisify( require( "child_process" ).exec );
+const util = require( "node:util" );
+const exec = util.promisify( require( "node:child_process" ).exec );
module.exports = async function isCleanWorkingDir() {
const { stdout } = await exec( "git status --untracked-files=no --porcelain" );
diff --git a/build/tasks/minify.js b/build/tasks/minify.js
index 9aacc31e8..8c536c1ef 100644
--- a/build/tasks/minify.js
+++ b/build/tasks/minify.js
@@ -1,15 +1,15 @@
"use strict";
const swc = require( "@swc/core" );
-const fs = require( "fs" );
-const path = require( "path" );
+const fs = require( "node:fs/promises" );
+const path = require( "node:path" );
const processForDist = require( "./dist" );
const getTimestamp = require( "./lib/getTimestamp" );
const rjs = /\.js$/;
module.exports = async function minify( { filename, dir, esm } ) {
- const contents = await fs.promises.readFile( path.join( dir, filename ), "utf8" );
+ const contents = await fs.readFile( path.join( dir, filename ), "utf8" );
const version = /jQuery JavaScript Library ([^\n]+)/.exec( contents )[ 1 ];
const { code, map: incompleteMap } = await swc.minify(
@@ -48,11 +48,11 @@ module.exports = async function minify( { filename, dir, esm } ) {
} );
await Promise.all( [
- fs.promises.writeFile(
+ fs.writeFile(
path.join( dir, minFilename ),
code
),
- fs.promises.writeFile(
+ fs.writeFile(
path.join( dir, mapFilename ),
map
)
diff --git a/build/tasks/node_smoke_tests.js b/build/tasks/node_smoke_tests.js
index 433a005d5..6f99b9981 100644
--- a/build/tasks/node_smoke_tests.js
+++ b/build/tasks/node_smoke_tests.js
@@ -1,8 +1,8 @@
"use strict";
-const fs = require( "fs" );
-const util = require( "util" );
-const exec = util.promisify( require( "child_process" ).exec );
+const fs = require( "node:fs/promises" );
+const util = require( "node:util" );
+const exec = util.promisify( require( "node:child_process" ).exec );
const verifyNodeVersion = require( "./lib/verifyNodeVersion" );
const allowedLibraryTypes = [ "regular", "factory" ];
@@ -26,7 +26,7 @@ async function runTests( { libraryType, sourceType, module } ) {
} ${ sourceType } "${ module }"` );
}
const dir = `./test/node_smoke_tests/${ sourceType }/${ libraryType }`;
- const files = await fs.promises.readdir( dir, { withFileTypes: true } );
+ const files = await fs.readdir( dir, { withFileTypes: true } );
const testFiles = files.filter( ( testFilePath ) => testFilePath.isFile() );
if ( !testFiles.length ) {
diff --git a/build/tasks/npmcopy.js b/build/tasks/npmcopy.js
index 750f26d8a..93c0658b9 100644
--- a/build/tasks/npmcopy.js
+++ b/build/tasks/npmcopy.js
@@ -1,7 +1,7 @@
"use strict";
-const fs = require( "fs" );
-const path = require( "path" );
+const fs = require( "node:fs/promises" );
+const path = require( "node:path" );
const projectDir = path.resolve( __dirname, "..", ".." );
@@ -26,15 +26,15 @@ const files = {
};
async function npmcopy() {
- await fs.promises.mkdir( path.resolve( projectDir, "external" ), {
+ await fs.mkdir( path.resolve( projectDir, "external" ), {
recursive: true
} );
for ( const [ dest, source ] of Object.entries( files ) ) {
const from = path.resolve( projectDir, "node_modules", source );
const to = path.resolve( projectDir, "external", dest );
const toDir = path.dirname( to );
- await fs.promises.mkdir( toDir, { recursive: true } );
- await fs.promises.copyFile( from, to );
+ await fs.mkdir( toDir, { recursive: true } );
+ await fs.copyFile( from, to );
console.log( `${ source } → ${ dest }` );
}
}
diff --git a/build/tasks/promises_aplus_tests.js b/build/tasks/promises_aplus_tests.js
index d917b5848..6360de6c4 100644
--- a/build/tasks/promises_aplus_tests.js
+++ b/build/tasks/promises_aplus_tests.js
@@ -1,9 +1,9 @@
"use strict";
-const { spawn } = require( "child_process" );
+const { spawn } = require( "node:child_process" );
const verifyNodeVersion = require( "./lib/verifyNodeVersion" );
-const path = require( "path" );
-const os = require( "os" );
+const path = require( "node:path" );
+const os = require( "node:os" );
if ( !verifyNodeVersion() ) {
return;
diff --git a/build/tasks/qunit-fixture.js b/build/tasks/qunit-fixture.js
index 3059bb929..dbb789b60 100644
--- a/build/tasks/qunit-fixture.js
+++ b/build/tasks/qunit-fixture.js
@@ -1,10 +1,10 @@
"use strict";
-const fs = require( "fs" );
+const fs = require( "node:fs/promises" );
async function generateFixture() {
- const fixture = await fs.promises.readFile( "./test/data/qunit-fixture.html", "utf8" );
- await fs.promises.writeFile(
+ const fixture = await fs.readFile( "./test/data/qunit-fixture.html", "utf8" );
+ await fs.writeFile(
"./test/data/qunit-fixture.js",
"// Generated by build/tasks/qunit-fixture.js\n" +
"QUnit.config.fixture = " +