refactor(core): Replace promisify-d node calls with native promises (no-changelog) (#8464)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-01-30 09:49:23 +01:00
committed by GitHub
parent 238b54c77b
commit 5cb55270b7
8 changed files with 19 additions and 46 deletions

View File

@@ -1,13 +1,7 @@
import * as fs from 'fs';
import { copyFile } from 'fs/promises';
import type { ReplaceInFileConfig } from 'replace-in-file';
import { replaceInFile } from 'replace-in-file';
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
const { promisify } = require('util');
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call
const fsCopyFile = promisify(fs.copyFile);
/**
* Creates a new credentials or node
*
@@ -22,7 +16,7 @@ export async function createTemplate(
): Promise<void> {
// Copy the file to then replace the values in it
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await fsCopyFile(sourceFilePath, destinationFilePath);
await copyFile(sourceFilePath, destinationFilePath);
// Replace the variables in the template file
const options: ReplaceInFileConfig = {