Skip to content

Commit aab3cec

Browse files
committed
refactor: update rimraf import and usage for consistency
1 parent a344b47 commit aab3cec

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

‎script/command-executor.ts‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const progress = require("progress");
2020
const prompt = require("prompt");
2121
import * as Q from "q";
2222

23-
const rimraf = require("rimraf");
23+
const { rimraf } = require("rimraf");
2424
import * as semver from "semver";
2525

2626
const Table = require("cli-table");
@@ -277,15 +277,7 @@ function deleteConnectionInfoCache(printMessage: boolean = true): void {
277277
}
278278

279279
function deleteFolder(folderPath: string): Promise<void> {
280-
return Promise<void>((resolve, reject, notify) => {
281-
rimraf(folderPath, (err: any) => {
282-
if (err) {
283-
reject(err);
284-
} else {
285-
resolve(<void>null);
286-
}
287-
});
288-
});
280+
return rimraf(folderPath).then(() => undefined);
289281
}
290282

291283
function deploymentAdd(command: cli.IDeploymentAddCommand): Promise<void> {

‎script/utils/file-utils.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as fs from "fs";
22
import * as path from "path";
3-
import * as rimraf from "rimraf";
3+
import { rimrafSync } from "rimraf";
44
import * as temp from "temp";
55

66
export function isBinaryOrZip(path: string): boolean {
@@ -22,7 +22,7 @@ export function fileExists(file: string): boolean {
2222
export function copyFileToTmpDir(filePath: string): string {
2323
if (!isDirectory(filePath)) {
2424
const outputFolderPath: string = temp.mkdirSync("code-push");
25-
rimraf.sync(outputFolderPath);
25+
rimrafSync(outputFolderPath);
2626
fs.mkdirSync(outputFolderPath);
2727

2828
const outputFilePath: string = path.join(outputFolderPath, path.basename(filePath));

0 commit comments

Comments
 (0)