mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-11 01:54:40 +08:00
feat(package): require 'engines': {'nylas': '*'}
in package.json
This commit is contained in:
parent
a3baef8d62
commit
2472e0556b
5 changed files with 17 additions and 14 deletions
|
@ -1 +1 @@
|
|||
Subproject commit ae4de39d22e1f0c85641a988dc21ec44846884ef
|
||||
Subproject commit 7bcb1918054cad23fd217dff38df6596b52ee87b
|
|
@ -3,7 +3,7 @@ path = require 'path'
|
|||
|
||||
module.exports = (grunt) ->
|
||||
{cp, mkdir, rm} = require('./task-helpers')(grunt)
|
||||
rootDir = path.resolve(path.join('resources', 'nylas'))
|
||||
rootDir = path.resolve(path.join('../', 'internal_packages', 'pro'))
|
||||
|
||||
copyArcFiles = ->
|
||||
cp path.join(rootDir, 'arc-N1', '.arcconfig'), '.arcconfig'
|
||||
|
@ -13,14 +13,6 @@ module.exports = (grunt) ->
|
|||
copySourceExtensions = ->
|
||||
cp path.join(rootDir, 'src'), 'src'
|
||||
|
||||
linkPlugins = ->
|
||||
for plugin in fs.readdirSync(path.join(rootDir, 'packages'))
|
||||
from = path.join(rootDir, 'packages', plugin)
|
||||
to = path.join(path.resolve('internal_packages'), plugin)
|
||||
if not fs.existsSync(to)
|
||||
grunt.log.writeln "Adding '#{plugin}' to internal_packages"
|
||||
fs.symlinkSync(from, to, 'dir')
|
||||
|
||||
desc = 'Adds in proprietary Nylas packages, fonts, and sounds to N1'
|
||||
grunt.registerTask 'add-nylas-build-resources', desc, ->
|
||||
canaryFileExists = fs.existsSync(path.join(rootDir, "README.md"))
|
||||
|
@ -31,4 +23,3 @@ module.exports = (grunt) ->
|
|||
grunt.log.writeln "Found proprietary Nylas plugins"
|
||||
copyArcFiles()
|
||||
copySourceExtensions()
|
||||
linkPlugins()
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
"description": "Replaces all text with blocks for taking screenshots without PII",
|
||||
"license": "Proprietary",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"nylas": "*"
|
||||
},
|
||||
"windowTypes": {
|
||||
"all": true
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ class PackageManager
|
|||
@packageDirPaths.push(path.join(@resourcePath, "spec", "fixtures", "packages"))
|
||||
else
|
||||
@packageDirPaths.push(path.join(@resourcePath, "internal_packages"))
|
||||
@packageDirPaths.push(path.join(@resourcePath, "internal_packages", "pro"))
|
||||
if not safeMode
|
||||
if @devMode
|
||||
@packageDirPaths.push(path.join(configDirPath, "dev", "packages"))
|
||||
|
@ -174,7 +175,7 @@ class PackageManager
|
|||
return packagePath if fs.isDirectorySync(packagePath)
|
||||
|
||||
packagePath = path.join(@resourcePath, 'node_modules', name)
|
||||
return packagePath if @nasNylasEngine(packagePath)
|
||||
return packagePath if @hasNylasEngine(packagePath)
|
||||
|
||||
# Public: Is the package with the given name bundled with Nylas?
|
||||
#
|
||||
|
@ -313,7 +314,13 @@ class PackageManager
|
|||
if windowType
|
||||
packagePaths = _.filter packagePaths, (packagePath) ->
|
||||
try
|
||||
{windowTypes} = Package.loadMetadata(packagePath) ? {}
|
||||
metadata = Package.loadMetadata(packagePath) ? {}
|
||||
|
||||
if not (metadata.engines?.nylas) and not (/pro/.test(packagePath))
|
||||
console.error("INVALID PACKAGE: Your package at #{packagePath} does not have a properly formatted `package.json`. You must include an {'engines': {'nylas': version}} property")
|
||||
return false
|
||||
|
||||
{windowTypes} = metadata
|
||||
if windowTypes
|
||||
return windowTypes[windowType]? or windowTypes["all"]?
|
||||
else if loadPackagesWhenNoTypesSpecified
|
||||
|
@ -417,7 +424,7 @@ class PackageManager
|
|||
|
||||
@packageDependencies
|
||||
|
||||
nasNylasEngine: (packagePath) ->
|
||||
hasNylasEngine: (packagePath) ->
|
||||
metadata = Package.loadMetadata(packagePath, true)
|
||||
metadata?.engines?.nylas?
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ class Package
|
|||
metadata = JSON.parse(fs.readFileSync(metadataPath))
|
||||
catch error
|
||||
throw error unless ignoreErrors
|
||||
else
|
||||
return null
|
||||
metadata ?= {}
|
||||
metadata.name = packageName
|
||||
|
||||
|
|
Loading…
Reference in a new issue