mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-02-22 15:15:12 +08:00
Converted all references of global atom to NylasEnv Temporary rename atom.io find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.io/temporaryAtomIoReplacement/g' atom.config to NylasEnv.config find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.config/NylasEnv.config/g' atom.packages -> NylasEnv.packages atom.commands -> NylasEnv.commands atom.getLoadSettings find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.commands/NylasEnv.commands/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getLoadSettings/NylasEnv.getLoadSettings/g' More common atom methods find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.styles/NylasEnv.styles/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.emitError/NylasEnv.emitError/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.inSpecMode/NylasEnv.inSpecMode/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.inDevMode/NylasEnv.inDevMode/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getWindowType/NylasEnv.getWindowType/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.displayWindow/NylasEnv.displayWindow/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.quit/NylasEnv.quit/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.close/NylasEnv.close/g' More atom method changes find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.keymaps/NylasEnv.keymaps/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.hide/NylasEnv.hide/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getCurrentWindow/NylasEnv.getCurrentWindow/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.menu/NylasEnv.menu/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getConfigDirPath/NylasEnv.getConfigDirPath/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.isMainWindow/NylasEnv.isMainWindow/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.finishUnload/NylasEnv.finishUnload/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.isWorkWindow/NylasEnv.isWorkWindow/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.showSaveDialog/NylasEnv.showSaveDialog/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.append/NylasEnv.append/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.confirm/NylasEnv.confirm/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.clipboard/NylasEnv.clipboard/g' find -E . -regex ".*\.(coffee|cjsx|js|md|cmd|es6)" -print0 | xargs -0 sed -i "" 's/atom.getVersion/NylasEnv.getVersion/g' More atom renaming Rename atom methods More atom methods Fix grunt config variable Change atom.cmd to N1.cmd Rename atom.coffee and atom.js to nylas-env.coffee nylas-env.js Fix atom global reference in specs manually Fix atom requires Change engine from atom to nylas got rid of global/nylas-env rename to nylas-win-bootup Fix onWindowPropsChanged to onWindowPropsReceived fix nylas-workspace atom-text-editor to nylas-theme-wrap atom-text-editor -> nylas-theme-wrap Replacing atom keyword AtomWindow -> NylasWindow Replace Atom -> N1 Rename atom items nylas.asar -> atom.asar Remove more atom references Remove 6to5 references Remove license exception for atom
94 lines
3 KiB
JavaScript
94 lines
3 KiB
JavaScript
// This is to prevent React from displaying an annoying message about
|
|
// installing their dev tools. The React dev tools put a variable on the
|
|
// global scope. We need to do it here before React loads.
|
|
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = {}
|
|
|
|
|
|
function registerRuntimeTranspilers(hotreload) {
|
|
// This sets require.extensions['.coffee'].
|
|
require('coffee-script').register();
|
|
|
|
// This sets require.extensions['.cjsx']
|
|
if (hotreload) {
|
|
// This is custom built to look at window.devMode and enable hot-reloading
|
|
require('../src/cjsx').register();
|
|
} else {
|
|
require('coffee-react/register');
|
|
}
|
|
// This redefines require.extensions
|
|
babelOptions = require('./babelrc.json');
|
|
require('babel-core/register')(babelOptions);
|
|
}
|
|
|
|
window.onload = function() {
|
|
try {
|
|
var startTime = Date.now();
|
|
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
// Skip "?loadSettings=".
|
|
var rawLoadSettings = decodeURIComponent(location.search.substr(14));
|
|
var loadSettings;
|
|
try {
|
|
loadSettings = JSON.parse(rawLoadSettings);
|
|
} catch (error) {
|
|
console.error("Failed to parse load settings: " + rawLoadSettings);
|
|
throw error;
|
|
}
|
|
|
|
if (loadSettings.loadingMessage) {
|
|
document.getElementById("application-loading-text-supplement").innerHTML = loadSettings.loadingMessage
|
|
}
|
|
|
|
// Normalize to make sure drive letter case is consistent on Windows
|
|
process.resourcesPath = path.normalize(process.resourcesPath);
|
|
|
|
var registerBeforeModuleCache = loadSettings.devMode || !loadSettings.resourcePath.startsWith(process.resourcesPath + path.sep);
|
|
var hotreload = loadSettings.devMode && !loadSettings.isSpec;
|
|
|
|
// Require before the module cache in dev mode
|
|
if (registerBeforeModuleCache) {
|
|
registerRuntimeTranspilers(hotreload);
|
|
}
|
|
|
|
ModuleCache = require('../src/module-cache');
|
|
ModuleCache.register(loadSettings);
|
|
ModuleCache.add(loadSettings.resourcePath);
|
|
|
|
// Start the crash reporter before anything else.
|
|
require('crash-reporter').start({
|
|
productName: 'Nylas N1',
|
|
companyName: 'Nylas',
|
|
// By explicitly passing the app version here, we could save the call
|
|
// of "require('remote').require('app').getVersion()".
|
|
extra: {_version: loadSettings.appVersion}
|
|
});
|
|
|
|
require('vm-compatibility-layer');
|
|
|
|
if (!registerBeforeModuleCache) {
|
|
registerRuntimeTranspilers(hotreload);
|
|
}
|
|
|
|
require('../src/coffee-cache').register();
|
|
|
|
require(loadSettings.bootstrapScript);
|
|
|
|
if (global.NylasEnv) {
|
|
global.NylasEnv.loadTime = Date.now() - startTime;
|
|
console.log('Window load time: ' + global.NylasEnv.getWindowLoadTime() + 'ms');
|
|
} else {
|
|
require('ipc').sendChannel('window-command', 'window:loaded');
|
|
}
|
|
}
|
|
catch (error) {
|
|
var currentWindow = require('remote').getCurrentWindow();
|
|
currentWindow.setSize(800, 600);
|
|
currentWindow.center();
|
|
currentWindow.show();
|
|
currentWindow.openDevTools();
|
|
console.error(error.stack || error);
|
|
console.error(error.message, error);
|
|
}
|
|
}
|