electron-info
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -0,1 +1,7 @@ | ||
# [1.4.0](https://github.com/ffflorian/electron-info/compare/v1.3.0...v1.4.0) (2019-07-25) | ||
### Features | ||
- Unify output ([64c356b](https://github.com/ffflorian/electron-info/commit/64c356b)) | ||
# [1.3.0](https://github.com/ffflorian/electron-info/compare/v1.2.1...v1.3.0) (2019-07-25) | ||
@@ -2,0 +8,0 @@ |
@@ -34,13 +34,4 @@ #!/usr/bin/env node | ||
try { | ||
const releases = yield new ElectronInfo_1.ElectronInfo().getChromeVersion(version, !parent.raw); | ||
if (parent.raw) { | ||
console.log(releases); | ||
} | ||
else { | ||
if (releases) { | ||
for (const release of releases) { | ||
console.log(release); | ||
} | ||
} | ||
} | ||
const releases = yield new ElectronInfo_1.ElectronInfo().getChromeReleases(version, !parent.raw); | ||
console.log(releases); | ||
} | ||
@@ -62,3 +53,3 @@ catch (error) { | ||
try { | ||
const releases = yield new ElectronInfo_1.ElectronInfo().getElectronVersion(version, !parent.raw); | ||
const releases = yield new ElectronInfo_1.ElectronInfo().getElectronReleases(version, !parent.raw); | ||
console.log(releases); | ||
@@ -76,12 +67,3 @@ } | ||
const releases = yield new ElectronInfo_1.ElectronInfo().getAllReleases(!parent.raw); | ||
if (parent.raw || typeof releases === 'string') { | ||
console.log(releases); | ||
} | ||
else { | ||
if (Array.isArray(releases)) { | ||
for (const release of releases) { | ||
console.log(release); | ||
} | ||
} | ||
} | ||
console.log(releases); | ||
} | ||
@@ -88,0 +70,0 @@ catch (error) { |
@@ -33,16 +33,17 @@ export interface RawDeps { | ||
getAllReleases(formatted: true): Promise<string>; | ||
getChromeVersion(version: string, formatted?: false): Promise<RawReleaseInfo[] | void>; | ||
getChromeVersion(version: string, formatted?: boolean): Promise<RawReleaseInfo[] | string[] | void>; | ||
getChromeVersion(version: string, formatted: true): Promise<string[] | void>; | ||
getElectronVersion(version: string, formatted?: false): Promise<RawReleaseInfo[] | void>; | ||
getElectronVersion(version: string, formatted?: boolean): Promise<RawReleaseInfo[] | string | void>; | ||
getElectronVersion(version: string, formatted: true): Promise<string | void>; | ||
getChromeReleases(version: string, formatted?: false): Promise<RawReleaseInfo[] | void>; | ||
getChromeReleases(version: string, formatted?: boolean): Promise<RawReleaseInfo[] | string | void>; | ||
getChromeReleases(version: string, formatted: true): Promise<string | void>; | ||
getElectronReleases(version: string, formatted?: false): Promise<RawReleaseInfo[] | void>; | ||
getElectronReleases(version: string, formatted?: boolean): Promise<RawReleaseInfo[] | string | void>; | ||
getElectronReleases(version: string, formatted: true): Promise<string | void>; | ||
private buildFoundString; | ||
private fileIsReadable; | ||
private getReleases; | ||
private downloadReleases; | ||
private createTempDir; | ||
private buildTables; | ||
private formatElectronReleases; | ||
private formatChromeRelease; | ||
private formatReleases; | ||
private formatChromeReleases; | ||
private getVersions; | ||
} | ||
export {}; |
@@ -35,10 +35,10 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const releases = yield this.getReleases(); | ||
const allReleases = yield this.downloadReleases(); | ||
if (formatted) { | ||
return releases.map(release => this.formatElectronReleases([release])).join('\n'); | ||
return this.formatReleases(allReleases); | ||
} | ||
return releases; | ||
return allReleases; | ||
}); | ||
} | ||
getChromeVersion(version, formatted = false) { | ||
getChromeReleases(version, formatted = false) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -50,3 +50,3 @@ const parsedVersions = yield this.getVersions('chrome', version); | ||
if (formatted) { | ||
return chromeReleases.map(release => this.formatChromeRelease([release])); | ||
return this.formatChromeReleases(chromeReleases); | ||
} | ||
@@ -57,3 +57,3 @@ return chromeReleases; | ||
} | ||
getElectronVersion(version, formatted = false) { | ||
getElectronReleases(version, formatted = false) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -65,3 +65,3 @@ const parsedVersions = yield this.getVersions('electron', version); | ||
if (formatted) { | ||
return this.formatElectronReleases(electronReleases); | ||
return this.formatReleases(electronReleases); | ||
} | ||
@@ -72,2 +72,5 @@ return electronReleases; | ||
} | ||
buildFoundString(releases) { | ||
return `Found ${releases.length} release${releases.length === 1 ? '' : 's'}.`; | ||
} | ||
fileIsReadable(filePath) { | ||
@@ -84,3 +87,3 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
getReleases() { | ||
downloadReleases() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -116,15 +119,20 @@ const tempDirectory = yield this.createTempDir(); | ||
} | ||
formatElectronReleases(releases) { | ||
return this.buildTables(releases) | ||
formatReleases(releases) { | ||
if (!releases.length) { | ||
return `Found 0 releases.`; | ||
} | ||
const joinedReleases = this.buildTables(releases) | ||
.map(table => table_1.table(table)) | ||
.join('\n'); | ||
return `${joinedReleases}\n${this.buildFoundString(releases)}`; | ||
} | ||
formatChromeRelease(releases) { | ||
formatChromeReleases(releases) { | ||
releases = releases.filter(release => !!release.deps); | ||
if (!releases.length) { | ||
return ''; | ||
return `Found 0 releases.`; | ||
} | ||
return this.buildTables(releases) | ||
const joinedReleases = this.buildTables(releases) | ||
.map(table => table_1.table(table)) | ||
.join('\n'); | ||
return `${joinedReleases}\n${this.buildFoundString(releases)}`; | ||
} | ||
@@ -131,0 +139,0 @@ getVersions(key, inputVersion) { |
@@ -79,3 +79,3 @@ { | ||
}, | ||
"version": "1.3.0" | ||
"version": "1.4.0" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27349
290