From cf87b315f74f96b31d59fcd05abe7d427c3a9f4d Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Tue, 24 Aug 2021 08:15:22 -0700 Subject: [PATCH] refactor: use fs naming convention --- src/module-rebuilder.ts | 7 +++---- test/helpers/module-setup.ts | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/module-rebuilder.ts b/src/module-rebuilder.ts index c561a60d..66298cbc 100644 --- a/src/module-rebuilder.ts +++ b/src/module-rebuilder.ts @@ -112,14 +112,13 @@ export class ModuleRebuilder { if (!this.rebuilder.disablePreGypCopy) { const abiPath = path.resolve(this.modulePath, `bin/${this.rebuilder.platform}-${this.rebuilder.arch}-${this.rebuilder.ABI}`); d('copying to prebuilt place:', abiPath); - await fs.ensureDir(abiPath); - await fs.copy(nodePath, path.resolve(abiPath, `${this.nodeGyp.moduleName}.node`)); + await fs.mkdir(abiPath, { recursive: true }); + await fs.copyFile(nodePath, path.join(abiPath, `${this.nodeGyp.moduleName}.node`)); } } } async writeMetadata(): Promise { - await fs.ensureDir(path.dirname(this.metaPath)); - await fs.writeFile(this.metaPath, this.metaData); + await fs.outputFile(this.metaPath, this.metaData); } } diff --git a/test/helpers/module-setup.ts b/test/helpers/module-setup.ts index d6c27525..3b9a1ee6 100644 --- a/test/helpers/module-setup.ts +++ b/test/helpers/module-setup.ts @@ -15,9 +15,9 @@ export function resetMSVSVersion(): void { } export async function resetTestModule(testModulePath: string): Promise { - await fs.remove(testModulePath); - await fs.mkdirs(testModulePath); - await fs.copy( + await fs.rmdir(testModulePath, { recursive: true }); + await fs.mkdir(testModulePath, { recursive: true }); + await fs.copyFile( path.resolve(__dirname, '../../test/fixture/native-app1/package.json'), path.resolve(testModulePath, 'package.json') ); @@ -26,6 +26,6 @@ export async function resetTestModule(testModulePath: string): Promise { } export async function cleanupTestModule(testModulePath: string): Promise { - await fs.remove(testModulePath); + await fs.rmdir(testModulePath, { recursive: true }); resetMSVSVersion(); }