Skip to content

Commit bd07f63

Browse files
committed
refactor: update chalk to 4.1.0, remove common-utils
1 parent 53ee171 commit bd07f63

6 files changed

Lines changed: 155 additions & 186 deletions

File tree

package-lock.json

Lines changed: 41 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"@types/yazl": "^2.4.2",
3434
"backslash": "^0.1.7",
3535
"base-64": "^0.1.0",
36-
"chalk": "^1.1.0",
36+
"chalk": "^4.1.0",
3737
"cli-table3": "^0.6.0",
3838
"code-push": "2.0.6",
3939
"email-validator": "^1.0.3",
@@ -61,7 +61,6 @@
6161
"yazl": "^2.4.1"
6262
},
6363
"devDependencies": {
64-
"@types/chalk": "^0.4.31",
6564
"@types/node": "^14.0.10",
6665
"@types/q": "^1.5.4",
6766
"@types/semver": "^7.2.0",

src/command-executor.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import {
2828
Headers,
2929
Package,
3030
PackageInfo,
31-
Session,
3231
UpdateMetrics,
3332
} from "code-push/script/types";
3433
import {
@@ -852,7 +851,7 @@ function printDeploymentHistory(
852851
}
853852
}
854853

855-
function applyChalkSkippingLineBreaks(applyString: string, chalkMethod: (string: string) => chalk.ChalkChain): string {
854+
function applyChalkSkippingLineBreaks(applyString: string, chalkMethod: (string: string) => any): string {
856855
// Used to prevent "chalk" from applying styles to linebreaks which
857856
// causes table border chars to have the style applied as well.
858857
return applyString

src/common-utils.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/lib/file-utils.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ export function isDirectory(path: string): boolean {
44
return fs.statSync(path).isDirectory();
55
}
66

7+
export function generateRandomFilename(length: number): string {
8+
let filename: string = "";
9+
const validChar: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
10+
11+
for (let i = 0; i < length; i++) {
12+
// eslint-disable-next-line no-restricted-properties
13+
filename += validChar.charAt(Math.floor(Math.random() * validChar.length));
14+
}
15+
16+
return filename;
17+
}
18+
719
export function fileDoesNotExistOrIsDirectory(path: string): boolean {
820
try {
921
return isDirectory(path);

0 commit comments

Comments
 (0)