fix(build): CSON => JSON no longer necessary for /keymaps, /menus

This commit is contained in:
Ben Gotow 2016-04-24 20:27:29 -05:00
parent b98a3bae60
commit ba16a71777
12 changed files with 159 additions and 194 deletions

View file

@ -174,9 +174,6 @@ module.exports = (grunt) ->
glob_to_multiple:
expand: true
src: [
'menus/*.cson'
'keymaps/*.cson'
'keymaps/templates/*.cson'
'static/**/*.cson'
]
dest: appDir

View file

@ -171,6 +171,8 @@ module.exports = (grunt) ->
cp 'spec', path.join(appDir, 'spec')
cp 'src', path.join(appDir, 'src'), filter: /.+\.(cson|coffee|cjsx|jsx)$/
cp 'static', path.join(appDir, 'static')
cp 'keymaps', path.join(appDir, 'keymaps')
cp 'menus', path.join(appDir, 'menus')
# Move all of the node modules inside /apm/node_modules to new-app/apm/node_modules
apmInstallDir = path.resolve(appDir, '..', 'new-app', 'apm')

View file

@ -1,27 +0,0 @@
# Your keymap
#
# N1 keymaps work in conjunction with the {KeyCommandsRegion} React
# component.
#
# A key, or sequence of keys is first mapped to a "command".
#
# The "command" is then mapped to a callback function within your React
# component or store.
#
# The keyboard -> command mapping is defined in this `.cson` file. Each
# mapping is scoped under the component that it applies to by matching the
# root-level CSS class of that component.
#
# Any global, top-level mappings are scoped under the `body` selector.
#
# For example:
#
# 'body':
# 'ctrl+c': 'application:new-message'
#
# '.my-custom-package':
# 'ctrl+p': 'myPackage:customAction'
#
# This file uses CoffeeScript Object Notation (CSON).
# If you are unfamiliar with CSON, you can read more about it here:
# https://github.com/bevry/cson#what-is-cson

0
dot-nylas/keymap.json Normal file
View file

View file

@ -1,81 +0,0 @@
'menu': [
{
label: '&File'
submenu: [
{ label: '&New Message', command: 'application:new-message' }
{ type: 'separator' }
{ label: 'Add Account...', command: 'application:add-account' }
{ label: 'Clos&e Window', command: 'window:close' }
{ type: 'separator' }
{ label: 'Print Current Thread', command: 'core:print-thread' }
{ type: 'separator' }
{ label: 'Quit', command: 'application:quit' }
]
}
{
label: '&Edit'
submenu: [
{ label: '&Undo', command: 'core:undo' }
{ label: '&Redo', command: 'core:redo' }
{ type: 'separator' }
{ label: '&Cut', command: 'core:cut' }
{ label: 'C&opy', command: 'core:copy' }
{ label: '&Paste', command: 'core:paste' }
{ label: 'Paste and Match Style', command: 'core:paste-and-match-style' }
{ label: 'Select &All', command: 'core:select-all' }
{ type: 'separator' }
{ label: 'Find', submenu: [
{ label: 'Find in Thread...', command: 'core:find-in-thread' }
{ label: 'Find Next', command: 'core:find-in-thread-next' }
{ label: 'Find Previous', command: 'core:find-in-thread-previous' }
] }
{ type: 'separator' }
{ label: 'Preferences', command: 'application:open-preferences' }
{ label: 'Change Theme...', command: 'window:launch-theme-picker' }
{ label: 'Install Theme...', command: 'application:install-package' }
]
}
{
label: '&View'
submenu: [
{ label: 'Single Panel Mode', type: 'checkbox', command: 'application:select-list-mode' }
{ label: 'Two Panel Mode', type: 'checkbox', command: 'application:select-split-mode' }
{ type: 'separator' }
{ label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' }
]
}
{
label: 'Developer'
submenu: [
{ label: 'Run with &Debug Flags', type: 'checkbox', command: 'application:toggle-dev' }
{ type: 'separator' }
{ label: 'Reload', command: 'window:reload' }
{ label: 'Toggle Developer &Tools', command: 'window:toggle-dev-tools' }
{ label: 'Toggle Component Regions', command: 'window:toggle-component-regions' }
{ label: 'Toggle Screenshot Mode', command: 'window:toggle-screenshot-mode' }
{ type: 'separator' }
{ label: 'Open Activity Window', command: 'application:show-work-window' }
{ type: 'separator' }
{ label: 'Create a Plugin...', command: 'application:create-package' }
{ label: 'Install a Plugin...', command: 'application:install-package' }
{ type: 'separator' }
{ label: 'Run Plugin &Specs...', command: 'application:run-package-specs' }
{ label: 'Run &N1 Specs', command: 'application:run-all-specs' }
{ type: 'separator' }
{ label: 'Open Detailed Logs', command: 'window:open-errorlogger-logs' }
]
}
{
label: '&Help'
submenu: [
{ label: "VERSION", enabled: false }
{ type: 'separator' }
{ label: 'Nylas N1 Help', command: 'application:view-help' }
]
}
]
'context-menu':[
]

80
menus/linux.json Normal file
View file

@ -0,0 +1,80 @@
{
"menu": [
{
"label": "&File",
"submenu": [
{ "label": "&New Message", "command": "application:new-message" },
{ "type": "separator" },
{ "label": "Add Account...", "command": "application:add-account" },
{ "label": "Clos&e Window", "command": "window:close" },
{ "type": "separator" },
{ "label": "Print Current Thread", "command": "core:print-thread" },
{ "type": "separator" },
{ "label": "Quit", "command": "application:quit" }
]
},
{
"label": "&Edit",
"submenu": [
{ "label": "&Undo", "command": "core:undo" },
{ "label": "&Redo", "command": "core:redo" },
{ "type": "separator" },
{ "label": "&Cut", "command": "core:cut" },
{ "label": "C&opy", "command": "core:copy" },
{ "label": "&Paste", "command": "core:paste" },
{ "label": "Paste and Match Style", "command": "core:paste-and-match-style" },
{ "label": "Select &All", "command": "core:select-all" },
{ "type": "separator" },
{ "label": "Find", "submenu": [
{ "label": "Find in Thread...", "command": "core:find-in-thread" },
{ "label": "Find Next", "command": "core:find-in-thread-next" },
{ "label": "Find Previous", "command": "core:find-in-thread-previous" }
]},
{ "type": "separator" },
{ "label": "Preferences", "command": "application:open-preferences" },
{ "label": "Change Theme...", "command": "window:launch-theme-picker" },
{ "label": "Install Theme...", "command": "application:install-package" }
]
},
{
"label": "&View",
"submenu": [
{ "label": "Single Panel Mode", "type": "checkbox", "command": "application:select-list-mode" },
{ "label": "Two Panel Mode", "type": "checkbox", "command": "application:select-split-mode" },
{ "type": "separator" },
{ "label": "Toggle &Full Screen", "command": "window:toggle-full-screen" }
]
},
{
"label": "Developer",
"submenu": [
{ "label": "Run with &Debug Flags", "type": "checkbox", "command": "application:toggle-dev" },
{ "type": "separator" },
{ "label": "Reload", "command": "window:reload" },
{ "label": "Toggle Developer &Tools", "command": "window:toggle-dev-tools" },
{ "label": "Toggle Component Regions", "command": "window:toggle-component-regions" },
{ "label": "Toggle Screenshot Mode", "command": "window:toggle-screenshot-mode" },
{ "type": "separator" },
{ "label": "Open Activity Window", "command": "application:show-work-window" },
{ "type": "separator" },
{ "label": "Create a Plugin...", "command": "application:create-package" },
{ "label": "Install a Plugin...", "command": "application:install-package" },
{ "type": "separator" },
{ "label": "Run Plugin &Specs...", "command": "application:run-package-specs" },
{ "label": "Run &N1 Specs", "command": "application:run-all-specs" },
{ "type": "separator" },
{ "label": "Open Detailed Logs", "command": "window:open-errorlogger-logs" }
]
},
{
"label": "&Help",
"submenu": [
{ "label": "VERSION", "enabled": false },
{ "type": "separator" },
{ "label": "Nylas N1 Help", "command": "application:view-help" }
]
}
]
}

View file

@ -1,75 +0,0 @@
'menu': [
{ label: 'Add Account...', command: 'application:add-account' }
{
label: '&Edit'
submenu: [
{ label: '&Undo', command: 'core:undo' }
{ label: '&Redo', command: 'core:redo' }
{ type: 'separator' }
{ label: 'Cu&t', command: 'core:cut' }
{ label: '&Copy', command: 'core:copy' }
{ label: '&Paste', command: 'core:paste' }
{ label: 'Paste and Match Style', command: 'core:paste-and-match-style' }
{ label: 'Select &All', command: 'core:select-all' }
{ type: 'separator' }
{ label: 'Find', submenu: [
{ label: 'Find in Thread...', command: 'core:find-in-thread' }
{ label: 'Find Next', command: 'core:find-in-thread-next' }
{ label: 'Find Previous', command: 'core:find-in-thread-previous' }
] }
]
}
{
label: '&View'
submenu: [
{ label: 'Single Panel Mode', type: 'checkbox', command: 'application:select-list-mode' }
{ label: 'Two Panel Mode', type: 'checkbox', command: 'application:select-split-mode' }
{ type: 'separator' }
{ label: 'Toggle &Full Screen', command: 'window:toggle-full-screen' }
]
}
{
label: 'Developer'
submenu: [
{ label: 'Run with &Debug Flags', type: 'checkbox', command: 'application:toggle-dev' }
{ type: 'separator' }
{ label: '&Reload', command: 'window:reload' }
{ label: 'Toggle Developer &Tools', command: 'window:toggle-dev-tools' }
{ label: 'Toggle Component Regions', command: 'window:toggle-component-regions' }
{ label: 'Toggle Screenshot Mode', command: 'window:toggle-screenshot-mode' }
{ type: 'separator' }
{ label: 'Open Activity Window', command: 'application:show-work-window' }
{ type: 'separator' }
{ label: 'Create a Plugin...', command: 'application:create-package' }
{ label: 'Install a Plugin...', command: 'application:install-package' }
{ type: 'separator' }
{ label: 'Run Plugin &Specs...', command: 'application:run-package-specs' }
{ label: 'Run &N1 Specs', command: 'application:run-all-specs' }
{ type: 'separator' }
{ label: 'Open Detailed Logs', command: 'window:open-errorlogger-logs' }
]
}
{
label: '&Help'
submenu: [
{ label: 'VERSION', enabled: false }
{ label: 'Restart and Install Update', command: 'application:install-update', visible: false}
{ label: 'Check for Update', command: 'application:check-for-update', visible: false}
{ label: 'Downloading Update', enabled: false, visible: false}
{ type: 'separator' }
{ label: 'Nylas N1 Help', command: 'application:view-help' }
]
}
{ type: 'separator' }
{ label: 'Preferences', command: 'application:open-preferences' }
{ label: 'Change Theme...', command: 'window:launch-theme-picker' }
{ label: 'Install Theme...', command: 'application:install-package' }
{ type: 'separator' }
{ label: 'Print Current Thread', command: 'core:print-thread' }
{ type: 'separator' }
{ label: 'E&xit', command: 'application:quit' }
]
'context-menu':[
]

74
menus/win32.json Normal file
View file

@ -0,0 +1,74 @@
{
"menu": [
{ "label": "Add Account...", "command": "application:add-account" },
{
"label": "&Edit",
"submenu": [
{ "label": "&Undo", "command": "core:undo" },
{ "label": "&Redo", "command": "core:redo" },
{ "type": "separator" },
{ "label": "Cu&t", "command": "core:cut" },
{ "label": "&Copy", "command": "core:copy" },
{ "label": "&Paste", "command": "core:paste" },
{ "label": "Paste and Match Style", "command": "core:paste-and-match-style" },
{ "label": "Select &All", "command": "core:select-all" },
{ "type": "separator" },
{ "label": "Find", "submenu": [
{ "label": "Find in Thread...", "command": "core:find-in-thread" },
{ "label": "Find Next", "command": "core:find-in-thread-next" },
{ "label": "Find Previous", "command": "core:find-in-thread-previous" }
] }
]
},
{
"label": "&View",
"submenu": [
{ "label": "Single Panel Mode", "type": "checkbox", "command": "application:select-list-mode" },
{ "label": "Two Panel Mode", "type": "checkbox", "command": "application:select-split-mode" },
{ "type": "separator" },
{ "label": "Toggle &Full Screen", "command": "window:toggle-full-screen" }
]
},
{
"label": "Developer",
"submenu": [
{ "label": "Run with &Debug Flags", "type": "checkbox", "command": "application:toggle-dev" },
{ "type": "separator" },
{ "label": "&Reload", "command": "window:reload" },
{ "label": "Toggle Developer &Tools", "command": "window:toggle-dev-tools" },
{ "label": "Toggle Component Regions", "command": "window:toggle-component-regions" },
{ "label": "Toggle Screenshot Mode", "command": "window:toggle-screenshot-mode" },
{ "type": "separator" },
{ "label": "Open Activity Window", "command": "application:show-work-window" },
{ "type": "separator" },
{ "label": "Create a Plugin...", "command": "application:create-package" },
{ "label": "Install a Plugin...", "command": "application:install-package" },
{ "type": "separator" },
{ "label": "Run Plugin &Specs...", "command": "application:run-package-specs" },
{ "label": "Run &N1 Specs", "command": "application:run-all-specs" },
{ "type": "separator" },
{ "label": "Open Detailed Logs", "command": "window:open-errorlogger-logs" }
]
},
{
"label": "&Help",
"submenu": [
{ "label": "VERSION", "enabled": false },
{ "label": "Restart and Install Update", "command": "application:install-update", "visible": false},
{ "label": "Check for Update", "command": "application:check-for-update", "visible": false},
{ "label": "Downloading Update", "enabled": false, "visible": false},
{ "type": "separator" },
{ "label": "Nylas N1 Help", "command": "application:view-help" }
]
},
{ "type": "separator" },
{ "label": "Preferences", "command": "application:open-preferences" },
{ "label": "Change Theme...", "command": "window:launch-theme-picker" },
{ "label": "Install Theme...", "command": "application:install-package" },
{ "type": "separator" },
{ "label": "Print Current Thread", "command": "core:print-thread" },
{ "type": "separator" },
{ "label": "E&xit", "command": "application:quit" }
]
}

View file

@ -1,7 +1,6 @@
path = require 'path'
_ = require 'underscore'
CSON = require 'season'
fs = require 'fs-plus'
{ipcRenderer} = require 'electron'
{Disposable} = require 'event-kit'

View file

@ -20,7 +20,7 @@ catch error
packagesCache = {}
# Loads and activates a package's main module and resources such as
# stylesheets, keymaps, grammar, editor properties, and menus.
# stylesheets, keymaps, and menus.
module.exports =
class Package
EmitterMixin.includeInto(this)
@ -45,10 +45,6 @@ class Package
metadata ?= {}
metadata.name = packageName
if metadata.stylesheetMain?
deprecate("Use the `mainStyleSheet` key instead of `stylesheetMain` in the `package.json` of `#{packageName}`", {packageName})
metadata.mainStyleSheet = metadata.stylesheetMain
if metadata.stylesheets?
deprecate("Use the `styleSheets` key instead of `stylesheets` in the `package.json` of `#{packageName}`", {packageName})
metadata.styleSheets = metadata.stylesheets
@ -250,9 +246,9 @@ class Package
getKeymapPaths: ->
keymapsDirPath = path.join(@path, 'keymaps')
if @metadata.keymaps
@metadata.keymaps.map (name) -> fs.resolve(keymapsDirPath, name, ['json', 'cson', ''])
@metadata.keymaps.map (name) -> fs.resolve(keymapsDirPath, name, ['json', ''])
else
fs.listSync(keymapsDirPath, ['cson', 'json'])
fs.listSync(keymapsDirPath, ['json'])
getMenuPaths: ->
menusDirPath = path.join(@path, 'menus')