Skip to content

Commit

Permalink
fix: another attempt at node12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Sep 10, 2021
1 parent ad9dec5 commit c8736d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/shared/localShadowRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ export class ShadowRepo extends AsyncCreatable<ShadowRepoOptions> {
}

public async delete(): Promise<string> {
await fs.promises.rm(this.gitDir, { recursive: true, force: true });
if (typeof fs.promises.rm === 'function') {
await fs.promises.rm(this.gitDir, { recursive: true, force: true });
} else {
fs.rmdirSync(this.gitDir, { recursive: true });
}
return this.gitDir;
}
/**
Expand Down
2 changes: 1 addition & 1 deletion src/shared/remoteSourceTrackingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class RemoteSourceTrackingService extends ConfigFile<RemoteSourceTracking
const fileToDelete = RemoteSourceTrackingService.getFilePath(orgId);
// the file might not exist, in which case we don't need to delete it
if (fs.existsSync(fileToDelete)) {
await fs.promises.rm(fileToDelete, { recursive: true });
await fs.promises.unlink(fileToDelete);
}
return path.isAbsolute(fileToDelete) ? fileToDelete : path.join(process.cwd(), fileToDelete);
}
Expand Down
4 changes: 2 additions & 2 deletions test/nuts/commands/basics.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ describe('end-to-end-test for tracking with an org (single packageDir)', () => {
it('sees a local delete in local status', async () => {
const classDir = path.join(session.project.dir, 'force-app', 'main', 'default', 'classes');
await Promise.all([
fs.promises.rm(path.join(classDir, 'TestOrderController.cls')),
fs.promises.rm(path.join(classDir, 'TestOrderController.cls-meta.xml')),
fs.promises.unlink(path.join(classDir, 'TestOrderController.cls')),
fs.promises.unlink(path.join(classDir, 'TestOrderController.cls-meta.xml')),
]);
const result = execCmd<StatusResult[]>('force:source:status --json --local', { ensureExitCode: 0 }).jsonOutput
.result;
Expand Down

0 comments on commit c8736d0

Please sign in to comment.