Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-info

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-info - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# [1.5.0](https://github.com/ffflorian/electron-info/compare/v1.4.0...v1.5.0) (2019-07-25)
### Features
- A command for every dependency, support non-colored output ([cd36e73](https://github.com/ffflorian/electron-info/commit/cd36e73))
# [1.4.0](https://github.com/ffflorian/electron-info/compare/v1.3.0...v1.4.0) (2019-07-25)

@@ -2,0 +8,0 @@

50

dist/cli.js

@@ -17,27 +17,11 @@ #!/usr/bin/env node

const { description, name, version } = require(packageJsonPath);
const needsN = (name) => `a${/^[aeoui]/.test(name) ? 'n' : ''} ${name}`;
program
.name(name)
.description(description)
.option('-f, --force', 'Force downloading the latest release file (default: false)')
.option('-r, --raw', 'Output raw JSON (default: false)')
.option('-f, --force', 'Force downloading the latest release file')
.option('-r, --raw', 'Output raw JSON')
.option('--no-colors', `Don't use colors for displaying`)
.version(version, '-v, --version');
program
.command('chrome')
.alias('c')
.description('Get informations about a Chrome version (e.g. "chrome 73" or "chrome latest")')
.arguments('[version]')
.action((version, { parent }) => __awaiter(this, void 0, void 0, function* () {
if (!version) {
program.outputHelp();
process.exit();
}
try {
const releases = yield new ElectronInfo_1.ElectronInfo().getChromeReleases(version, !parent.raw);
console.log(releases);
}
catch (error) {
console.error(error);
}
}));
program
.command('electron')

@@ -53,3 +37,3 @@ .alias('e')

try {
const releases = yield new ElectronInfo_1.ElectronInfo().getElectronReleases(version, !parent.raw);
const releases = yield new ElectronInfo_1.ElectronInfo().getElectronReleases(version, !parent.raw, !parent.disableColors);
console.log(releases);

@@ -61,8 +45,28 @@ }

}));
for (const dependency of ElectronInfo_1.SupportedDependencies) {
program
.command(dependency)
.alias(dependency[0])
.description(`Get informations about ${needsN(dependency)} version`)
.arguments('[version]')
.action((version, { parent }) => __awaiter(this, void 0, void 0, function* () {
if (!version) {
program.outputHelp();
process.exit();
}
try {
const releases = yield new ElectronInfo_1.ElectronInfo().getDependencyReleases(dependency, version, !parent.raw, !parent.disableColors);
console.log(releases);
}
catch (error) {
console.error(error);
}
}));
}
program
.command('all')
.description('Get informations about all Electron versions')
.description('Get informations about all versions')
.action(({ parent }) => __awaiter(this, void 0, void 0, function* () {
try {
const releases = yield new ElectronInfo_1.ElectronInfo().getAllReleases(!parent.raw);
const releases = yield new ElectronInfo_1.ElectronInfo().getAllReleases(!parent.raw, !parent.disableColors);
console.log(releases);

@@ -69,0 +73,0 @@ }

@@ -27,2 +27,3 @@ export interface RawDeps {

}
export declare const SupportedDependencies: Array<keyof RawDeps>;
export declare class ElectronInfo {

@@ -32,10 +33,7 @@ private readonly options;

getAllReleases(formatted?: false): Promise<RawReleaseInfo[]>;
getAllReleases(formatted?: boolean): Promise<RawReleaseInfo[] | string>;
getAllReleases(formatted: true): Promise<string>;
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>;
getAllReleases(formatted: true, colored?: boolean): Promise<string>;
getDependencyReleases(dependency: keyof RawDeps, version: string, formatted?: false): Promise<RawReleaseInfo[] | void>;
getDependencyReleases(dependency: keyof RawDeps, version: string, formatted: true, colored?: boolean): Promise<RawReleaseInfo[] | 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>;
getElectronReleases(version: string, formatted: true, colored?: boolean): Promise<string | void>;
private buildFoundString;

@@ -45,7 +43,7 @@ private fileIsReadable;

private createTempDir;
private buildTables;
private buildRawTables;
private formatReleases;
private formatChromeReleases;
private formatDependencyReleases;
private getVersions;
}
export {};

@@ -29,2 +29,3 @@ "use strict";

};
exports.SupportedDependencies = ['chrome', 'modules', 'node', 'openssl', 'uv', 'v8', 'zlib'];
class ElectronInfo {

@@ -34,7 +35,7 @@ constructor(options) {

}
getAllReleases(formatted = false) {
getAllReleases(formatted, colored) {
return __awaiter(this, void 0, void 0, function* () {
const allReleases = yield this.downloadReleases();
if (formatted) {
return this.formatReleases(allReleases);
return this.formatReleases(allReleases, colored);
}

@@ -44,23 +45,23 @@ return allReleases;

}
getChromeReleases(version, formatted = false) {
getDependencyReleases(dependency, version, formatted, colored) {
return __awaiter(this, void 0, void 0, function* () {
const parsedVersions = yield this.getVersions('chrome', version);
const releases = yield this.getAllReleases(false);
const chromeReleases = releases.filter(release => release.deps && parsedVersions.includes(release.deps.chrome));
if (chromeReleases) {
const parsedVersions = yield this.getVersions(dependency, version);
const allReleases = yield this.getAllReleases(false);
const filteredReleases = allReleases.filter(release => release.deps && parsedVersions.includes(release.deps[dependency]));
if (filteredReleases) {
if (formatted) {
return this.formatChromeReleases(chromeReleases);
return this.formatDependencyReleases(filteredReleases, colored);
}
return chromeReleases;
return filteredReleases;
}
});
}
getElectronReleases(version, formatted = false) {
getElectronReleases(version, formatted, colored) {
return __awaiter(this, void 0, void 0, function* () {
const parsedVersions = yield this.getVersions('electron', version);
const releases = yield this.getAllReleases(false);
const electronReleases = releases.filter(release => parsedVersions.includes(release.version));
const allReleases = yield this.getAllReleases(false);
const electronReleases = allReleases.filter(release => parsedVersions.includes(release.version));
if (electronReleases) {
if (formatted) {
return this.formatReleases(electronReleases);
return this.formatReleases(electronReleases, colored);
}

@@ -106,8 +107,12 @@ return electronReleases;

}
buildTables(releases) {
buildRawTables(releases, colored = false) {
const coloredOrNot = (text, style, colored = false) => colored ? style(text) : text;
return releases.map(release => {
const electronVersion = `${release.version}${release.prerelease ? ' (prerelease)' : ''}`;
const table = [[bold('Dependency'), bold('Version')], [bold('Electron'), electronVersion]];
const table = [
[coloredOrNot('Dependency', bold, colored), coloredOrNot('Version', bold, colored)],
[coloredOrNot('Electron', bold, colored), electronVersion],
];
if (release.deps) {
table.push([bold.red('Node.js'), release.deps.node], [bold.green('Chrome'), release.deps.chrome], [bold.blue('OpenSSL'), release.deps.openssl], [bold.yellow('V8'), release.deps.v8]);
table.push([coloredOrNot('Node.js', bold.red, colored), release.deps.node], [coloredOrNot('Chrome', bold.green, colored), release.deps.chrome], [coloredOrNot('OpenSSL', bold.blue, colored), release.deps.openssl], [coloredOrNot('Modules', bold.yellow, colored), release.deps.modules], [coloredOrNot('uv', bold.cyan, colored), release.deps.uv], [coloredOrNot('V8', bold.gray, colored), release.deps.v8], [coloredOrNot('zlib', bold.magenta, colored), release.deps.zlib]);
}

@@ -117,7 +122,7 @@ return table;

}
formatReleases(releases) {
formatReleases(releases, colored = false) {
if (!releases.length) {
return `Found 0 releases.`;
return this.buildFoundString(releases);
}
const joinedReleases = this.buildTables(releases)
const joinedReleases = this.buildRawTables(releases, colored)
.map(table => table_1.table(table))

@@ -127,8 +132,8 @@ .join('\n');

}
formatChromeReleases(releases) {
formatDependencyReleases(releases, colored = false) {
releases = releases.filter(release => !!release.deps);
if (!releases.length) {
return `Found 0 releases.`;
return this.buildFoundString(releases);
}
const joinedReleases = this.buildTables(releases)
const joinedReleases = this.buildRawTables(releases, colored)
.map(table => table_1.table(table))

@@ -135,0 +140,0 @@ .join('\n');

@@ -79,3 +79,3 @@ {

},
"version": "1.4.0"
"version": "1.5.0"
}

@@ -13,4 +13,5 @@ # electron-info [![Build Status](https://action-badges.now.sh/ffflorian/electron-info)](https://github.com/ffflorian/electron-info/actions/) [![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=ffflorian/electron-info)](https://dependabot.com)

Options:
-f, --force Force downloading the latest release file (default: false)
-r, --raw Output raw JSON (default: false)
-f, --force Force downloading the latest release file
-r, --raw Output raw JSON
--no-colors Don't use colors for displaying
-v, --version output the version number

@@ -20,5 +21,11 @@ -h, --help output usage information

Commands:
chrome|c [version] Get informations about a Chrome version (e.g. "chrome 73" or "chrome latest")
electron|e [version] Get informations about an Electron version (e.g. "electron 5.0.7" or "electron latest")
all Get informations about all Electron versions
chrome|c [version] Get informations about a chrome version
modules|m [version] Get informations about a modules version
node|n [version] Get informations about a node version
openssl|o [version] Get informations about an openssl version
uv|u [version] Get informations about an uv version
v8|v [version] Get informations about a v8 version
zlib|z [version] Get informations about a zlib version
all Get informations about all versions
```

@@ -29,3 +36,3 @@

```
$ electron-info electron 4
electron-info electron 4
╔════════════╤═══════════════════════╗

@@ -44,2 +51,20 @@ ║ Dependency │ Version ║

╚════════════╧═══════════════════════╝
╔════════════╤═══════════════════════╗
║ Dependency │ Version ║
╟────────────┼───────────────────────╢
║ Electron │ 4.2.7 ║
╟────────────┼───────────────────────╢
║ Node.js │ 10.11.0 ║
╟────────────┼───────────────────────╢
║ Chrome │ 69.0.3497.128 ║
╟────────────┼───────────────────────╢
║ OpenSSL │ 1.1.0 ║
╟────────────┼───────────────────────╢
║ V8 │ 6.9.427.31-electron.0 ║
╚════════════╧═══════════════════════╝
[...]
Found 41 releases.
```

@@ -76,2 +101,4 @@

╚════════════╧═════════════════════════════════════╝
Found 2 releases.
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc