electron-info 1.18.0 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/{ElectronInfo.js → dist/cjs/ElectronInfo.js} +17 -47
- package/dist/cjs/ElectronInfo.js.map +1 -0
- package/{FileService.d.ts → dist/cjs/FileService.d.ts} +1 -1
- package/{FileService.js → dist/cjs/FileService.js} +17 -47
- package/dist/cjs/FileService.js.map +1 -0
- package/{HTTPService.d.ts → dist/cjs/HTTPService.d.ts} +1 -1
- package/{HTTPService.js → dist/cjs/HTTPService.js} +9 -16
- package/dist/cjs/HTTPService.js.map +1 -0
- package/{cli.js → dist/cjs/cli.js} +18 -43
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/mjs/ElectronInfo.d.ts +70 -0
- package/dist/mjs/ElectronInfo.js +156 -0
- package/dist/mjs/ElectronInfo.js.map +1 -0
- package/dist/mjs/FileService.d.ts +12 -0
- package/dist/mjs/FileService.js +94 -0
- package/dist/mjs/FileService.js.map +1 -0
- package/dist/mjs/HTTPService.d.ts +8 -0
- package/dist/mjs/HTTPService.js +36 -0
- package/dist/mjs/HTTPService.js.map +1 -0
- package/dist/mjs/cli.d.ts +2 -0
- package/dist/mjs/cli.js +105 -0
- package/dist/mjs/cli.js.map +1 -0
- package/dist/mjs/index.d.ts +1 -0
- package/dist/mjs/index.js +2 -0
- package/dist/mjs/index.js.map +1 -0
- package/dist/mjs/package.json +3 -0
- package/package.json +23 -28
- package/ElectronInfo.js.map +0 -1
- package/FileService.js.map +0 -1
- package/HTTPService.js.map +0 -1
- package/cli.js.map +0 -1
- package/index.d.ts +0 -1
- package/index.js +0 -18
- package/index.js.map +0 -1
- /package/{ElectronInfo.d.ts → dist/cjs/ElectronInfo.d.ts} +0 -0
- /package/{cli.d.ts → dist/cjs/cli.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
# electron-info [](https://www.gnu.org/licenses/gpl-3.0) [](https://www.npmjs.com/package/electron-info)
|
|
4
4
|
|
|
5
|
-
Get useful data about Electron releases. Uses [electron-releases](https://github.com/electron/releases) in the background
|
|
5
|
+
Get useful data about Electron releases. Uses [electron-releases](https://github.com/electron/releases) in the background.## Prerequisites
|
|
6
|
+
|
|
7
|
+
- [Node.js](https://nodejs.org) >= 14
|
|
8
|
+
- npm (preinstalled) or [yarn](https://classic.yarnpkg.com) < 2
|
|
6
9
|
|
|
7
10
|
## Installation
|
|
8
11
|
|
|
12
|
+
ℹ️ This is a hybrid [CommonJS](https://nodejs.org/docs/latest/api/modules.html#modules-commonjs-modules) / [ESM](https://nodejs.org/api/esm.html#introduction) module.
|
|
13
|
+
|
|
9
14
|
Just run `npx electron-info`.
|
|
10
15
|
|
|
11
16
|
If you'd like to install it permanently, run `yarn global add electron-info` or `npm i -g electron-info`.
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,17 +7,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
8
|
});
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const date_fns_1 = require("date-fns");
|
|
41
|
-
const table_1 = require("table");
|
|
42
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
43
|
-
const semver = __importStar(require("semver"));
|
|
44
|
-
const FileService_1 = require("./FileService");
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { format as formatDate } from 'date-fns';
|
|
12
|
+
import { table as createTable } from 'table';
|
|
13
|
+
import logdown from 'logdown';
|
|
14
|
+
import * as semver from 'semver';
|
|
15
|
+
import { FileService } from './FileService.js';
|
|
45
16
|
const defaultOptions = {
|
|
46
17
|
debug: false,
|
|
47
18
|
electronPrereleases: true,
|
|
@@ -52,7 +23,7 @@ const defaultOptions = {
|
|
|
52
23
|
tempDirectory: '',
|
|
53
24
|
timeout: 2000,
|
|
54
25
|
};
|
|
55
|
-
|
|
26
|
+
export const SupportedDependencies = {
|
|
56
27
|
chrome: 'Chrome',
|
|
57
28
|
modules: 'Modules (Node ABI)',
|
|
58
29
|
node: 'Node.js',
|
|
@@ -61,18 +32,18 @@ exports.SupportedDependencies = {
|
|
|
61
32
|
v8: 'V8',
|
|
62
33
|
zlib: 'zlib',
|
|
63
34
|
};
|
|
64
|
-
class ElectronInfo {
|
|
35
|
+
export class ElectronInfo {
|
|
65
36
|
constructor(options) {
|
|
66
37
|
this.options = Object.assign(Object.assign({}, defaultOptions), options);
|
|
67
38
|
this.options.limit = Math.max(0, this.options.limit);
|
|
68
|
-
this.logger = (
|
|
39
|
+
this.logger = logdown('electron-info/ElectronInfo', {
|
|
69
40
|
logger: console,
|
|
70
41
|
markdown: false,
|
|
71
42
|
});
|
|
72
43
|
if (this.options.debug) {
|
|
73
44
|
this.logger.state.isEnabled = true;
|
|
74
45
|
}
|
|
75
|
-
this.fileService = new
|
|
46
|
+
this.fileService = new FileService(this.options);
|
|
76
47
|
this.logger.log('Initialized', this.options);
|
|
77
48
|
}
|
|
78
49
|
getAllReleases(formatted, colored) {
|
|
@@ -113,15 +84,15 @@ class ElectronInfo {
|
|
|
113
84
|
return releases.map(release => {
|
|
114
85
|
const electronVersion = `${release.version}${release.prerelease ? ' (prerelease)' : ''}`;
|
|
115
86
|
const parsedDate = new Date(release.published_at);
|
|
116
|
-
const releaseDate = (
|
|
87
|
+
const releaseDate = formatDate(parsedDate, 'yyyy-MM-dd');
|
|
117
88
|
const table = [
|
|
118
|
-
[coloredOrNot('Electron',
|
|
119
|
-
[coloredOrNot('Published on',
|
|
89
|
+
[coloredOrNot('Electron', chalk.bold), electronVersion],
|
|
90
|
+
[coloredOrNot('Published on', chalk.bold), releaseDate],
|
|
120
91
|
];
|
|
121
92
|
if (release.deps) {
|
|
122
|
-
table.push([coloredOrNot(
|
|
93
|
+
table.push([coloredOrNot(SupportedDependencies.node, chalk.bold.red), release.deps.node], [coloredOrNot(SupportedDependencies.chrome, chalk.bold.green), release.deps.chrome], [coloredOrNot(SupportedDependencies.openssl, chalk.bold.blue), release.deps.openssl], [coloredOrNot(SupportedDependencies.modules, chalk.bold.yellow), release.deps.modules], [coloredOrNot(SupportedDependencies.uv, chalk.bold.cyan), release.deps.uv],
|
|
123
94
|
// eslint-disable-next-line no-magic-numbers
|
|
124
|
-
[coloredOrNot(
|
|
95
|
+
[coloredOrNot(SupportedDependencies.v8, chalk.bold.rgb(150, 150, 150)), release.deps.v8], [coloredOrNot(SupportedDependencies.zlib, chalk.bold.magenta), release.deps.zlib]);
|
|
125
96
|
}
|
|
126
97
|
return table;
|
|
127
98
|
});
|
|
@@ -133,7 +104,7 @@ class ElectronInfo {
|
|
|
133
104
|
return this.buildFoundString(releases);
|
|
134
105
|
}
|
|
135
106
|
const joinedReleases = this.buildRawTables(releases, colored)
|
|
136
|
-
.map(table => (
|
|
107
|
+
.map(table => createTable(table))
|
|
137
108
|
.join('\n');
|
|
138
109
|
return `${joinedReleases}\n${this.buildFoundString(releases)}`;
|
|
139
110
|
}
|
|
@@ -143,7 +114,7 @@ class ElectronInfo {
|
|
|
143
114
|
return this.buildFoundString(releases);
|
|
144
115
|
}
|
|
145
116
|
const joinedReleases = this.buildRawTables(releases, colored)
|
|
146
|
-
.map(table => (
|
|
117
|
+
.map(table => createTable(table))
|
|
147
118
|
.join('\n');
|
|
148
119
|
return `${joinedReleases}\n${this.buildFoundString(releases)}`;
|
|
149
120
|
}
|
|
@@ -199,5 +170,4 @@ class ElectronInfo {
|
|
|
199
170
|
return releases;
|
|
200
171
|
}
|
|
201
172
|
}
|
|
202
|
-
exports.ElectronInfo = ElectronInfo;
|
|
203
173
|
//# sourceMappingURL=ElectronInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ElectronInfo.js","sourceRoot":"","sources":["../../src/ElectronInfo.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,IAAI,UAAU,EAAC,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAC,KAAK,IAAI,WA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G,CAAC,yBAAyB,EAAE;gBACzC,KAAK,EAAE,WAAW,CAAC,MAAM;gBACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,KAAK;aACN,CAAC,CAAC;YACH,OAAO,WAAW,CAAC;SACpB;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -31,22 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
8
|
});
|
|
33
9
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
43
|
-
const os = __importStar(require("os"));
|
|
44
|
-
const path = __importStar(require("path"));
|
|
45
|
-
const HTTPService_1 = require("./HTTPService");
|
|
46
|
-
class FileService {
|
|
10
|
+
import { isAfter as isAfterDate, sub as subtractDate } from 'date-fns';
|
|
11
|
+
import { constants as fsConstants, promises as fs } from 'node:fs';
|
|
12
|
+
import parseUrl from 'parse-url';
|
|
13
|
+
import logdown from 'logdown';
|
|
14
|
+
import os from 'node:os';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { HTTPService } from './HTTPService.js';
|
|
17
|
+
export class FileService {
|
|
47
18
|
constructor(options) {
|
|
48
19
|
this.options = options;
|
|
49
|
-
this.logger = (
|
|
20
|
+
this.logger = logdown('electron-info/FileService', {
|
|
50
21
|
logger: console,
|
|
51
22
|
markdown: false,
|
|
52
23
|
});
|
|
@@ -54,7 +25,7 @@ class FileService {
|
|
|
54
25
|
this.logger.state.isEnabled = true;
|
|
55
26
|
}
|
|
56
27
|
this.logger.log('Initialized', this.options);
|
|
57
|
-
this.httpService = new
|
|
28
|
+
this.httpService = new HTTPService({
|
|
58
29
|
debug: this.options.debug,
|
|
59
30
|
timeout: this.options.timeout,
|
|
60
31
|
});
|
|
@@ -62,7 +33,7 @@ class FileService {
|
|
|
62
33
|
getReleases() {
|
|
63
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64
35
|
this.logger.log('Parsing releases URL', { releasesUrl: this.options.releasesUrl });
|
|
65
|
-
const parsedUrl = (
|
|
36
|
+
const parsedUrl = parseUrl(this.options.releasesUrl);
|
|
66
37
|
if (!parsedUrl.href) {
|
|
67
38
|
throw new Error('Invalid releases URL provided');
|
|
68
39
|
}
|
|
@@ -99,7 +70,7 @@ class FileService {
|
|
|
99
70
|
const tempDirectoryExists = yield this.isPathReadable(tempDirectory);
|
|
100
71
|
if (!tempDirectoryExists) {
|
|
101
72
|
this.logger.log('Creating temp directory', { tempDirectory });
|
|
102
|
-
yield
|
|
73
|
+
yield fs.mkdir(tempDirectory);
|
|
103
74
|
}
|
|
104
75
|
else {
|
|
105
76
|
this.logger.log('Temp directory exists', { tempDirectory });
|
|
@@ -109,16 +80,16 @@ class FileService {
|
|
|
109
80
|
}
|
|
110
81
|
isFileFromToday(fileName) {
|
|
111
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
const { mtime: fileModifiedDate } = yield
|
|
83
|
+
const { mtime: fileModifiedDate } = yield fs.stat(fileName);
|
|
113
84
|
this.logger.log(`File "${fileName}" is from "${fileModifiedDate.toString()}"`);
|
|
114
|
-
const yesterday = (
|
|
115
|
-
return (
|
|
85
|
+
const yesterday = subtractDate(new Date(), { days: 1 });
|
|
86
|
+
return isAfterDate(fileModifiedDate, yesterday);
|
|
116
87
|
});
|
|
117
88
|
}
|
|
118
89
|
isPathReadable(filePath) {
|
|
119
90
|
return __awaiter(this, void 0, void 0, function* () {
|
|
120
91
|
try {
|
|
121
|
-
yield
|
|
92
|
+
yield fs.access(filePath, fsConstants.F_OK | fsConstants.R_OK);
|
|
122
93
|
return true;
|
|
123
94
|
}
|
|
124
95
|
catch (error) {
|
|
@@ -130,7 +101,7 @@ class FileService {
|
|
|
130
101
|
loadReleasesFile(localPath) {
|
|
131
102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
103
|
this.logger.log('Loading local releases file:', { localPath });
|
|
133
|
-
const rawData = yield
|
|
104
|
+
const rawData = yield fs.readFile(localPath, 'utf8');
|
|
134
105
|
const releases = JSON.parse(rawData);
|
|
135
106
|
if (!Array.isArray(releases)) {
|
|
136
107
|
throw new Error('Invalid data in releases file');
|
|
@@ -139,5 +110,4 @@ class FileService {
|
|
|
139
110
|
});
|
|
140
111
|
}
|
|
141
112
|
}
|
|
142
|
-
exports.FileService = FileService;
|
|
143
113
|
//# sourceMappingURL=FileService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileService.js","sourceRoot":"","sources":["../../src/FileService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,OAAO,IAAI,WAAW,EAAE,GAAG,IAAI,YAAY,EAAC,MAAM,UAAU,CAAC;AACrE,OAAO,EAAC,SAAS,IAAI,WAAW,EAAE,QAAQ,IAAI,EAAE,EAAC,MAAM,SAAS,CAAC;AACjE,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,MAAM,OAAO,WAAW;IAKtB,YAAY,OAA0B;QACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,2BAA2B,EAAE;YACjD,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;SACpC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAC;YACjC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;SAC9B,CAAC,CAAC;IACL,CAAC;IAEK,WAAW;;YACf,IAAI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CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,QAAQ,cAAc,gBAAgB,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YAE/E,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,IAAI,EAAE,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC;YACtD,OAAO,WAAW,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;QAClD,CAAC;KAAA;IAEa,cAAc,CAAC,QAAgB;;YAC3C,IAAI;gBACF,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;gBAC/D,OAAO,IAAI,CAAC;aACb;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,EAAE,EAAC,YAAY,EAAG,KAAe,CAAC,OAAO,EAAC,CAAC,CAAC;gBACnF,OAAO,KAAK,CAAC;aACd;QACH,CAAC;KAAA;IAEa,gBAAgB,CAAC,SAAiB;;YAC9C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,8BAA8B,EAAE,EAAC,SAAS,EAAC,CAAC,CAAC;YAC7D,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAErC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAC5B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;aAClD;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
2
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
3
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,19 +7,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
8
|
});
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const fs_1 = require("fs");
|
|
17
|
-
const util_1 = require("util");
|
|
18
|
-
const axios_1 = __importDefault(require("axios"));
|
|
19
|
-
const logdown_1 = __importDefault(require("logdown"));
|
|
20
|
-
class HTTPService {
|
|
10
|
+
import { promises as fs } from 'node:fs';
|
|
11
|
+
import { inspect } from 'node:util';
|
|
12
|
+
import axios from 'axios';
|
|
13
|
+
import logdown from 'logdown';
|
|
14
|
+
export class HTTPService {
|
|
21
15
|
constructor(options) {
|
|
22
16
|
this.options = options;
|
|
23
|
-
this.logger = (
|
|
17
|
+
this.logger = logdown('electron-info/HTTPService', {
|
|
24
18
|
logger: console,
|
|
25
19
|
markdown: false,
|
|
26
20
|
});
|
|
@@ -34,21 +28,20 @@ class HTTPService {
|
|
|
34
28
|
this.logger.log('Downloading releases file:', { downloadUrl, targetFile });
|
|
35
29
|
let releases = [];
|
|
36
30
|
try {
|
|
37
|
-
const response = yield
|
|
31
|
+
const response = yield axios.get(downloadUrl, { timeout: this.options.timeout });
|
|
38
32
|
releases = response.data;
|
|
39
33
|
}
|
|
40
34
|
catch (error) {
|
|
41
35
|
throw new Error(`Request failed: "${error.message}"`);
|
|
42
36
|
}
|
|
43
37
|
// eslint-disable-next-line no-magic-numbers
|
|
44
|
-
this.logger.info('Received data from server:',
|
|
38
|
+
this.logger.info('Received data from server:', inspect(releases).toString().slice(0, 40), '...');
|
|
45
39
|
if (!Array.isArray(releases)) {
|
|
46
40
|
throw new Error('Invalid data received from server');
|
|
47
41
|
}
|
|
48
|
-
yield
|
|
42
|
+
yield fs.writeFile(targetFile, JSON.stringify(releases));
|
|
49
43
|
return releases;
|
|
50
44
|
});
|
|
51
45
|
}
|
|
52
46
|
}
|
|
53
|
-
exports.HTTPService = HTTPService;
|
|
54
47
|
//# sourceMappingURL=HTTPService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HTTPService.js","sourceRoot":"","sources":["../../src/HTTPService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,QAAQ,IAAI,EAAE,EAAC,MAAM,SAAS,CAAC;AACvC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,SAAS,CAAC;AAM9B,MAAM,OAAO,WAAW;IAItB,YAAY,OAA8B;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,2BAA2B,EAAE;YACjD,MAAM,EAAE,OAAO;YACf,QAAQ,EAAE,KAAK;SAChB,CAAC,CAAC;QACH,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE;YACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;SACpC;QACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAEY,oBAAoB,CAAC,WAAmB,EAAE,UAAkB;;YACvE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,EAAE,EAAC,WAAW,EAAE,UAAU,EAAC,CAAC,CAAC;YAEzE,IAAI,QAAQ,GAAG,EAAE,CAAC;YAElB,IAAI;gBACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAmB,WAAW,EAAE,EAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAC,CAAC,CAAC;gBACjG,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC;aAC1B;YAAC,OAAO,KAAK,EAAE;gBACd,MAAM,IAAI,KAAK,CAAC,oBAAqB,KAAe,CAAC,OAAO,GAAG,CAAC,CAAC;aAClE;YAED,4CAA4C;YAC5C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;YAEjG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAC5B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;aACtD;YAED,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;YACzD,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF"}
|
|
@@ -1,28 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -32,11 +8,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
9
|
});
|
|
34
10
|
};
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const ElectronInfo_1 = require("./ElectronInfo");
|
|
11
|
+
import { program as commander } from 'commander';
|
|
12
|
+
import fs from 'node:fs';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
import { ElectronInfo, SupportedDependencies } from './ElectronInfo.js';
|
|
40
15
|
const defaultPackageJsonPath = path.join(__dirname, 'package.json');
|
|
41
16
|
const packageJsonPath = fs.existsSync(defaultPackageJsonPath)
|
|
42
17
|
? defaultPackageJsonPath
|
|
@@ -44,7 +19,7 @@ const packageJsonPath = fs.existsSync(defaultPackageJsonPath)
|
|
|
44
19
|
const packageJson = fs.readFileSync(packageJsonPath, 'utf-8');
|
|
45
20
|
const { description, name, version } = JSON.parse(packageJson);
|
|
46
21
|
let matchedCommand = false;
|
|
47
|
-
|
|
22
|
+
commander
|
|
48
23
|
.name(name)
|
|
49
24
|
.description(`${description}
|
|
50
25
|
|
|
@@ -62,8 +37,8 @@ Allowed version argument inputs:
|
|
|
62
37
|
.version(version, '-v, --version')
|
|
63
38
|
.option('--no-colors', `don't use colors for displaying`)
|
|
64
39
|
.option('--no-prereleases', `don't include Electron prereleases`);
|
|
65
|
-
const commanderOptions =
|
|
66
|
-
|
|
40
|
+
const commanderOptions = commander.opts();
|
|
41
|
+
commander
|
|
67
42
|
.command('electron')
|
|
68
43
|
.alias('e')
|
|
69
44
|
.description('show data for Electron releases')
|
|
@@ -72,11 +47,11 @@ commander_1.program
|
|
|
72
47
|
matchedCommand = true;
|
|
73
48
|
if (!input) {
|
|
74
49
|
console.error('No version specified.');
|
|
75
|
-
|
|
50
|
+
commander.outputHelp();
|
|
76
51
|
process.exit();
|
|
77
52
|
}
|
|
78
53
|
try {
|
|
79
|
-
const electronInfo = new
|
|
54
|
+
const electronInfo = new ElectronInfo(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (commanderOptions.debug && { debug: true })), (commanderOptions.force && { forceUpdate: true })), (commanderOptions.latest && { latest: true })), (commanderOptions.limit && { limit: parseInt(commanderOptions.limit, 10) })), (typeof commanderOptions.prereleases !== undefined && { electronPrereleases: commanderOptions.prereleases })), (commanderOptions.source && { releasesUrl: commanderOptions.source })), (commanderOptions.timeout && { timeout: parseInt(commanderOptions.timeout, 10) })));
|
|
80
55
|
const releases = commanderOptions.raw
|
|
81
56
|
? yield electronInfo.getElectronReleases(input)
|
|
82
57
|
: yield electronInfo.getElectronReleases(input, true, commanderOptions.colors);
|
|
@@ -87,8 +62,8 @@ commander_1.program
|
|
|
87
62
|
process.exit(1);
|
|
88
63
|
}
|
|
89
64
|
}));
|
|
90
|
-
for (const [dependencyShortName, dependencyFullName] of Object.entries(
|
|
91
|
-
|
|
65
|
+
for (const [dependencyShortName, dependencyFullName] of Object.entries(SupportedDependencies)) {
|
|
66
|
+
commander
|
|
92
67
|
.command(dependencyShortName)
|
|
93
68
|
.alias(dependencyShortName[0])
|
|
94
69
|
.description(`show data for ${dependencyFullName} releases`)
|
|
@@ -97,11 +72,11 @@ for (const [dependencyShortName, dependencyFullName] of Object.entries(ElectronI
|
|
|
97
72
|
matchedCommand = true;
|
|
98
73
|
if (!version) {
|
|
99
74
|
console.error('No version specified.');
|
|
100
|
-
|
|
75
|
+
commander.outputHelp();
|
|
101
76
|
process.exit();
|
|
102
77
|
}
|
|
103
78
|
try {
|
|
104
|
-
const electronInfo = new
|
|
79
|
+
const electronInfo = new ElectronInfo(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (commanderOptions.debug && { debug: true })), (commanderOptions.force && { forceUpdate: true })), (commanderOptions.latest && { latest: true })), (commanderOptions.limit && { limit: parseInt(commanderOptions.limit, 10) })), (typeof commanderOptions.prereleases !== undefined && { electronPrereleases: commanderOptions.prereleases })), (commanderOptions.source && { releasesUrl: commanderOptions.source })), (commanderOptions.timeout && { timeout: commanderOptions.timeout })));
|
|
105
80
|
const releases = commanderOptions.raw
|
|
106
81
|
? yield electronInfo.getDependencyReleases(dependencyShortName, version)
|
|
107
82
|
: yield electronInfo.getDependencyReleases(dependencyShortName, version, true, commanderOptions.colors);
|
|
@@ -113,14 +88,14 @@ for (const [dependencyShortName, dependencyFullName] of Object.entries(ElectronI
|
|
|
113
88
|
}
|
|
114
89
|
}));
|
|
115
90
|
}
|
|
116
|
-
|
|
91
|
+
commander
|
|
117
92
|
.command('all', { isDefault: true })
|
|
118
93
|
.alias('a')
|
|
119
94
|
.description('show data for all kinds of releases')
|
|
120
95
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
96
|
matchedCommand = true;
|
|
122
97
|
try {
|
|
123
|
-
const electronInfo = new
|
|
98
|
+
const electronInfo = new ElectronInfo(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (commanderOptions.debug && { debug: true })), (commanderOptions.force && { forceUpdate: true })), (commanderOptions.latest && { latest: true })), (commanderOptions.limit && { limit: parseInt(commanderOptions.limit, 10) })), (typeof commanderOptions.prereleases !== undefined && { electronPrereleases: commanderOptions.prereleases })), (commanderOptions.source && { releasesUrl: commanderOptions.source })), (commanderOptions.timeout && { timeout: commanderOptions.timeout })));
|
|
124
99
|
const releases = commanderOptions.raw
|
|
125
100
|
? yield electronInfo.getAllReleases()
|
|
126
101
|
: yield electronInfo.getAllReleases(true, commanderOptions.colors);
|
|
@@ -131,9 +106,9 @@ commander_1.program
|
|
|
131
106
|
process.exit(1);
|
|
132
107
|
}
|
|
133
108
|
}));
|
|
134
|
-
|
|
135
|
-
if (!
|
|
109
|
+
commander.parse(process.argv);
|
|
110
|
+
if (!commander.args.length || !matchedCommand) {
|
|
136
111
|
console.error('Invalid or no command specified.');
|
|
137
|
-
|
|
112
|
+
commander.help();
|
|
138
113
|
}
|
|
139
114
|
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,EAAC,OAAO,IAAI,SAAS,EAAC,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,YAAY,EAAW,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAE/E,MAAM,sBAAsB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AACpE,MAAM,eAAe,GAAG,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAC3D,CAAC,CAAC,sBAAsB;IACxB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,iBAAiB,CAAC,CAAC;AAE5C,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAC9D,MAAM,EAAC,WAAW,EAAE,IAAI,EAAE,OAAO,EAAC,GAAyD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAEnH,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B,SAAS;KACN,IAAI,CAAC,IAAI,CAAC;KACV,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AK,CAAC,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACjB;AACH,CAAC,CAAA,CAAC,CAAC;AAEL,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,cAAc,EAAE;IAC7C,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAClD,SAAS,CAAC,IAAI,EAAE,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ElectronInfo.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface RawDeps {
|
|
2
|
+
chrome: string;
|
|
3
|
+
modules: string;
|
|
4
|
+
node: string;
|
|
5
|
+
openssl: string;
|
|
6
|
+
uv: string;
|
|
7
|
+
v8: string;
|
|
8
|
+
zlib: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RawReleaseInfo {
|
|
11
|
+
deps?: RawDeps;
|
|
12
|
+
name: string;
|
|
13
|
+
node_id: string;
|
|
14
|
+
npm_dist_tags: string[];
|
|
15
|
+
npm_package_name?: string;
|
|
16
|
+
prerelease: boolean;
|
|
17
|
+
published_at: string;
|
|
18
|
+
tag_name: string;
|
|
19
|
+
total_downloads: number;
|
|
20
|
+
version: string;
|
|
21
|
+
}
|
|
22
|
+
export interface Options {
|
|
23
|
+
/** Enable debug logging. Default: `false`. */
|
|
24
|
+
debug?: boolean;
|
|
25
|
+
/** If Electron prereleases should be included. Default: `true`. */
|
|
26
|
+
electronPrereleases?: boolean;
|
|
27
|
+
/** Force downloading the latest release file. Default: `false`. */
|
|
28
|
+
forceUpdate?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Include only the latest release. Alias for `limit=1`. Ignores `limit`.
|
|
31
|
+
* Default: `false`.
|
|
32
|
+
*/
|
|
33
|
+
latest?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Limit output of releases. Everything below 1 will be treated as no limit.
|
|
36
|
+
* Default: 0.
|
|
37
|
+
*/
|
|
38
|
+
limit?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Can be a URL or a local path. Default:
|
|
41
|
+
* https://raw.githubusercontent.com/electron/releases/master/lite.json.
|
|
42
|
+
*/
|
|
43
|
+
releasesUrl?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Use a custom temporary directory. If not defined, the system's temporary
|
|
46
|
+
* directory will be used.
|
|
47
|
+
*/
|
|
48
|
+
tempDirectory?: string;
|
|
49
|
+
/** Use a custom HTTP timeout in milliseconds. Default is `2000`. */
|
|
50
|
+
timeout?: number;
|
|
51
|
+
}
|
|
52
|
+
export declare const SupportedDependencies: RawDeps;
|
|
53
|
+
export declare class ElectronInfo {
|
|
54
|
+
private readonly fileService;
|
|
55
|
+
private readonly logger;
|
|
56
|
+
private readonly options;
|
|
57
|
+
constructor(options?: Options);
|
|
58
|
+
getAllReleases(formatted: true, colored?: boolean): Promise<string>;
|
|
59
|
+
getAllReleases(formatted?: false): Promise<RawReleaseInfo[]>;
|
|
60
|
+
getDependencyReleases(dependency: keyof RawDeps, version: string, formatted?: false): Promise<RawReleaseInfo[]>;
|
|
61
|
+
getDependencyReleases(dependency: keyof RawDeps, version: string, formatted: true, colored?: boolean): Promise<RawReleaseInfo[] | string>;
|
|
62
|
+
getElectronReleases(version: string, formatted: true, colored?: boolean): Promise<string>;
|
|
63
|
+
getElectronReleases(version: string, formatted?: false): Promise<RawReleaseInfo[]>;
|
|
64
|
+
private buildFoundString;
|
|
65
|
+
private buildRawTables;
|
|
66
|
+
private formatDependencyReleases;
|
|
67
|
+
private formatReleases;
|
|
68
|
+
private getVersions;
|
|
69
|
+
private limitReleases;
|
|
70
|
+
}
|