chore(deps): remove mz dependency and replace with Node native fs/promises (#10175)

This commit is contained in:
Christina Holland
2026-07-20 14:06:24 -07:00
committed by GitHub
parent 165df7a1f2
commit f3de0bc9fe
7 changed files with 33 additions and 51 deletions
-2
View File
@@ -77,7 +77,6 @@
"@types/js-yaml": "4.0.9",
"@types/listr": "0.14.9",
"@types/mocha": "9.1.1",
"@types/mz": "2.7.8",
"@types/node": "18.19.83",
"@types/sinon": "9.0.11",
"@types/sinon-chai": "3.2.12",
@@ -129,7 +128,6 @@
"merge2": "1.4.1",
"mkdirp": "1.0.4",
"mocha": "9.2.2",
"mz": "2.7.0",
"node-polyfill-webpack-plugin": "2.0.1",
"npm-run-all2": "5.0.2",
"nyc": "15.1.0",
+6 -8
View File
@@ -17,11 +17,10 @@
import { resolve } from 'path';
import { existsSync } from 'fs';
import { writeFile } from 'fs/promises';
import { readFile, writeFile } from 'fs/promises';
import { exec } from 'child-process-promise';
import chalk from 'chalk';
import simpleGit from 'simple-git';
import fs from 'mz/fs';
const root = resolve(__dirname, '../..');
const git = simpleGit(root);
@@ -49,10 +48,9 @@ const bumpRank: Record<string, number> = {
* numerical rank, bump text, package name.
*/
function getHighestBump(changesetPackages: Record<string, string>) {
const firebasePkgJson = require(resolve(
root,
'packages/firebase/package.json'
));
const firebasePkgJson = require(
resolve(root, 'packages/firebase/package.json')
);
let highestBump = bumpRank.patch;
let highestBumpText = 'patch';
let bumpPackage = '';
@@ -112,11 +110,11 @@ async function getDiffData(): Promise<{
}
async function parseChangesetFile(changesetFile: string) {
const fileExists = await fs.exists(changesetFile);
const fileExists = existsSync(changesetFile);
if (!fileExists) {
process.exit();
}
const fileText: string = await fs.readFile(changesetFile, 'utf8');
const fileText: string = await readFile(changesetFile, 'utf8');
const fileParts = fileText.split('---\n');
const packageLines = fileParts[1].split('\n');
const changesetPackages: Record<string, string> = {};
+10 -16
View File
@@ -17,7 +17,8 @@
const { exec } = require('child-process-promise');
const yargs = require('yargs');
const fs = require('mz/fs');
const fs = require('fs/promises');
const { existsSync } = require('fs');
const path = require('path');
const yaml = require('js-yaml');
@@ -72,17 +73,13 @@ function runTypedoc() {
*/
function moveFilesToRoot(subdir) {
const srcDir = `${docPath}/${subdir}`;
return fs
.exists(srcDir)
.then(exists => {
if (exists) {
return exec(`mv ${srcDir}/* ${docPath}`).then(() => {
exec(`rmdir ${srcDir}`);
});
}
})
if (existsSync(srcDir)) {
return exec(`mv ${srcDir}/* ${docPath}`)
.then(() => exec(`rmdir ${srcDir}`))
.catch(e => console.error(e));
}
return Promise.resolve();
}
/**
* Reformat links to match flat structure.
@@ -172,21 +169,18 @@ function checkForMissingFilesAndFixFilenameCase() {
const tocFilePath = `${docPath}/${filename}.html`;
// Generated filename from Typedoc will be lowercase.
const generatedFilePath = `${docPath}/${filename.toLowerCase()}.html`;
return fs.exists(generatedFilePath).then(exists => {
if (exists) {
if (existsSync(generatedFilePath)) {
// Store in a lookup table for link fixing.
lowerToUpperLookup[
`${filename.toLowerCase()}.html`
] = `${filename}.html`;
lowerToUpperLookup[`${filename.toLowerCase()}.html`] = `${filename}.html`;
return fs.rename(generatedFilePath, tocFilePath);
} else {
console.warn(
`Missing file: ${filename}.html requested ` +
`in toc.yaml but not found in ${docPath}`
);
return Promise.resolve();
}
});
});
return Promise.all(fileCheckPromises).then(() => filenames);
}
+1 -1
View File
@@ -28,7 +28,7 @@
import { projectRoot } from './utils';
import { mapPkgNameToPkgJson } from './release/utils/workspace';
import * as yargs from 'yargs';
import fs from 'mz/fs';
import fs from 'fs/promises';
const argv = yargs.parseSync();
async function updateField(pkg: any, fieldName: string) {
+4 -5
View File
@@ -20,7 +20,7 @@ const { exec } = require('child-process-promise');
const { homedir } = require('os');
const firebaseTools = require('firebase-tools');
const inquirer = require('inquirer');
const fs = require('mz/fs');
const fs = require('fs/promises');
const path = require('path');
// Command Line Arguments
@@ -30,10 +30,9 @@ const projectId = argv.projectId;
let cachedToken;
try {
const config = require(path.resolve(
homedir(),
'.config/configstore/firebase-tools.json'
));
const config = require(
path.resolve(homedir(), '.config/configstore/firebase-tools.json')
);
cachedToken = config.tokens.refresh_token;
} catch (err) {}
+2 -2
View File
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2017 Google Inc.
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
const { resolve } = require('path');
const { spawn } = require('child-process-promise');
const chalk = require('chalk');
const fs = require('mz/fs');
const fs = require('fs');
const semver = require('semver');
// CONSTANTS
+1 -8
View File
@@ -3680,13 +3680,6 @@
resolved "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.1.tgz#e7c4f1001eefa4b8afbd1eee27a237fee3bf29c4"
integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw==
"@types/[email protected]":
version "2.7.8"
resolved "https://registry.npmjs.org/@types/mz/-/mz-2.7.8.tgz#5ac05b34f08e6225d7ad9b05e158b03d9ca9e2d4"
integrity sha512-mGLNqqwt8yu4pDw9rEphAiyWnEdok0GzOGrwi5EiTuDFxw7H3ZaEI4ASFKq4HaZtemtjQ8MkcmtWcrU4V0WkIw==
dependencies:
"@types/node" "*"
"@types/node@*", "@types/node@>=10.0.0", "@types/node@>=12.12.47", "@types/node@>=13.7.0":
version "22.10.10"
resolved "https://registry.npmjs.org/@types/node/-/node-22.10.10.tgz#85fe89f8bf459dc57dfef1689bd5b52ad1af07e6"
@@ -12376,7 +12369,7 @@ mute-stream@^2.0.0:
resolved "https://registry.npmjs.org/mute-stream/-/mute-stream-2.0.0.tgz#a5446fc0c512b71c83c44d908d5c7b7b4c493b2b"
integrity sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==
[email protected], mz@^2.4.0:
mz@^2.4.0:
version "2.7.0"
resolved "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32"
integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==