mirror of https://github.com/jiahaog/Nativefier
This commit is contained in:
parent
2ca1b67265
commit
eb08d85830
|
@ -7,7 +7,5 @@ plugins:
|
|||
rules:
|
||||
# TODO: Remove this when we have shifted away from the async package
|
||||
no-shadow: 'warn'
|
||||
# Remove no-console when we have moved to a proper logging lib with logging levels
|
||||
no-console: 'off'
|
||||
# Gulpfiles and tests use dev dependencies
|
||||
import/no-extraneous-dependencies: ['error', { devDependencies: ['gulpfile.babel.js', 'gulp/**/**.js', 'test/**/**.js']}]
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"dependencies": {
|
||||
"electron-dl": "^1.10.0",
|
||||
"electron-window-state": "^4.1.1",
|
||||
"loglevel": "^1.5.1",
|
||||
"source-map-support": "^0.5.0",
|
||||
"wurl": "^2.5.2"
|
||||
},
|
||||
|
|
|
@ -4,6 +4,7 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
|
||||
const INJECT_CSS_PATH = path.join(__dirname, '..', 'inject/inject.css');
|
||||
const log = require('loglevel');
|
||||
|
||||
function isOSX() {
|
||||
return os.platform() === 'darwin';
|
||||
|
@ -51,8 +52,7 @@ function debugLog(browserWindow, message) {
|
|||
setTimeout(() => {
|
||||
browserWindow.webContents.send('debug', message);
|
||||
}, 3000);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(message);
|
||||
log.info(message);
|
||||
}
|
||||
|
||||
function getAppIcon() {
|
||||
|
|
|
@ -3,7 +3,7 @@ import path from 'path';
|
|||
import helpers from './helpers';
|
||||
|
||||
const { isOSX, isWindows, isLinux } = helpers;
|
||||
|
||||
const log = require('loglevel');
|
||||
/**
|
||||
* Synchronously find a file or directory
|
||||
* @param {RegExp} pattern regex
|
||||
|
@ -76,7 +76,7 @@ function inferFlash() {
|
|||
return linuxMatch();
|
||||
}
|
||||
|
||||
console.warn('Unable to determine OS to infer flash player');
|
||||
log.warn('Unable to determine OS to infer flash player');
|
||||
return null;
|
||||
}
|
||||
export default inferFlash;
|
||||
|
|
|
@ -6,7 +6,7 @@ import path from 'path';
|
|||
import fs from 'fs';
|
||||
|
||||
const INJECT_JS_PATH = path.join(__dirname, '../../', 'inject/inject.js');
|
||||
|
||||
const log = require('loglevel');
|
||||
/**
|
||||
* Patches window.Notification to set a callback on a new Notification
|
||||
* @param callback
|
||||
|
@ -71,15 +71,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
ipcRenderer.on('params', (event, message) => {
|
||||
const appArgs = JSON.parse(message);
|
||||
console.log('nativefier.json', appArgs);
|
||||
log.info('nativefier.json', appArgs);
|
||||
});
|
||||
|
||||
ipcRenderer.on('debug', (event, message) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('debug:', message);
|
||||
log.info('debug:', message);
|
||||
});
|
||||
|
||||
ipcRenderer.on('change-zoom', (event, message) => {
|
||||
webFrame.setZoomFactor(message);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import gulp from 'gulp';
|
||||
import PATHS from './helpers/src-paths';
|
||||
|
||||
const log = require('loglevel');
|
||||
|
||||
gulp.task('watch', ['build'], () => {
|
||||
const handleError = function watch(error) {
|
||||
console.error(error);
|
||||
log.error(error);
|
||||
};
|
||||
gulp.watch(PATHS.APP_ALL, ['build-app'])
|
||||
.on('error', handleError);
|
||||
|
|
|
@ -5,7 +5,7 @@ import path from 'path';
|
|||
import ncp from 'ncp';
|
||||
|
||||
const copy = ncp.ncp;
|
||||
|
||||
const log = require('loglevel');
|
||||
/**
|
||||
* Only picks certain app args to pass to nativefier.json
|
||||
* @param options
|
||||
|
@ -131,7 +131,7 @@ function buildApp(src, dest, options, callback) {
|
|||
|
||||
maybeCopyScripts(options.inject, dest)
|
||||
.catch((err) => {
|
||||
console.warn(err);
|
||||
log.warn(err);
|
||||
})
|
||||
.then(() => {
|
||||
changeAppPackageJsonName(dest, appArgs.name, appArgs.targetUrl);
|
||||
|
|
|
@ -6,6 +6,7 @@ import nativefier from './index';
|
|||
|
||||
const dns = require('dns');
|
||||
const packageJson = require('./../package');
|
||||
const log = require('loglevel');
|
||||
|
||||
function collect(val, memo) {
|
||||
memo.push(val);
|
||||
|
@ -27,7 +28,7 @@ function getProcessEnvs(val) {
|
|||
function checkInternet() {
|
||||
dns.lookup('npmjs.com', (err) => {
|
||||
if (err && err.code === 'ENOTFOUND') {
|
||||
console.log('\nNo Internet Connection\nTo offline build, download electron from https://github.com/electron/electron/releases\nand place in ~/AppData/Local/electron/Cache/ on Windows,\n~/.cache/electron on Linux or ~/Library/Caches/electron/ on Mac\nUse --electron-version to specify the version you downloaded.');
|
||||
log.warn('\nNo Internet Connection\nTo offline build, download electron from https://github.com/electron/electron/releases\nand place in ~/AppData/Local/electron/Cache/ on Windows,\n~/.cache/electron on Linux or ~/Library/Caches/electron/ on Mac\nUse --electron-version to specify the version you downloaded.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -93,7 +94,7 @@ if (require.main === module) {
|
|||
checkInternet();
|
||||
nativefier(program, (error, appPath) => {
|
||||
if (error) {
|
||||
console.error(error);
|
||||
log.error(error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -101,6 +102,6 @@ if (require.main === module) {
|
|||
// app exists and --overwrite is not passed
|
||||
return;
|
||||
}
|
||||
console.log(`App built to ${appPath}`);
|
||||
log.info(`App built to ${appPath}`);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
// TODO: remove this file and use quiet mode of new version of electron packager
|
||||
const log = require('loglevel');
|
||||
|
||||
class PackagerConsole {
|
||||
constructor() {
|
||||
this.logs = [];
|
||||
|
@ -9,19 +11,19 @@ class PackagerConsole {
|
|||
}
|
||||
|
||||
override() {
|
||||
this.consoleError = console.error;
|
||||
this.consoleError = log.error;
|
||||
|
||||
// need to bind because somehow when _log() is called this refers to console
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
console.error = this._log.bind(this);
|
||||
log.error = this._log.bind(this);
|
||||
}
|
||||
|
||||
restore() {
|
||||
console.error = this.consoleError;
|
||||
log.error = this.consoleError;
|
||||
}
|
||||
|
||||
playback() {
|
||||
console.log(this.logs.join(' '));
|
||||
log.log(this.logs.join(' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
console.log('This is a test injecton script');
|
||||
const log = require('loglevel');
|
||||
|
||||
log.info('This is a test injecton script');
|
||||
|
|
|
@ -8,7 +8,7 @@ import path from 'path';
|
|||
import convertToIcns from './../../lib/helpers/convertToIcns';
|
||||
|
||||
const { assert } = chai;
|
||||
|
||||
const log = require('loglevel');
|
||||
// Prerequisite for test: to use OSX with sips, iconutil and imagemagick convert
|
||||
|
||||
function testConvertPng(pngName, done) {
|
||||
|
@ -27,7 +27,7 @@ function testConvertPng(pngName, done) {
|
|||
describe('Get Icon Module', () => {
|
||||
it('Can convert icons', () => {
|
||||
if (os.platform() !== 'darwin') {
|
||||
console.warn('Skipping png conversion tests, OSX is required');
|
||||
log.warn('Skipping png conversion tests, OSX is required');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue