mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-12-25 01:21:14 +08:00
refactor(code): replace all instances of atom-shell and AtomShell and atomShell
Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D1537
This commit is contained in:
parent
80adb41d2e
commit
0588b0c7eb
15 changed files with 46 additions and 46 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,7 +9,7 @@ node_modules
|
|||
npm-debug.log
|
||||
debug.log
|
||||
/tags
|
||||
/atom-shell/
|
||||
/electron/
|
||||
docs/output
|
||||
docs/includes
|
||||
spec/fixtures/evil-files/
|
||||
|
|
8
atom.sh
8
atom.sh
|
@ -53,7 +53,7 @@ if [ $OS == 'Mac' ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
ELECTRON_PATH=${ELECTRON_PATH:-$EDGEHILL_PATH/atom-shell} # Set ELECTRON_PATH unless it is already set
|
||||
ELECTRON_PATH=${ELECTRON_PATH:-$EDGEHILL_PATH/electron} # Set ELECTRON_PATH unless it is already set
|
||||
|
||||
# Exit if Atom can't be found
|
||||
if [ -z "$ELECTRON_PATH" ]; then
|
||||
|
@ -61,7 +61,7 @@ if [ $OS == 'Mac' ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# We find the atom-shell executable inside of the atom-shell directory.
|
||||
# We find the electron executable inside of the electron directory.
|
||||
$ELECTRON_PATH/Electron.app/Contents/MacOS/Electron --executed-from="$(pwd)" --pid=$$ "$@" $EDGEHILL_PATH
|
||||
|
||||
elif [ $OS == 'Linux' ]; then
|
||||
|
@ -78,11 +78,11 @@ elif [ $OS == 'Linux' ]; then
|
|||
|
||||
# Exit if Atom can't be found
|
||||
if [ -z "$ELECTRON_PATH" ]; then
|
||||
echo "Cannot locate atom-shell. Be sure you have run script/grunt download-atom-shell first from $EDGEHILL_PATH"
|
||||
echo "Cannot locate electron. Be sure you have run script/grunt download-electron first from $EDGEHILL_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We find the electron executable inside of the atom-shell directory.
|
||||
# We find the electron executable inside of the electron directory.
|
||||
$ELECTRON_PATH/electron --executed-from="$(pwd)" --pid=$$ "$@" $EDGEHILL_PATH
|
||||
|
||||
fi
|
||||
|
|
|
@ -59,8 +59,8 @@ module.exports = (grunt) ->
|
|||
grunt.loadNpmTasks('grunt-contrib-less')
|
||||
grunt.loadNpmTasks('grunt-shell')
|
||||
grunt.loadNpmTasks('grunt-markdown')
|
||||
grunt.loadNpmTasks('grunt-download-atom-shell')
|
||||
grunt.loadNpmTasks('grunt-atom-shell-installer')
|
||||
grunt.loadNpmTasks('grunt-download-electron')
|
||||
grunt.loadNpmTasks('grunt-electron-installer')
|
||||
grunt.loadNpmTasks('grunt-peg')
|
||||
grunt.loadTasks('tasks')
|
||||
|
||||
|
@ -81,7 +81,7 @@ module.exports = (grunt) ->
|
|||
installDir = grunt.option('install-dir')
|
||||
|
||||
home = if process.platform is 'win32' then process.env.USERPROFILE else process.env.HOME
|
||||
atomShellDownloadDir = path.join(home, '.nylas', 'atom-shell')
|
||||
electronDownloadDir = path.join(home, '.nylas', 'electron')
|
||||
|
||||
symbolsDir = path.join(buildDir, 'Atom.breakpad.syms')
|
||||
shellAppDir = path.join(buildDir, appName)
|
||||
|
@ -274,11 +274,11 @@ module.exports = (grunt) ->
|
|||
_.extend(context, parsed.attributes)
|
||||
parsed.body
|
||||
|
||||
'download-atom-shell':
|
||||
version: packageJson.atomShellVersion
|
||||
outputDir: 'atom-shell'
|
||||
downloadDir: atomShellDownloadDir
|
||||
rebuild: true # rebuild native modules after atom-shell is updated
|
||||
'download-electron':
|
||||
version: packageJson.electronVersion
|
||||
outputDir: 'electron'
|
||||
downloadDir: electronDownloadDir
|
||||
rebuild: true # rebuild native modules after electron is updated
|
||||
token: process.env.ATOM_ACCESS_TOKEN
|
||||
|
||||
'create-windows-installer':
|
||||
|
@ -302,7 +302,7 @@ module.exports = (grunt) ->
|
|||
grunt.registerTask('test', ['shell:kill-atom', 'run-edgehill-specs'])
|
||||
grunt.registerTask('docs', ['build-docs', 'render-docs'])
|
||||
|
||||
ciTasks = ['output-disk-space', 'download-atom-shell', 'build']
|
||||
ciTasks = ['output-disk-space', 'download-electron', 'build']
|
||||
ciTasks.push('dump-symbols') if process.platform isnt 'win32'
|
||||
ciTasks.push('set-version', 'lint')
|
||||
ciTasks.push('mkdeb') if process.platform is 'linux'
|
||||
|
@ -313,7 +313,7 @@ module.exports = (grunt) ->
|
|||
ciTasks.push('publish-edgehill-build') if process.platform is 'darwin'
|
||||
grunt.registerTask('ci', ciTasks)
|
||||
|
||||
defaultTasks = ['download-atom-shell', 'build', 'set-version']
|
||||
defaultTasks = ['download-electron', 'build', 'set-version']
|
||||
# We don't run `install` on linux because you need to run `sudo`.
|
||||
# See docs/build-instructions/linux.md
|
||||
# `sudo script/grunt install`
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"fs-plus": "2.x",
|
||||
"github-releases": "~0.2.0",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-atom-shell-installer": "^0.29.0",
|
||||
"grunt-electron-installer": "^0.31",
|
||||
"grunt-cli": "~0.1.9",
|
||||
"grunt-coffeelint": "git+https://github.com/atom/grunt-coffeelint.git#cfb99aa99811d52687969532bd5a98011ed95bfe",
|
||||
"grunt-coffeelint-cjsx": "^0.1",
|
||||
|
@ -23,7 +23,7 @@
|
|||
"grunt-contrib-csslint": "~0.1.2",
|
||||
"grunt-contrib-less": "~0.8.0",
|
||||
"grunt-cson": "0.14.0",
|
||||
"grunt-download-atom-shell": "~0.14.0",
|
||||
"grunt-download-electron": "~2.1",
|
||||
"grunt-lesslint": "0.13.0",
|
||||
"grunt-markdown": "^0.7.0",
|
||||
"grunt-peg": "~1.1.0",
|
||||
|
|
|
@ -21,12 +21,12 @@ module.exports = (grunt) ->
|
|||
mkdir path.dirname(buildDir)
|
||||
|
||||
if process.platform is 'darwin'
|
||||
cp 'atom-shell/Electron.app', shellAppDir, filter: /default_app/
|
||||
cp 'electron/Electron.app', shellAppDir, filter: /default_app/
|
||||
cp(path.join(shellAppDir, 'Contents', 'MacOS', 'Electron'),
|
||||
path.join(shellAppDir, 'Contents', 'MacOS', 'Nylas'))
|
||||
rm path.join(shellAppDir, 'Contents', 'MacOS', 'Electron')
|
||||
else
|
||||
cp 'atom-shell', shellAppDir, filter: /default_app/
|
||||
cp 'electron', shellAppDir, filter: /default_app/
|
||||
cp path.join(shellAppDir, 'atom'), path.join(shellAppDir, 'nylas')
|
||||
rm path.join(shellAppDir, 'atom')
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ module.exports = (grunt) ->
|
|||
rm grunt.config.get('atom.buildDir')
|
||||
rm require('../src/coffee-cache').cacheDir
|
||||
rm require('../src/less-compile-cache').cacheDir
|
||||
rm path.join(tmpdir, 'atom-cached-atom-shells')
|
||||
rm 'atom-shell'
|
||||
rm path.join(tmpdir, 'atom-cached-electrons')
|
||||
rm 'electron'
|
||||
|
||||
grunt.registerTask 'clean', 'Delete all the build files', ->
|
||||
homeDir = process.env[if process.platform is 'win32' then 'USERPROFILE' else 'HOME']
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"bugs": {
|
||||
"url": "https://github.com/nylas/edgehill/issues"
|
||||
},
|
||||
"atomShellVersion": "0.26.0",
|
||||
"electronVersion": "0.26.0",
|
||||
"dependencies": {
|
||||
"asar": "^0.5.0",
|
||||
"6to5-core": "^3.5",
|
||||
|
|
|
@ -71,33 +71,33 @@ function bootstrap() {
|
|||
if (process.env.JANKY_SHA1 && process.platform === 'win32')
|
||||
apmInstallCommand += ' --arch=ia32';
|
||||
|
||||
m1 = "---> Installing Nylas Mail build tools\n"
|
||||
m1 = "\n---> Installing Nylas Mail build tools\n"
|
||||
m1 += " This goes inside the `build` folder and runs `npm install`\n"
|
||||
m1 += " It will use the system `npm` to bootstrap our own Nylas Mail npm.\n"
|
||||
m1 += " Our build tools (like Grunt) need to be compiled against Node via `npm`.\n"
|
||||
m1 += " Everything else needs to be compiled against Chromium with `apm`.\n\n"
|
||||
m1 += " $ "+buildInstallCommand+" "+printArgs(buildInstallOptions)+"\n"
|
||||
|
||||
m2 = "---> Installing apm\n"
|
||||
m2 += " This installs apm via Nylas Mails `npm`\n"
|
||||
m2 = "\n\n---> Installing apm\n"
|
||||
m2 += " This installs apm via Nylas Mail's `npm`\n"
|
||||
m2 += " We use this local apm copy to install all Nylas Mail dependencies & packages\n\n"
|
||||
m2 += " $ "+apmInstallCommand+" "+printArgs(apmInstallOptions)+"\n"
|
||||
|
||||
m3 = "---> Cleaning apm via `apm clean`\n"
|
||||
m3 = "\n\n---> Cleaning apm via `apm clean`\n"
|
||||
|
||||
m4 = "---> Installing Nylas Mail dependencies & packages via `apm install`\n\n"
|
||||
m4 = "\n\n---> Installing Nylas Mail dependencies & packages via `apm install`\n\n"
|
||||
m4 += " $ "+moduleInstallCommand+"\n"
|
||||
|
||||
m5 = "---> De-duping packages `apm clean`\n\n"
|
||||
m5 = "\n\n---> De-duping packages `apm clean`\n\n"
|
||||
m5 += " $ apm "+packagesToDedupe.join(' ')+"\n"
|
||||
|
||||
m6 = "---> Request version `apm clean`\n\n"
|
||||
m6 = "\n\n---> Request version `apm clean`\n\n"
|
||||
m6 += " $ apm request semver "+printArgs(semverOptions)+"\n"
|
||||
|
||||
m7 = "---> Getting latest Atom Shell\n\n"
|
||||
m7 = "\n\n---> Getting latest Electron\n\n"
|
||||
var gruntCmd = ""
|
||||
var downloadAtomShellCmd = gruntPath + " download-atom-shell --gruntfile build/Gruntfile.coffee"
|
||||
m7 += " $ "+downloadAtomShellCmd
|
||||
var downloadElectronCmd = gruntPath + " download-electron --gruntfile build/Gruntfile.coffee"
|
||||
m7 += " $ "+downloadElectronCmd
|
||||
|
||||
var commands = [
|
||||
{
|
||||
|
@ -128,7 +128,7 @@ function bootstrap() {
|
|||
options: semverOptions
|
||||
},
|
||||
{
|
||||
command: downloadAtomShellCmd,
|
||||
command: downloadElectronCmd,
|
||||
message: m7
|
||||
}
|
||||
];
|
||||
|
|
|
@ -19,14 +19,14 @@ var commands = [
|
|||
[__dirname, '..', 'node_modules'],
|
||||
[__dirname, '..', 'build', 'node_modules'],
|
||||
[__dirname, '..', 'apm', 'node_modules'],
|
||||
[__dirname, '..', 'atom-shell'],
|
||||
[__dirname, '..', 'electron'],
|
||||
[home, '.nylas', '.node-gyp'],
|
||||
[home, '.nylas', 'storage'],
|
||||
[home, '.nylas', '.npm'],
|
||||
[home, '.nylas', 'compile-cache'],
|
||||
[home, '.nylas', 'atom-shell'],
|
||||
[home, '.nylas', 'electron'],
|
||||
[tmpdir, 'atom-build'],
|
||||
[tmpdir, 'atom-cached-atom-shells'],
|
||||
[tmpdir, 'atom-cached-electrons'],
|
||||
];
|
||||
var run = function() {
|
||||
var next = commands.shift();
|
||||
|
|
|
@ -524,7 +524,7 @@ class Atom extends Model
|
|||
@center()
|
||||
|
||||
# Returns true if the dimensions are useable, false if they should be ignored.
|
||||
# Work around for https://github.com/atom/atom-shell/issues/473
|
||||
# Work around for https://github.com/atom/electron/issues/473
|
||||
isValidDimensions: ({x, y, width, height}={}) ->
|
||||
width > 0 and height > 0 and x + width > 0 and y + height > 0
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class ApplicationMenu
|
|||
|
||||
# Flattens the given menu and submenu items into an single Array.
|
||||
#
|
||||
# menu - A complete menu configuration object for atom-shell's menu API.
|
||||
# menu - A complete menu configuration object for electron's menu API.
|
||||
#
|
||||
# Returns an Array of native menu items.
|
||||
flattenMenuItems: (menu) ->
|
||||
|
@ -130,12 +130,12 @@ class ApplicationMenu
|
|||
|
||||
# Combines a menu template with the appropriate keystroke.
|
||||
#
|
||||
# template - An Object conforming to atom-shell's menu api but lacking
|
||||
# template - An Object conforming to electron's menu api but lacking
|
||||
# accelerator and click properties.
|
||||
# keystrokesByCommand - An Object where the keys are commands and the values
|
||||
# are Arrays containing the keystroke.
|
||||
#
|
||||
# Returns a complete menu configuration object for atom-shell's menu API.
|
||||
# Returns a complete menu configuration object for electron's menu API.
|
||||
translateTemplate: (template, keystrokesByCommand) ->
|
||||
template.forEach (item) =>
|
||||
item.metadata ?= {}
|
||||
|
|
|
@ -43,7 +43,7 @@ class Application
|
|||
|
||||
# FIXME: Sometimes when socketPath doesn't exist, net.connect would strangely
|
||||
# take a few seconds to trigger 'error' event, it could be a bug of node
|
||||
# or atom-shell, before it's fixed we check the existence of socketPath to
|
||||
# or electron, before it's fixed we check the existence of socketPath to
|
||||
# speedup startup.
|
||||
if (process.platform isnt 'win32' and not fs.existsSync socketPath) or options.test
|
||||
createApplication()
|
||||
|
|
|
@ -177,7 +177,7 @@ class AtomWindow
|
|||
@setupContextMenu()
|
||||
|
||||
if @isSpec
|
||||
# Workaround for https://github.com/atom/atom-shell/issues/380
|
||||
# Workaround for https://github.com/atom/electron/issues/380
|
||||
# Don't focus the window when it is being blurred during close or
|
||||
# else the app will crash on Windows.
|
||||
if process.platform is 'win32'
|
||||
|
|
|
@ -160,7 +160,7 @@ class WindowManager
|
|||
#
|
||||
# Other non required options:
|
||||
# - All of the options of BrowserWindow
|
||||
# https://github.com/atom/atom-shell/blob/master/docs/api/browser-window.md#new-browserwindowoptions
|
||||
# https://github.com/atom/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions
|
||||
#
|
||||
# Returns a new AtomWindow
|
||||
#
|
||||
|
|
|
@ -200,14 +200,14 @@ registerBuiltins = (devMode) ->
|
|||
cache.builtins.atom = atomCoffeePath if fs.isFileSync(atomCoffeePath)
|
||||
cache.builtins.atom ?= path.join(cache.resourcePath, 'exports', 'atom.js')
|
||||
|
||||
atomShellRoot = path.join(process.resourcesPath, 'atom.asar')
|
||||
electronRoot = path.join(process.resourcesPath, 'atom.asar')
|
||||
|
||||
commonRoot = path.join(atomShellRoot, 'common', 'api', 'lib')
|
||||
commonRoot = path.join(electronRoot, 'common', 'api', 'lib')
|
||||
commonBuiltins = ['callbacks-registry', 'clipboard', 'crash-reporter', 'screen', 'shell']
|
||||
for builtin in commonBuiltins
|
||||
cache.builtins[builtin] = path.join(commonRoot, "#{builtin}.js")
|
||||
|
||||
rendererRoot = path.join(atomShellRoot, 'renderer', 'api', 'lib')
|
||||
rendererRoot = path.join(electronRoot, 'renderer', 'api', 'lib')
|
||||
rendererBuiltins = ['ipc', 'remote']
|
||||
for builtin in rendererBuiltins
|
||||
cache.builtins[builtin] = path.join(rendererRoot, "#{builtin}.js")
|
||||
|
|
Loading…
Reference in a new issue