mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-02 11:48:25 +00:00
Refactor options to seperate folders
This commit is contained in:
parent
4663b99050
commit
6ddf84bee1
@ -5,7 +5,7 @@ import ncp from 'ncp';
|
||||
import async from 'async';
|
||||
import hasBinary from 'hasbin';
|
||||
|
||||
import optionsFactory from './../options';
|
||||
import optionsFactory from './../options/optionsMain';
|
||||
import iconBuild from './iconBuild';
|
||||
import helpers from './../helpers/helpers';
|
||||
import buildApp from './buildApp';
|
||||
|
17
src/options/normalizeUrl.js
Normal file
17
src/options/normalizeUrl.js
Normal file
@ -0,0 +1,17 @@
|
||||
import url from 'url';
|
||||
import validator from 'validator';
|
||||
|
||||
function normalizeUrl(testUrl) {
|
||||
// add protocol if protocol not found
|
||||
let normalized = testUrl;
|
||||
const parsed = url.parse(normalized);
|
||||
if (!parsed.protocol) {
|
||||
normalized = 'http://' + normalized;
|
||||
}
|
||||
if (!validator.isURL(normalized, {require_protocol: true, require_tld: false})) {
|
||||
throw `Your Url: "${normalized}" is invalid!`;
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
export default normalizeUrl;
|
@ -1,19 +1,18 @@
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import url from 'url';
|
||||
import validator from 'validator';
|
||||
import _ from 'lodash';
|
||||
import async from 'async';
|
||||
import sanitizeFilename from 'sanitize-filename';
|
||||
|
||||
import inferIcon from './infer/inferIcon';
|
||||
import inferTitle from './infer/inferTitle';
|
||||
import inferOs from './infer/inferOs';
|
||||
import packageJson from './../package.json';
|
||||
import inferIcon from './../infer/inferIcon';
|
||||
import inferTitle from './../infer/inferTitle';
|
||||
import inferOs from './../infer/inferOs';
|
||||
import normalizeUrl from './normalizeUrl';
|
||||
import packageJson from './../../package.json';
|
||||
|
||||
const {inferPlatform, inferArch} = inferOs;
|
||||
|
||||
const PLACEHOLDER_APP_DIR = path.join(__dirname, '../', 'app');
|
||||
const PLACEHOLDER_APP_DIR = path.join(__dirname, '../../', 'app');
|
||||
const ELECTRON_VERSION = '0.36.4';
|
||||
const DEFAULT_APP_NAME = 'APP';
|
||||
|
||||
@ -100,19 +99,6 @@ function sanitizeOptions(options) {
|
||||
return options;
|
||||
}
|
||||
|
||||
function normalizeUrl(testUrl) {
|
||||
// add protocol if protocol not found
|
||||
let normalized = testUrl;
|
||||
const parsed = url.parse(normalized);
|
||||
if (!parsed.protocol) {
|
||||
normalized = 'http://' + normalized;
|
||||
}
|
||||
if (!validator.isURL(normalized, {require_protocol: true, require_tld: false})) {
|
||||
throw `Your Url: "${normalized}" is invalid!`;
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
function getFakeUserAgent() {
|
||||
let userAgent;
|
||||
switch (os.platform()) {
|
Loading…
x
Reference in New Issue
Block a user