From 6868f0025b0704a50113872525a41e95e3702010 Mon Sep 17 00:00:00 2001 From: Myrotvorets Date: Mon, 16 Dec 2024 06:31:16 +0200 Subject: [PATCH] Modernize codebase --- src/main.ts | 8 ++------ tests/main.test.ts | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/main.ts b/src/main.ts index 4b6eb65..50dca3d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,7 @@ import { join } from 'node:path'; -import { promisify } from 'node:util'; -import fs from 'node:fs'; +import { readFile, stat } from 'node:fs/promises'; import * as core from '@actions/core'; -const stat = promisify(fs.stat); -const readFile = promisify(fs.readFile); - interface IPackage { name?: string; version?: string; @@ -19,7 +15,7 @@ interface IPackage { }; } -async function exists(path: fs.PathLike): Promise { +async function exists(path: Parameters[0]): Promise { try { await stat(path); return true; diff --git a/tests/main.test.ts b/tests/main.test.ts index 92d8d37..5348a9b 100644 --- a/tests/main.test.ts +++ b/tests/main.test.ts @@ -1,5 +1,5 @@ -import { ExecSyncOptions, execSync } from 'child_process'; -import { join, normalize } from 'path'; +import { ExecSyncOptions, execSync } from 'node:child_process'; +import { join, normalize } from 'node:path'; describe('Test Run', () => { const runner = (options: ExecSyncOptions): void => {