Skip to content

Commit acfd6c6

Browse files
committed
Import fs as qualified
1 parent d849690 commit acfd6c6

2 files changed

Lines changed: 17 additions & 23 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/diagnostics.ts‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
import {
2-
existsSync,
3-
mkdirSync,
4-
readFileSync,
5-
renameSync,
6-
writeFileSync,
7-
} from "fs";
1+
import * as nodefs from "fs";
82
import path from "path";
93

104
import { getTemporaryDirectory } from "./actions-util";
@@ -172,7 +166,7 @@ export function addDiagnostic(
172166

173167
// Check that the database exists before writing to it. If the database does not yet exist,
174168
// store the diagnostic in memory and write it later.
175-
if (existsSync(databasePath)) {
169+
if (nodefs.existsSync(databasePath)) {
176170
writeDiagnostic(config, language, diagnostic);
177171
} else {
178172
logger.debug(
@@ -218,7 +212,7 @@ function writeDiagnosticFile(
218212
diagnostic: DiagnosticMessage,
219213
): string {
220214
// Create the directory if it doesn't exist yet.
221-
mkdirSync(diagnosticsPath, { recursive: true });
215+
nodefs.mkdirSync(diagnosticsPath, { recursive: true });
222216

223217
// Include a monotonically increasing suffix to avoid filename collisions
224218
// between diagnostics produced within the same millisecond.
@@ -234,7 +228,7 @@ function writeDiagnosticFile(
234228
`codeql-action-${sanitizedTimestamp}-${uniqueSuffix}.json`,
235229
);
236230

237-
writeFileSync(jsonPath, JSON.stringify(diagnostic));
231+
nodefs.writeFileSync(jsonPath, JSON.stringify(diagnostic));
238232

239233
return jsonPath;
240234
}
@@ -281,7 +275,7 @@ export function logTemporaryDiagnostics() {
281275
);
282276

283277
for (const temporary of temporaryDiagnostics) {
284-
logger.debug(readFileSync(temporary.path, "utf-8"));
278+
logger.debug(nodefs.readFileSync(temporary.path, "utf-8"));
285279
}
286280
}
287281
}
@@ -306,7 +300,7 @@ export function flushDiagnostics(config: Config) {
306300
const filename = path.basename(temporary.path);
307301
const destination = path.join(directory, filename);
308302

309-
renameSync(temporary.path, destination);
303+
nodefs.renameSync(temporary.path, destination);
310304
}
311305

312306
// Reset the temporary diagnostics arrays.

0 commit comments

Comments
 (0)