Skip to content

Commit

Permalink
refactor: use fs naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
malept committed Aug 25, 2021
1 parent e060ab4 commit cf87b31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/module-rebuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> {
await fs.ensureDir(path.dirname(this.metaPath));
await fs.writeFile(this.metaPath, this.metaData);
await fs.outputFile(this.metaPath, this.metaData);
}
}
8 changes: 4 additions & 4 deletions test/helpers/module-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export function resetMSVSVersion(): void {
}

export async function resetTestModule(testModulePath: string): Promise<void> {
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')
);
Expand All @@ -26,6 +26,6 @@ export async function resetTestModule(testModulePath: string): Promise<void> {
}

export async function cleanupTestModule(testModulePath: string): Promise<void> {
await fs.remove(testModulePath);
await fs.rmdir(testModulePath, { recursive: true });
resetMSVSVersion();
}

0 comments on commit cf87b31

Please sign in to comment.