Skip to content

Commit d9bced3

Browse files
authored
fix: clear all deprecated dependencies (#5858)
1 parent 1daa553 commit d9bced3

26 files changed

+3070
-5539
lines changed

lib/common/mobile/device-log-provider.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ export class DeviceLogProvider extends DeviceLogProviderBase {
1414
protected $logger: ILogger,
1515
protected $logSourceMapService: Mobile.ILogSourceMapService,
1616
protected $timelineProfilerService: ITimelineProfilerService,
17-
protected $options: IOptions
17+
protected $options: IOptions,
1818
) {
1919
super($logFilter, $logger, $logSourceMapService);
2020
}
2121

2222
public logData(
2323
lineText: string,
2424
platform: string,
25-
deviceIdentifier: string
25+
deviceIdentifier: string,
2626
): void {
2727
// console.log(lineText)
2828
const loggingOptions = this.getDeviceLogOptionsForDevice(deviceIdentifier);
2929
let data = this.$logFilter.filterData(platform, lineText, loggingOptions);
3030
data = this.$logSourceMapService.replaceWithOriginalFileLocations(
3131
platform,
3232
data,
33-
loggingOptions
33+
loggingOptions,
3434
);
3535

3636
if (data) {
@@ -58,12 +58,12 @@ export class DeviceLogProvider extends DeviceLogProviderBase {
5858
private deviceColorMap = new Map<string, StyleFormat>();
5959

6060
private colorPool: StyleFormat[] = [
61-
"bgMagentaBright",
61+
"bgGray",
6262
"bgBlueBright",
6363
"bgWhiteBright",
6464
"bgCyanBright",
6565
"bgYellowBright",
66-
"bgGreenBright",
66+
"bgMagentaBright",
6767
];
6868
private colorPoolIndex = 0;
6969

@@ -150,7 +150,7 @@ export class DeviceLogProvider extends DeviceLogProviderBase {
150150
toLog.split("\n").forEach((actualLine) => {
151151
this.printLine(
152152
color.styleText(this.getDeviceColor(deviceIdentifier), " "),
153-
this.consoleLevelColor[level](actualLine)
153+
this.consoleLevelColor[level](actualLine),
154154
);
155155
});
156156
}

lib/common/test/unit-tests/file-system.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Yok } from "../../yok";
2+
import { mkdtempSync } from "fs";
3+
import { tmpdir } from "os";
24
import * as path from "path";
3-
import * as temp from "temp";
45
import * as hostInfoLib from "../../host-info";
56
import { assert, use } from "chai";
67
import "chai-as-promised";
@@ -28,7 +29,6 @@ function isOsCaseSensitive(testInjector: IInjector): boolean {
2829
const hostInfo = testInjector.resolve("hostInfo");
2930
return hostInfo.isLinux;
3031
}
31-
temp.track();
3232

3333
function createWriteJsonTestCases(): {
3434
exists: boolean;
@@ -125,7 +125,7 @@ describe("FileSystem", () => {
125125

126126
beforeEach(() => {
127127
testInjector = createTestInjector();
128-
tempDir = temp.mkdirSync("projectToUnzip");
128+
tempDir = mkdtempSync(path.join(tmpdir(), "projectToUnzip-"));
129129
fs = testInjector.resolve("fs");
130130
file = path.join(tempDir, unzippedFileName);
131131
fs.writeFile(file, msg);
@@ -188,7 +188,7 @@ describe("FileSystem", () => {
188188
const commandUnzipFailedMessage = "Command unzip failed with exit code 9";
189189
it("is case sensitive when options is not defined", async () => {
190190
const testInjector = createTestInjector();
191-
const tempDir = temp.mkdirSync("projectToUnzip");
191+
const tempDir = mkdtempSync(path.join(tmpdir(), "projectToUnzip-"));
192192
const fs: IFileSystem = testInjector.resolve("fs");
193193
if (isOsCaseSensitive(testInjector)) {
194194
await assert.isRejected(
@@ -202,7 +202,7 @@ describe("FileSystem", () => {
202202

203203
it("is case sensitive when caseSensitive option is not defined", async () => {
204204
const testInjector = createTestInjector();
205-
const tempDir = temp.mkdirSync("projectToUnzip");
205+
const tempDir = mkdtempSync(path.join(tmpdir(), "projectToUnzip-"));
206206
const fs: IFileSystem = testInjector.resolve("fs");
207207
if (isOsCaseSensitive(testInjector)) {
208208
await assert.isRejected(
@@ -216,7 +216,7 @@ describe("FileSystem", () => {
216216

217217
it("is case sensitive when caseSensitive option is true", async () => {
218218
const testInjector = createTestInjector();
219-
const tempDir = temp.mkdirSync("projectToUnzip");
219+
const tempDir = mkdtempSync(path.join(tmpdir(), "projectToUnzip-"));
220220
const fs: IFileSystem = testInjector.resolve("fs");
221221
if (isOsCaseSensitive(testInjector)) {
222222
await assert.isRejected(
@@ -233,7 +233,7 @@ describe("FileSystem", () => {
233233

234234
it("is case insensitive when caseSensitive option is false", async () => {
235235
const testInjector = createTestInjector();
236-
const tempDir = temp.mkdirSync("projectToUnzip");
236+
const tempDir = mkdtempSync(path.join(tmpdir(), "projectToUnzip-"));
237237
const fs: IFileSystem = testInjector.resolve("fs");
238238
const file = path.join(tempDir, unzippedFileName);
239239
await fs.unzip(
@@ -251,7 +251,7 @@ describe("FileSystem", () => {
251251
describe("renameIfExists", () => {
252252
it("returns true when file is renamed", () => {
253253
const testInjector = createTestInjector();
254-
const tempDir = temp.mkdirSync("renameIfExists");
254+
const tempDir = mkdtempSync(path.join(tmpdir(), "renameIfExists-"));
255255
const testFileName = path.join(tempDir, "testRenameIfExistsMethod");
256256
const newFileName = path.join(tempDir, "newfilename");
257257

@@ -287,7 +287,7 @@ describe("FileSystem", () => {
287287

288288
beforeEach(() => {
289289
testInjector = createTestInjector();
290-
tempDir = temp.mkdirSync("copyFile");
290+
tempDir = mkdtempSync(path.join(tmpdir(), "copyFile-"));
291291
testFileName = path.join(tempDir, "testCopyFile");
292292
newFileName = path.join(tempDir, "newfilename");
293293

lib/common/test/unit-tests/mobile/project-files-manager.ts

Lines changed: 41 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import * as path from "path";
1212
import { Yok } from "../../../yok";
1313
import { ProjectFilesProviderBase } from "../../../services/project-files-provider-base";
1414

15-
import * as temp from "temp";
15+
import { mkdtempSync } from "fs";
16+
import { tmpdir } from "os";
1617
import { LiveSyncPaths } from "../../../constants";
1718
import { TempServiceStub } from "../../../../../test/stubs";
1819
import { IInjector } from "../../../definitions/yok";
1920
import { IProjectFilesManager } from "../../../declarations";
20-
temp.track();
2121

2222
const testedApplicationIdentifier = "com.telerik.myApp";
2323
const iOSDeviceProjectRootPath = "/Documents/AppBuilder/LiveSync/app";
@@ -44,7 +44,7 @@ function createTestInjector(): IInjector {
4444
testInjector.register("hostInfo", HostInfo);
4545
testInjector.register(
4646
"localToDevicePathDataFactory",
47-
LocalToDevicePathDataFactory
47+
LocalToDevicePathDataFactory,
4848
);
4949
testInjector.register("mobileHelper", MobileHelper);
5050
testInjector.register("projectFilesProvider", ProjectFilesProviderBase);
@@ -61,12 +61,14 @@ function createTestInjector(): IInjector {
6161

6262
async function createFiles(
6363
testInjector: IInjector,
64-
filesToCreate: string[]
64+
filesToCreate: string[],
6565
): Promise<string> {
66-
const directoryPath = temp.mkdirSync("Project Files Manager Tests");
66+
const directoryPath = mkdtempSync(
67+
path.join(tmpdir(), "Project Files Manager Tests-"),
68+
);
6769

6870
_.each(filesToCreate, (file) =>
69-
createFile(testInjector, file, "", directoryPath)
71+
createFile(testInjector, file, "", directoryPath),
7072
);
7173

7274
return directoryPath;
@@ -76,11 +78,11 @@ function createFile(
7678
testInjector: IInjector,
7779
fileToCreate: string,
7880
fileContent: string,
79-
directoryPath?: string
81+
directoryPath?: string,
8082
): string {
8183
const fs = testInjector.resolve("fs");
8284
directoryPath = !directoryPath
83-
? temp.mkdirSync("Project Files Manager Tests")
85+
? mkdtempSync(path.join(tmpdir(), "Project Files Manager Tests-"))
8486
: directoryPath;
8587

8688
fs.writeFile(path.join(directoryPath, fileToCreate), fileContent);
@@ -100,50 +102,52 @@ describe("Project Files Manager Tests", () => {
100102

101103
it("maps non-platform specific files to device file paths for ios platform", async () => {
102104
const files = ["~/TestApp/app/test.js", "~/TestApp/app/myfile.js"];
103-
const localToDevicePaths = await projectFilesManager.createLocalToDevicePaths(
104-
iOSDeviceAppData,
105-
"~/TestApp/app",
106-
files,
107-
[]
108-
);
105+
const localToDevicePaths =
106+
await projectFilesManager.createLocalToDevicePaths(
107+
iOSDeviceAppData,
108+
"~/TestApp/app",
109+
files,
110+
[],
111+
);
109112

110113
_.each(localToDevicePaths, (localToDevicePathData, index) => {
111114
assert.equal(files[index], localToDevicePathData.getLocalPath());
112115
assert.equal(
113116
mobileHelper.buildDevicePath(
114117
iOSDeviceProjectRootPath,
115-
path.basename(files[index])
118+
path.basename(files[index]),
116119
),
117-
localToDevicePathData.getDevicePath()
120+
localToDevicePathData.getDevicePath(),
118121
);
119122
assert.equal(
120123
path.basename(files[index]),
121-
localToDevicePathData.getRelativeToProjectBasePath()
124+
localToDevicePathData.getRelativeToProjectBasePath(),
122125
);
123126
});
124127
});
125128

126129
it("maps non-platform specific files to device file paths for android platform", async () => {
127130
const files = ["~/TestApp/app/test.js", "~/TestApp/app/myfile.js"];
128-
const localToDevicePaths = await projectFilesManager.createLocalToDevicePaths(
129-
androidDeviceAppData,
130-
"~/TestApp/app",
131-
files,
132-
[]
133-
);
131+
const localToDevicePaths =
132+
await projectFilesManager.createLocalToDevicePaths(
133+
androidDeviceAppData,
134+
"~/TestApp/app",
135+
files,
136+
[],
137+
);
134138

135139
_.each(localToDevicePaths, (localToDevicePathData, index) => {
136140
assert.equal(files[index], localToDevicePathData.getLocalPath());
137141
assert.equal(
138142
mobileHelper.buildDevicePath(
139143
androidDeviceProjectRootPath,
140-
path.basename(files[index])
144+
path.basename(files[index]),
141145
),
142-
localToDevicePathData.getDevicePath()
146+
localToDevicePathData.getDevicePath(),
143147
);
144148
assert.equal(
145149
path.basename(files[index]),
146-
localToDevicePathData.getRelativeToProjectBasePath()
150+
localToDevicePathData.getRelativeToProjectBasePath(),
147151
);
148152
});
149153
});
@@ -155,18 +159,18 @@ describe("Project Files Manager Tests", () => {
155159
iOSDeviceAppData,
156160
"~/TestApp/app",
157161
[filePath],
158-
[]
162+
[],
159163
)
160164
)[0];
161165

162166
assert.equal(filePath, localToDevicePathData.getLocalPath());
163167
assert.equal(
164168
mobileHelper.buildDevicePath(iOSDeviceProjectRootPath, "test.js"),
165-
localToDevicePathData.getDevicePath()
169+
localToDevicePathData.getDevicePath(),
166170
);
167171
assert.equal(
168172
"test.ios.js",
169-
localToDevicePathData.getRelativeToProjectBasePath()
173+
localToDevicePathData.getRelativeToProjectBasePath(),
170174
);
171175
});
172176

@@ -177,18 +181,18 @@ describe("Project Files Manager Tests", () => {
177181
androidDeviceAppData,
178182
"~/TestApp/app",
179183
[filePath],
180-
[]
184+
[],
181185
)
182186
)[0];
183187

184188
assert.equal(filePath, localToDevicePathData.getLocalPath());
185189
assert.equal(
186190
mobileHelper.buildDevicePath(androidDeviceProjectRootPath, "test.js"),
187-
localToDevicePathData.getDevicePath()
191+
localToDevicePathData.getDevicePath(),
188192
);
189193
assert.equal(
190194
"test.android.js",
191-
localToDevicePathData.getRelativeToProjectBasePath()
195+
localToDevicePathData.getRelativeToProjectBasePath(),
192196
);
193197
});
194198

@@ -199,7 +203,7 @@ describe("Project Files Manager Tests", () => {
199203
projectFilesManager.processPlatformSpecificFiles(
200204
directoryPath,
201205
"android",
202-
{}
206+
{},
203207
);
204208

205209
const fs = testInjector.resolve("fs");
@@ -228,7 +232,7 @@ describe("Project Files Manager Tests", () => {
228232
testInjector,
229233
"test.release.x",
230234
releaseFileContent,
231-
directoryPath
235+
directoryPath,
232236
);
233237

234238
projectFilesManager.processPlatformSpecificFiles(directoryPath, "android", {
@@ -241,7 +245,7 @@ describe("Project Files Manager Tests", () => {
241245
assert.isFalse(fs.exists(path.join(directoryPath, "test.release.x")));
242246
assert.isTrue(
243247
fs.readFile(path.join(directoryPath, "test.x")).toString() ===
244-
releaseFileContent
248+
releaseFileContent,
245249
);
246250
});
247251

@@ -253,7 +257,7 @@ describe("Project Files Manager Tests", () => {
253257
projectFilesManager.processPlatformSpecificFiles(
254258
directoryPath,
255259
"android",
256-
{}
260+
{},
257261
);
258262

259263
const fs = testInjector.resolve("fs");
@@ -262,7 +266,7 @@ describe("Project Files Manager Tests", () => {
262266
assert.isFalse(fs.exists(path.join(directoryPath, "test.release.x")));
263267
assert.isTrue(
264268
fs.readFile(path.join(directoryPath, "test.x")).toString() ===
265-
debugFileContent
269+
debugFileContent,
266270
);
267271
});
268272

0 commit comments

Comments
 (0)