Mailspring/build/tasks/generate-module-cache-task.coffee
Evan Morikawa 7a4e5b8641 refactor(dir): move exports to src/global and consolidate tests
Summary:
This:

1. Moves spec-nylas into spec
1. Gets rid of old & irrelevant specs
1. Moves the `vendor` folder (jasmine libs) into the `spec` folder
1. Moves the `exports` folder to `src/global` and updates all references

I pretty extensively made sure the client still works and that all of the
tests pass. The changes should have no effect.

Test Plan: All tests pass!

Reviewers: bengotow, dillon

Differential Revision: https://phab.nylas.com/D2098
2015-10-02 09:19:37 -07:00

37 lines
1.1 KiB
CoffeeScript

path = require 'path'
fs = require 'fs-plus'
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 = [
''
'spec'
'src'
'src/browser'
'static'
]
# Reactionary does not have an explicit react dependency
metadata._atomModuleCache.folders.push
paths: [
'node_modules/reactionary-atom-fork/lib'
]
dependencies: {
'react-atom-fork': metadata.dependencies['react-atom-fork']
}
grunt.file.write(path.join(appDir, 'package.json'), JSON.stringify(metadata))