From ba16a717774a69ca7327748b283b3fb1815bf410 Mon Sep 17 00:00:00 2001 From: Ben Gotow Date: Sun, 24 Apr 2016 20:27:29 -0500 Subject: [PATCH] fix(build): CSON => JSON no longer necessary for /keymaps, /menus --- build/Gruntfile.coffee | 3 - build/tasks/copy-files-for-build-task.coffee | 2 + dot-nylas/keymap.cson | 27 ------- dot-nylas/keymap.json | 0 .../keymaps/{github.cson => github.json} | 0 .../{search-bar.cson => search-bar.json} | 0 menus/linux.cson | 81 ------------------- menus/linux.json | 80 ++++++++++++++++++ menus/win32.cson | 75 ----------------- menus/win32.json | 74 +++++++++++++++++ src/menu-manager.coffee | 1 - src/package.coffee | 10 +-- 12 files changed, 159 insertions(+), 194 deletions(-) delete mode 100644 dot-nylas/keymap.cson create mode 100644 dot-nylas/keymap.json rename internal_packages/message-view-on-github/keymaps/{github.cson => github.json} (100%) rename internal_packages/thread-search/keymaps/{search-bar.cson => search-bar.json} (100%) delete mode 100644 menus/linux.cson create mode 100644 menus/linux.json delete mode 100644 menus/win32.cson create mode 100644 menus/win32.json diff --git a/build/Gruntfile.coffee b/build/Gruntfile.coffee index 33396fa0a..e8d1a76ff 100644 --- a/build/Gruntfile.coffee +++ b/build/Gruntfile.coffee @@ -174,9 +174,6 @@ module.exports = (grunt) -> glob_to_multiple: expand: true src: [ - 'menus/*.cson' - 'keymaps/*.cson' - 'keymaps/templates/*.cson' 'static/**/*.cson' ] dest: appDir diff --git a/build/tasks/copy-files-for-build-task.coffee b/build/tasks/copy-files-for-build-task.coffee index b0bb6f3cd..12719d0eb 100644 --- a/build/tasks/copy-files-for-build-task.coffee +++ b/build/tasks/copy-files-for-build-task.coffee @@ -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') diff --git a/dot-nylas/keymap.cson b/dot-nylas/keymap.cson deleted file mode 100644 index 7c983a759..000000000 --- a/dot-nylas/keymap.cson +++ /dev/null @@ -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 diff --git a/dot-nylas/keymap.json b/dot-nylas/keymap.json new file mode 100644 index 000000000..e69de29bb diff --git a/internal_packages/message-view-on-github/keymaps/github.cson b/internal_packages/message-view-on-github/keymaps/github.json similarity index 100% rename from internal_packages/message-view-on-github/keymaps/github.cson rename to internal_packages/message-view-on-github/keymaps/github.json diff --git a/internal_packages/thread-search/keymaps/search-bar.cson b/internal_packages/thread-search/keymaps/search-bar.json similarity index 100% rename from internal_packages/thread-search/keymaps/search-bar.cson rename to internal_packages/thread-search/keymaps/search-bar.json diff --git a/menus/linux.cson b/menus/linux.cson deleted file mode 100644 index 5325d890c..000000000 --- a/menus/linux.cson +++ /dev/null @@ -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':[ -] diff --git a/menus/linux.json b/menus/linux.json new file mode 100644 index 000000000..62e9fc31d --- /dev/null +++ b/menus/linux.json @@ -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" } + ] + } + ] +} diff --git a/menus/win32.cson b/menus/win32.cson deleted file mode 100644 index d83471dfd..000000000 --- a/menus/win32.cson +++ /dev/null @@ -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':[ -] diff --git a/menus/win32.json b/menus/win32.json new file mode 100644 index 000000000..196c592ee --- /dev/null +++ b/menus/win32.json @@ -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" } + ] +} diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index fe0b7ef2d..4ee3e4172 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -1,7 +1,6 @@ path = require 'path' _ = require 'underscore' -CSON = require 'season' fs = require 'fs-plus' {ipcRenderer} = require 'electron' {Disposable} = require 'event-kit' diff --git a/src/package.coffee b/src/package.coffee index b4d6a1668..74e265356 100644 --- a/src/package.coffee +++ b/src/package.coffee @@ -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')