Don’t delete package metadata during slug compilation

This saves space, but leads to surprises when package code tries to read
these files for purposes of introspection. For example, it was causing
us not to report exceptions from the exception-reporting package. The
.1% of the app bundle size it saves doesn’t seem worth the potential for
problems.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
This commit is contained in:
Nathan Sobo
2016-08-05 12:59:57 -06:00
committed by Max Brunsfeld
parent d5aa5f3800
commit 5662b57866

View File

@@ -8,13 +8,12 @@ semver = require 'semver'
OtherPlatforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32'].filter (platform) -> platform isnt process.platform
module.exports = (grunt) ->
{spawn, rm} = require('./task-helpers')(grunt)
{spawn} = require('./task-helpers')(grunt)
getMenu = (appDir) ->
menusPath = path.join(appDir, 'menus')
menuPath = path.join(menusPath, "#{process.platform}.json")
menu = CSON.readFileSync(menuPath) if fs.isFileSync(menuPath)
rm menusPath
menu
getKeymaps = (appDir) ->
@@ -26,7 +25,6 @@ module.exports = (grunt) ->
keymap = CSON.readFileSync(keymapPath)
keymaps[path.basename(keymapPath)] = keymap
rm keymapsPath
keymaps
grunt.registerTask 'compile-packages-slug', 'Add bundled package metadata information to the main package.json file', ->
@@ -54,7 +52,6 @@ module.exports = (grunt) ->
moduleCache = metadata._atomModuleCache ? {}
rm metadataPath
_.remove(moduleCache.extensions?['.json'] ? [], 'package.json')
for property in ['_from', '_id', 'dist', 'readme', 'readmeFilename']
@@ -70,15 +67,11 @@ module.exports = (grunt) ->
for keymapPath in fs.listSync(keymapsPath, ['.cson', '.json'])
relativePath = path.relative(appDir, keymapPath)
pack.keymaps[relativePath] = CSON.readFileSync(keymapPath)
rm keymapPath
rm keymapsPath if fs.listSync(keymapsPath).length is 0
menusPath = path.join(moduleDirectory, 'menus')
for menuPath in fs.listSync(menusPath, ['.cson', '.json'])
relativePath = path.relative(appDir, menuPath)
pack.menus[relativePath] = CSON.readFileSync(menuPath)
rm menuPath
rm menusPath if fs.listSync(menusPath).length is 0
packages[metadata.name] = pack