mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-09 04:44:32 +08:00
cson(packages): Remove from specs, deprecate use for for menus, package.json files
This commit is contained in:
parent
16dd26c29e
commit
12bc0958ca
32 changed files with 53 additions and 92 deletions
|
@ -1,12 +0,0 @@
|
||||||
'fileTypes': ['alittle']
|
|
||||||
'name': 'Alittle'
|
|
||||||
'scopeName': 'source.alittle'
|
|
||||||
|
|
||||||
'patterns': [
|
|
||||||
{
|
|
||||||
'captures':
|
|
||||||
'0':
|
|
||||||
'name': 'keyword.alittle'
|
|
||||||
'match': 'alittle'
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,12 +0,0 @@
|
||||||
'fileTypes': ['alot', 'foobizbang']
|
|
||||||
'name': 'Alot'
|
|
||||||
'scopeName': 'source.alot'
|
|
||||||
|
|
||||||
'patterns': [
|
|
||||||
{
|
|
||||||
'captures':
|
|
||||||
'0':
|
|
||||||
'name': 'keyword.alot'
|
|
||||||
'match': 'alot'
|
|
||||||
}
|
|
||||||
]
|
|
|
@ -1,4 +0,0 @@
|
||||||
'name': 'test'
|
|
||||||
'scopeName': 'source.test'
|
|
||||||
'injectionSelector': 'comment'
|
|
||||||
'patterns': [{'include': 'source.sql'}]
|
|
|
@ -1 +0,0 @@
|
||||||
keymaps: ["keymap-2", "keymap-1"]
|
|
3
spec/fixtures/packages/package-with-keymaps-manifest/package.json
vendored
Normal file
3
spec/fixtures/packages/package-with-keymaps-manifest/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"keymaps": ["keymap-2", "keymap-1"]
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
'main': 'main-module.coffee'
|
|
3
spec/fixtures/packages/package-with-main/package.json
vendored
Normal file
3
spec/fixtures/packages/package-with-main/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"main": "main-module.coffee"
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
'menu': [
|
|
||||||
{ 'label': 'Last' }
|
|
||||||
]
|
|
||||||
|
|
||||||
'context-menu':
|
|
||||||
'.test-1': [
|
|
||||||
{label: 'Menu item 1', command: 'command-1'}
|
|
||||||
]
|
|
5
spec/fixtures/packages/package-with-menus-manifest/menus/menu-1.json
vendored
Normal file
5
spec/fixtures/packages/package-with-menus-manifest/menus/menu-1.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"menu": [
|
||||||
|
{ "label": "Last" }
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
'menu': [
|
|
||||||
{ 'label': 'Second to Last' }
|
|
||||||
]
|
|
||||||
|
|
||||||
'context-menu':
|
|
||||||
'.test-1': [
|
|
||||||
{label: 'Menu item 2', command: 'command-2'}
|
|
||||||
]
|
|
5
spec/fixtures/packages/package-with-menus-manifest/menus/menu-2.json
vendored
Normal file
5
spec/fixtures/packages/package-with-menus-manifest/menus/menu-2.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"menu": [
|
||||||
|
{ "label": "Second to Last" }
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,4 +0,0 @@
|
||||||
'context-menu':
|
|
||||||
'.test-1': [
|
|
||||||
{label: 'Menu item 3', command: 'command-3'}
|
|
||||||
]
|
|
|
@ -1 +0,0 @@
|
||||||
menus: ["menu-2", "menu-1"]
|
|
3
spec/fixtures/packages/package-with-menus-manifest/package.json
vendored
Normal file
3
spec/fixtures/packages/package-with-menus-manifest/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"menus": ["menu-2", "menu-1"]
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
'menu': [
|
|
||||||
{'label': 'Second to Last'}
|
|
||||||
]
|
|
||||||
|
|
||||||
'context-menu':
|
|
||||||
'.test-1': [
|
|
||||||
{label: 'Menu item 1', command: 'command-1'}
|
|
||||||
]
|
|
5
spec/fixtures/packages/package-with-menus/menus/menu-1.json
vendored
Normal file
5
spec/fixtures/packages/package-with-menus/menus/menu-1.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"menu": [
|
||||||
|
{ "label": "Last" }
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
'menu': [
|
|
||||||
{ 'label': 'Last' }
|
|
||||||
]
|
|
||||||
|
|
||||||
'context-menu':
|
|
||||||
'.test-1': [
|
|
||||||
{label: 'Menu item 2', command: 'command-2'}
|
|
||||||
]
|
|
5
spec/fixtures/packages/package-with-menus/menus/menu-2.json
vendored
Normal file
5
spec/fixtures/packages/package-with-menus/menus/menu-2.json
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"menu": [
|
||||||
|
{ "label": "Second to Last" }
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
'menu': [
|
|
||||||
{ 'label': 'Second to Last' }
|
|
||||||
]
|
|
||||||
|
|
||||||
'context-menu':
|
|
||||||
'.test-1': [
|
|
||||||
{label: 'Menu item 3', command: 'command-3'}
|
|
||||||
]
|
|
|
@ -1 +0,0 @@
|
||||||
'main': 'main-module.coffee'
|
|
3
spec/fixtures/packages/package-with-models/package.json
vendored
Normal file
3
spec/fixtures/packages/package-with-models/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"main": "main-module.coffee"
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
'main': 'index.coffee'
|
|
3
spec/fixtures/packages/package-with-serialize-error/package.json
vendored
Normal file
3
spec/fixtures/packages/package-with-serialize-error/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"main": "index.coffee"
|
||||||
|
}
|
|
@ -1,3 +0,0 @@
|
||||||
'.source.omg':
|
|
||||||
'editor':
|
|
||||||
'increaseIndentPattern': '^a'
|
|
|
@ -1 +0,0 @@
|
||||||
styleSheets: ['2', '1']
|
|
3
spec/fixtures/packages/package-with-style-sheets-manifest/package.json
vendored
Normal file
3
spec/fixtures/packages/package-with-style-sheets-manifest/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"styleSheets": ["2", "1"]
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
styleSheets: ['2', '1']
|
|
3
spec/fixtures/packages/package-with-stylesheets-manifest/package.json
vendored
Normal file
3
spec/fixtures/packages/package-with-stylesheets-manifest/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"styleSheets": ["2", "1"]
|
||||||
|
}
|
|
@ -1 +0,0 @@
|
||||||
"name": "perfect"
|
|
3
spec/fixtures/packages/package-without-module/package.json
vendored
Normal file
3
spec/fixtures/packages/package-without-module/package.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"name": "perfect"
|
||||||
|
}
|
|
@ -267,8 +267,8 @@ describe "PackageManager", ->
|
||||||
|
|
||||||
runs ->
|
runs ->
|
||||||
expect(NylasEnv.menu.template.length).toBe 2
|
expect(NylasEnv.menu.template.length).toBe 2
|
||||||
expect(NylasEnv.menu.template[0].label).toBe "Second to Last"
|
expect(NylasEnv.menu.template[1].label).toBe "Second to Last"
|
||||||
expect(NylasEnv.menu.template[1].label).toBe "Last"
|
expect(NylasEnv.menu.template[0].label).toBe "Last"
|
||||||
|
|
||||||
describe "when the metadata contains a 'menus' manifest", ->
|
describe "when the metadata contains a 'menus' manifest", ->
|
||||||
it "loads only the menus specified by the manifest, in the specified order", ->
|
it "loads only the menus specified by the manifest, in the specified order", ->
|
||||||
|
|
|
@ -2,7 +2,6 @@ path = require 'path'
|
||||||
|
|
||||||
_ = require 'underscore'
|
_ = require 'underscore'
|
||||||
async = require 'async'
|
async = require 'async'
|
||||||
CSON = require 'season'
|
|
||||||
fs = require 'fs-plus'
|
fs = require 'fs-plus'
|
||||||
EmitterMixin = require('emissary').Emitter
|
EmitterMixin = require('emissary').Emitter
|
||||||
{Emitter, CompositeDisposable} = require 'event-kit'
|
{Emitter, CompositeDisposable} = require 'event-kit'
|
||||||
|
@ -37,9 +36,10 @@ class Package
|
||||||
if @isBundledPackagePath(packagePath)
|
if @isBundledPackagePath(packagePath)
|
||||||
metadata = packagesCache[packageName]?.metadata
|
metadata = packagesCache[packageName]?.metadata
|
||||||
unless metadata?
|
unless metadata?
|
||||||
if metadataPath = CSON.resolve(path.join(packagePath, 'package'))
|
metadataPath = fs.resolve(path.join(packagePath, 'package.json'))
|
||||||
|
if fs.existsSync(metadataPath)
|
||||||
try
|
try
|
||||||
metadata = CSON.readFileSync(metadataPath)
|
metadata = JSON.parse(fs.readFileSync(metadataPath))
|
||||||
catch error
|
catch error
|
||||||
throw error unless ignoreErrors
|
throw error unless ignoreErrors
|
||||||
metadata ?= {}
|
metadata ?= {}
|
||||||
|
@ -239,9 +239,9 @@ class Package
|
||||||
if @bundledPackage and packagesCache[@name]?
|
if @bundledPackage and packagesCache[@name]?
|
||||||
@menus = (["#{NylasEnv.packages.resourcePath}#{path.sep}#{menuPath}", menuObject] for menuPath, menuObject of packagesCache[@name].menus)
|
@menus = (["#{NylasEnv.packages.resourcePath}#{path.sep}#{menuPath}", menuObject] for menuPath, menuObject of packagesCache[@name].menus)
|
||||||
else
|
else
|
||||||
@menus = @getMenuPaths().map (menuPath) -> [menuPath, CSON.readFileSync(menuPath) ? {}]
|
@menus = @getMenuPaths().map (menuPath) -> [menuPath, JSON.parse(fs.readFileSync(menuPath)) ? {}]
|
||||||
catch e
|
catch e
|
||||||
console.error "Error reading keymaps for package '#{@name}': #{e.message}", e.stack
|
console.error "Error reading menus for package '#{@name}': #{e.message}", e.stack
|
||||||
|
|
||||||
getKeymapPaths: ->
|
getKeymapPaths: ->
|
||||||
keymapsDirPath = path.join(@path, 'keymaps')
|
keymapsDirPath = path.join(@path, 'keymaps')
|
||||||
|
@ -253,9 +253,9 @@ class Package
|
||||||
getMenuPaths: ->
|
getMenuPaths: ->
|
||||||
menusDirPath = path.join(@path, 'menus')
|
menusDirPath = path.join(@path, 'menus')
|
||||||
if @metadata.menus
|
if @metadata.menus
|
||||||
@metadata.menus.map (name) -> fs.resolve(menusDirPath, name, ['json', 'cson', ''])
|
@metadata.menus.map (name) -> fs.resolve(menusDirPath, name, ['json', ''])
|
||||||
else
|
else
|
||||||
fs.listSync(menusDirPath, ['cson', 'json'])
|
fs.listSync(menusDirPath, ['json'])
|
||||||
|
|
||||||
loadStylesheets: ->
|
loadStylesheets: ->
|
||||||
@stylesheets = @getStylesheetPaths().map (stylesheetPath) ->
|
@stylesheets = @getStylesheetPaths().map (stylesheetPath) ->
|
||||||
|
|
Loading…
Add table
Reference in a new issue