mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-12-22 18:18:55 +00:00
Get rid of lodash
This commit is contained in:
parent
0eaf72ced8
commit
17f688de63
@ -54,7 +54,6 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/cheerio": "0.x",
|
||||
"@types/lodash": "4.x",
|
||||
"@types/ncp": "2.x",
|
||||
"@types/node": "10.x",
|
||||
"@types/page-icon": "0.x",
|
||||
@ -66,7 +65,6 @@
|
||||
"electron-packager": "15.x",
|
||||
"gitcloud": "0.x",
|
||||
"hasbin": "1.x",
|
||||
"lodash": "4.x",
|
||||
"loglevel": "1.x",
|
||||
"ncp": "2.x",
|
||||
"page-icon": "0.x",
|
||||
|
@ -3,7 +3,6 @@ import * as crypto from 'crypto';
|
||||
import * as path from 'path';
|
||||
import { promisify } from 'util';
|
||||
|
||||
import { kebabCase } from 'lodash';
|
||||
import * as log from 'loglevel';
|
||||
|
||||
import { copyFileOrDir } from '../helpers/helpers';
|
||||
@ -106,7 +105,7 @@ function normalizeAppName(appName: string, url: string): string {
|
||||
const hash = crypto.createHash('md5');
|
||||
hash.update(url);
|
||||
const postFixHash = hash.digest('hex').substring(0, 6);
|
||||
const normalized = kebabCase(appName.toLowerCase());
|
||||
const normalized = appName.toLowerCase().replace(/[\s_]/g, '-');
|
||||
return `${normalized}-nativefier-${postFixHash}`;
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,22 @@
|
||||
import * as _ from 'lodash';
|
||||
import axios from 'axios';
|
||||
import * as log from 'loglevel';
|
||||
import { DEFAULT_CHROME_VERSION } from '../constants';
|
||||
|
||||
const ELECTRON_VERSIONS_URL = 'https://atom.io/download/atom-shell/index.json';
|
||||
|
||||
type ElectronRelease = {
|
||||
version: string;
|
||||
date: string;
|
||||
node: string;
|
||||
v8: string;
|
||||
uv: string;
|
||||
zlib: string;
|
||||
openssl: string;
|
||||
modules: string;
|
||||
chrome: string;
|
||||
files: string[];
|
||||
};
|
||||
|
||||
async function getChromeVersionForElectronVersion(
|
||||
electronVersion: string,
|
||||
url = ELECTRON_VERSIONS_URL,
|
||||
@ -14,11 +26,11 @@ async function getChromeVersionForElectronVersion(
|
||||
if (response.status !== 200) {
|
||||
throw new Error(`Bad request: Status code ${response.status}`);
|
||||
}
|
||||
const { data } = response;
|
||||
const electronVersionToChromeVersion: _.Dictionary<string> = _.zipObject(
|
||||
data.map((d) => d.version),
|
||||
data.map((d) => d.chrome),
|
||||
);
|
||||
const electronReleases: ElectronRelease[] = response.data;
|
||||
const electronVersionToChromeVersion: { [key: string]: string } = {};
|
||||
for (const release of electronReleases) {
|
||||
electronVersionToChromeVersion[release.version] = release.chrome;
|
||||
}
|
||||
if (!(electronVersion in electronVersionToChromeVersion)) {
|
||||
throw new Error(
|
||||
`Electron version '${electronVersion}' not found in retrieved version list!`,
|
||||
|
Loading…
Reference in New Issue
Block a user