Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of fs-extra #55468

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"@esfx/canceltoken": "^1.0.0",
"@octokit/rest": "^19.0.13",
"@types/chai": "^4.3.4",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^8.1.0",
"@types/microsoft__typescript-etw": "^0.1.1",
"@types/minimist": "^1.2.2",
Expand All @@ -69,7 +68,6 @@
"eslint-plugin-no-null": "^1.0.2",
"eslint-plugin-simple-import-sort": "^10.0.0",
"fast-xml-parser": "^4.0.11",
"fs-extra": "^9.1.0",
"glob": "^8.1.0",
"hereby": "^1.6.4",
"jsonc-parser": "^3.2.0",
Expand Down
22 changes: 14 additions & 8 deletions scripts/produceLKG.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from "fs-extra";
import fs from "fs";
import glob from "glob";
import path from "path";
import url from "url";
Expand All @@ -16,8 +16,8 @@ const dest = path.join(root, "lib");

async function produceLKG() {
console.log(`Building LKG from ${source} to ${dest}`);
await (fs.rm || fs.rmdir)(dest, { recursive: true, force: true });
await fs.mkdirp(dest);
await fs.promises.rm(dest, { recursive: true, force: true });
await fs.promises.mkdir(dest, { recursive: true });
await copyLibFiles();
await copyLocalizedDiagnostics();
await copyTypesMap();
Expand All @@ -32,9 +32,15 @@ async function copyLibFiles() {

async function copyLocalizedDiagnostics() {
for (const d of localizationDirectories) {
const fileName = path.join(source, d);
if (fs.statSync(fileName).isDirectory()) {
await fs.copy(fileName, path.join(dest, d));
const inputDir = path.join(source, d);
if (!fs.statSync(inputDir).isDirectory()) throw new Error(`Expected ${inputDir} to be a directory`);
const outputDir = path.join(dest, d);
await fs.promises.mkdir(outputDir, { recursive: true });
for (const f of await fs.promises.readdir(inputDir)) {
const inputFile = path.join(inputDir, f);
if (!fs.statSync(inputFile).isFile()) throw new Error(`Expected ${inputFile} to be a file`);
const outputFile = path.join(outputDir, f);
await fs.promises.copyFile(inputFile, outputFile);
}
}
}
Expand All @@ -59,14 +65,14 @@ async function copyDeclarationOutputs() {
}

async function writeGitAttributes() {
await fs.writeFile(path.join(dest, ".gitattributes"), `* text eol=lf`, "utf-8");
await fs.promises.writeFile(path.join(dest, ".gitattributes"), `* text eol=lf`, "utf-8");
}

/**
* @param {string} fileName
*/
async function copyFromBuiltLocal(fileName) {
await fs.copy(path.join(source, fileName), path.join(dest, fileName));
await fs.promises.copyFile(path.join(source, fileName), path.join(dest, fileName));
}

/**
Expand Down