mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Add module cache generation
This commit is contained in:
@@ -2,12 +2,15 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
require('coffee-script/register')
|
||||
|
||||
const cleanOutputDirectory = require('./lib/clean-output-directory')
|
||||
const copyAssets = require('./lib/copy-assets')
|
||||
const transpileBabelPaths = require('./lib/transpile-babel-paths')
|
||||
const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths')
|
||||
const transpileCsonPaths = require('./lib/transpile-cson-paths')
|
||||
const transpilePegJsPaths = require('./lib/transpile-peg-js-paths')
|
||||
const generateModuleCache = require('./lib/generate-module-cache')
|
||||
const packageApplication = require('./lib/package-application')
|
||||
|
||||
cleanOutputDirectory()
|
||||
@@ -16,4 +19,5 @@ transpileBabelPaths()
|
||||
transpileCoffeeScriptPaths()
|
||||
transpileCsonPaths()
|
||||
transpilePegJsPaths()
|
||||
generateModuleCache()
|
||||
packageApplication()
|
||||
|
||||
30
build/lib/generate-module-cache.js
Normal file
30
build/lib/generate-module-cache.js
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const ModuleCache = require('../../src/module-cache')
|
||||
|
||||
const CONFIG = require('../config')
|
||||
|
||||
module.exports = function () {
|
||||
console.log(`Generating module cache for ${CONFIG.intermediateAppPath}...`)
|
||||
for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) {
|
||||
ModuleCache.create(path.join(CONFIG.intermediateAppPath, 'node_modules', packageName))
|
||||
}
|
||||
ModuleCache.create(CONFIG.intermediateAppPath)
|
||||
const newMetadata = JSON.parse(fs.readFileSync(path.join(CONFIG.intermediateAppPath, 'package.json')))
|
||||
for (let folder of newMetadata._atomModuleCache.folders) {
|
||||
if (folder.paths.indexOf('') !== -1) {
|
||||
folder.paths = [
|
||||
'',
|
||||
'exports',
|
||||
'spec',
|
||||
'src',
|
||||
'src/main-process',
|
||||
'static',
|
||||
'vendor'
|
||||
]
|
||||
}
|
||||
}
|
||||
fs.writeFileSync(path.join(CONFIG.intermediateAppPath, 'package.json'), JSON.stringify(newMetadata))
|
||||
}
|
||||
Reference in New Issue
Block a user