fix(imports): switch to Electron's require('electron') (#1907)

* fix(imports): switch to Electron's require('electron')

Electron in 0.37.5 phases out the usage of `require('built-in-module')`
in favor of `require('electron').builtInModule`. This commit corrects usage in
some cases that cause N1 to not start under Electron 0.37.5.

* fix(specs): use new Electron remote import
This commit is contained in:
Matt Bilker 2016-04-12 21:09:13 -04:00 committed by Ben Gotow
parent cf3422de8d
commit 8e5f75d8e0
4 changed files with 14 additions and 7 deletions

View file

@ -1,8 +1,10 @@
import fs from 'fs';
import shell from 'shell';
import { remote } from 'electron';
import {Message, DraftStore} from 'nylas-exports';
import TemplateStore from '../lib/template-store';
const { shell } = remote;
const stubTemplatesDir = '~/.nylas/templates';
const stubTemplateFiles = {

View file

@ -2,9 +2,11 @@ import React from 'react';
import _ from 'underscore';
import path from 'path';
import fs from 'fs';
import shell from 'shell';
import { remote } from 'electron';
import {Flexbox} from 'nylas-component-kit';
import { Flexbox } from 'nylas-component-kit';
const { shell } = remote;
const displayedKeybindings = [
{

View file

@ -15,7 +15,7 @@ DatabaseChangeRecord = require './database-change-record'
DatabaseTransaction = require './database-transaction'
JSONBlob = null
{ipcRenderer} = require 'electron'
{remote, ipcRenderer} = require 'electron'
DatabaseVersion = 23
DatabasePhase =
@ -108,7 +108,7 @@ class DatabaseStore extends NylasStore
_onPhaseChange: (event) =>
return if NylasEnv.inSpecMode()
app = require('remote').getGlobal('application')
app = remote.getGlobal('application')
phase = app.databasePhase()
if phase is DatabasePhase.Setup and NylasEnv.isWorkWindow()
@ -135,7 +135,7 @@ class DatabaseStore extends NylasStore
# extremely frequently as new models are added when packages load.
refreshDatabaseSchema: ->
return unless NylasEnv.isWorkWindow()
app = require('remote').getGlobal('application')
app = remote.getGlobal('application')
phase = app.databasePhase()
if phase isnt DatabasePhase.Setup
app.setDatabasePhase(DatabasePhase.Setup)

View file

@ -9,6 +9,9 @@ window.eval = global.eval = function() {
var path = require('path');
var electron = require('electron');
var remote = electron.remote;
function setLoadTime (loadTime) {
if (global.NylasEnv) {
global.NylasEnv.loadTime = loadTime
@ -17,7 +20,7 @@ function setLoadTime (loadTime) {
}
function handleSetupError (error) {
var currentWindow = require('remote').getCurrentWindow()
var currentWindow = remote.getCurrentWindow()
currentWindow.setSize(800, 600)
currentWindow.center()
currentWindow.show()