Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

refactor: Use TypeScript 3.8 #211

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"tslint": "6.0.0",
"tslint-config-prettier": "1.18.0",
"tslint-plugin-prettier": "2.1.0",
"typescript": "3.7.5",
"typescript": "3.8.2",
"uuid": "3.4.0"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/FileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as os from 'os';
import parsePath = require('parse-path');
import * as path from 'path';

import {Options, RawReleaseInfo} from './ElectronInfo';
import type {Options, RawReleaseInfo} from './ElectronInfo';
import {HTTPService} from './HTTPService';

export class FileService {
Expand Down
2 changes: 1 addition & 1 deletion src/HTTPService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {promises as fs} from 'fs';
import * as logdown from 'logdown';
import {inspect} from 'util';

import {Options, RawReleaseInfo} from './ElectronInfo';
import type {Options, RawReleaseInfo} from './ElectronInfo';

export type HTTPOptions = Pick<Options, 'debug' | 'timeout'>;

Expand Down
21 changes: 11 additions & 10 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ import * as program from 'commander';
import * as fs from 'fs';
import * as path from 'path';

import {ElectronInfo, RawDeps, SupportedDependencies} from './ElectronInfo';
import {ElectronInfo, SupportedDependencies} from './ElectronInfo';
import type {RawDeps} from './ElectronInfo';

const defaultPackageJsonPath = path.join(__dirname, 'package.json');
const packageJsonPath = fs.existsSync(defaultPackageJsonPath)
? defaultPackageJsonPath
: path.join(__dirname, '../package.json');

const packageJson = fs.readFileSync(packageJsonPath, 'utf-8');
const {description, name, version}: {description: string; name: string; version: string} = JSON.parse(packageJson);
const {description, name, version} = JSON.parse(packageJson);

let matchedCommand = false;

program
.name(name)
.description(
`${description}
.description(`${description}

Allowed version argument inputs:
- SemVer versions (e.g. "~7")
Expand Down Expand Up @@ -50,17 +50,18 @@ program
}
try {
const electronInfo = new ElectronInfo({
...(parent.debug && {debug: true}),
...(parent.force && {forceUpdate: true}),
...(parent.limit && {limit: parseInt(parent.limit, 10)}),
...(typeof parent.prereleases !== undefined && {electronPrereleases: parent.prereleases}),
...(parent.source && {releasesUrl: parent.source}),
...(parent.timeout && {timeout: parseInt(parent.timeout, 10)}),
...(parent.debug ?? {debug: true}),
...(parent.force ?? {forceUpdate: true}),
...(parent.limit ?? {limit: parseInt(parent.limit, 10)}),
...(parent.prereleases ?? {electronPrereleases: parent.prereleases}),
...(parent.source ?? {releasesUrl: parent.source}),
...(parent.timeout ?? {timeout: parseInt(parent.timeout, 10)}),
});

const releases = parent.raw
? await electronInfo.getElectronReleases(version)
: await electronInfo.getElectronReleases(version, true, parent.colors);

console.log(releases);
} catch (error) {
console.error(error);
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5006,10 +5006,10 @@ typedarray@^0.0.6:
resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@3.7.5:
version "3.7.5"
resolved "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz#0692e21f65fd4108b9330238aac11dd2e177a1ae"
integrity sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==
typescript@3.8.2:
version "3.8.2"
resolved "https://registry.npmjs.org/typescript/-/typescript-3.8.2.tgz#91d6868aaead7da74f493c553aeff76c0c0b1d5a"
integrity sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==

uglify-js@^3.1.4:
version "3.7.2"
Expand Down