This commit is contained in:
Antonio Scandurra 2016-07-27 16:43:01 +02:00
parent 6903e941d9
commit ee60a2daaa
2 changed files with 10 additions and 13 deletions

View File

@ -1,10 +1,5 @@
// This module exports a function that transpiles all files with a babel prefix
// into the appropriate location in the build output directory.
'use strict'
module.exports = transpileBabelPaths
const babel = require('babel-core')
const fs = require('fs')
const glob = require('glob')
@ -21,7 +16,7 @@ const BABEL_PREFIXES = [
const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.length))
const BUFFER = Buffer(PREFIX_LENGTH)
function transpileBabelPaths () {
module.exports = function () {
console.log('Transpiling Babel paths...');
for (let path of getPathsToTranspile()) {
if (usesBabel(path)) {
@ -34,7 +29,10 @@ function getPathsToTranspile () {
let paths = []
paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'src', '**', '*.js')))
for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) {
paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.js')))
paths = paths.concat(glob.sync(
path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.js'),
{ignore: path.join(CONFIG.electronAppPath, 'node_modules', packageName, 'spec', '**', '*.js')}
))
}
return paths
}

View File

@ -1,6 +1,3 @@
// This module exports a function that transpiles all .coffee files into the
// appropriate location in the build output directory.
'use strict'
const coffee = require('coffee-script')
@ -10,8 +7,7 @@ const path = require('path')
const CONFIG = require('../config')
module.exports =
function transpileCoffeeScriptPaths () {
module.exports = function () {
console.log('Transpiling CoffeeScript paths...');
for (let path of getPathsToTranspile()) {
transpileCoffeeScriptPath(path)
@ -24,7 +20,10 @@ function getPathsToTranspile () {
paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'spec', '*.coffee')))
paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'exports', '**', '*.coffee')))
for (let packageName of Object.keys(CONFIG.appMetadata.packageDependencies)) {
paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.coffee')))
paths = paths.concat(glob.sync(
path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.coffee'),
{ignore: path.join(CONFIG.electronAppPath, 'node_modules', packageName, 'spec', '**', '*.coffee')}
))
}
return paths
}