Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Fix (publish): Remove binary-plist and use simple-plist instead #1076

Merged
merged 1 commit into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ $injector.requireCommand("proxy|set", "./commands/proxy/proxy-set");
$injector.requireCommand("proxy|clear", "./commands/proxy/proxy-clear");

$injector.require("utils", "./utils");
$injector.require("bplistParser", "./bplist-parser");
$injector.require("plistParser", "./plist-parser");
$injector.require("winreg", "./winreg");

$injector.require("loggingLevels", "./mobile/logging-levels");
Expand Down
17 changes: 0 additions & 17 deletions bplist-parser.ts

This file was deleted.

11 changes: 10 additions & 1 deletion declarations.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1365,8 +1365,17 @@ interface IUtils {
getMilliSecondsTimeout(defaultTimeout: number): number;
}

interface IBinaryPlistParser {
/**
* Used for parsing of .plist files
*/
interface IPlistParser {
/**
* Parses the .plist file and returns the result as object
* @param {string} plistFilePath Absolute path to .plist file
* @return {Promise<any>} The parsed object
*/
parseFile(plistFilePath: string): Promise<any>;
parseFileSync(plistFilePath: string): any;
}

interface IUserSettingsService extends UserSettings.IUserSettingsService {
Expand Down
4 changes: 0 additions & 4 deletions definitions/bplist-parser.d.ts

This file was deleted.

4 changes: 4 additions & 0 deletions definitions/simple-plist.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module "simple-plist" {
export function readFile(filePath: string, callback?:(err: Error, obj: any) => void): void;
export function readFileSync(filePath: string): any;
}
4 changes: 2 additions & 2 deletions mobile/ios/simulator/ios-simulator-application-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
private identifier: string,
private $options: ICommonOptions,
private $fs: IFileSystem,
private $bplistParser: IBinaryPlistParser,
private $plistParser: IPlistParser,
private $iOSSimulatorLogProvider: Mobile.IiOSSimulatorLogProvider,
private $deviceLogProvider: Mobile.IDeviceLogProvider,
$logger: ILogger,
Expand Down Expand Up @@ -90,7 +90,7 @@ export class IOSSimulatorApplicationManager extends ApplicationManagerBase {
const applicationPath = this.iosSim.getApplicationPath(this.identifier, appIdentifier),
pathToInfoPlist = path.join(applicationPath, "Info.plist");

return this.$fs.exists(pathToInfoPlist) ? (await this.$bplistParser.parseFile(pathToInfoPlist))[0] : null;
return this.$fs.exists(pathToInfoPlist) ? await this.$plistParser.parseFile(pathToInfoPlist) : null;
}

public async getDebuggableApps(): Promise<Mobile.IDeviceApplicationInformation[]> {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"Proton"
],
"dependencies": {
"bplist-parser": "0.0.6",
"bufferpack": "0.0.6",
"byline": "4.2.1",
"chalk": "1.0.0",
Expand Down Expand Up @@ -63,6 +62,7 @@
"rimraf": "2.2.6",
"semver": "5.3.0",
"shelljs": "0.7.5",
"simple-plist": "0.2.1",
"source-map": "0.5.6",
"tabtab": "https://github.com/Icenium/node-tabtab/tarball/master",
"temp": "0.8.1",
Expand Down
20 changes: 20 additions & 0 deletions plist-parser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import * as simplePlist from "simple-plist";

export class PlistParser implements IPlistParser {
public parseFile(plistFilePath: string): Promise<any> {
return new Promise<any>((resolve, reject) => {
simplePlist.readFile(plistFilePath, (err: Error, obj: any) => {
if (err) {
reject(err);
} else {
resolve(obj);
}
});
});
}

public parseFileSync(plistFilePath: string): any {
return simplePlist.readFileSync(plistFilePath);
}
}
$injector.register("plistParser", PlistParser);