mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
There are several folders bundled in the app that aren't needed in the require cache list so it is simpler to opt-in the folders that should be part of the cache.
30 lines
889 B
CoffeeScript
30 lines
889 B
CoffeeScript
path = require 'path'
|
|
ModuleCache = require '../../src/module-cache'
|
|
|
|
module.exports = (grunt) ->
|
|
grunt.registerTask 'generate-module-cache', 'Generate a module cache for all core modules and packages', ->
|
|
appDir = grunt.config.get('atom.appDir')
|
|
|
|
{packageDependencies} = grunt.file.readJSON('package.json')
|
|
|
|
for packageName, version of packageDependencies
|
|
ModuleCache.create(path.join(appDir, 'node_modules', packageName))
|
|
|
|
ModuleCache.create(appDir)
|
|
|
|
metadata = grunt.file.readJSON(path.join(appDir, 'package.json'))
|
|
|
|
metadata._atomModuleCache.folders.forEach (folder) ->
|
|
if '' in folder.paths
|
|
folder.paths = [
|
|
''
|
|
'exports'
|
|
'spec'
|
|
'src'
|
|
'src/browser'
|
|
'static'
|
|
'vendor'
|
|
]
|
|
|
|
grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata, null, 2))
|