From e8392bd7130c793023afcbcdad9849cdf23b389f Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 23 Mar 2016 19:43:32 -0600 Subject: [PATCH] more progress --- build/build.js | 2 +- build/config.js | 3 ++- build/lib/transpile-babel-paths.js | 1 + build/lib/transpile-coffee-script-paths.js | 11 +++++++++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/build/build.js b/build/build.js index 5d90029a9..94ffd895a 100644 --- a/build/build.js +++ b/build/build.js @@ -6,7 +6,7 @@ const transpileBabelPaths = require('./lib/transpile-babel-paths') const transpileCoffeeScriptPaths = require('./lib/transpile-coffee-script-paths') function transpile () { - // transpileBabelPaths() + transpileBabelPaths() transpileCoffeeScriptPaths() } diff --git a/build/config.js b/build/config.js index 75fa97b31..680d11228 100644 --- a/build/config.js +++ b/build/config.js @@ -10,13 +10,14 @@ const appMetadata = require('../package.json') const repositoryRootPath = path.resolve(__dirname, '..') const buildOutputPath = path.join(repositoryRootPath, 'out') -const appName = appMetadata.productName +let appName = appMetadata.productName const appFileName = appMetadata.name let electronRootPath, electronAppPath switch (process.platform) { case 'darwin': + appName += '.app' electronRootPath = path.join(buildOutputPath, appName, 'Contents') electronAppPath = path.join(electronRootPath, 'Resources', 'app') break; diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index c38baf41d..b1dfa754d 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -24,6 +24,7 @@ const PREFIX_LENGTH = Math.max.apply(null, BABEL_PREFIXES.map(prefix => prefix.l const BUFFER = Buffer(PREFIX_LENGTH) function transpileBabelPaths () { + console.log('Transpiling Babel paths...'); for (let srcPath of glob.sync(`${CONFIG.repositoryRootPath}/src/**/*.js`)) { if (usesBabel(srcPath)) { transpileBabelPath(srcPath, computeDestinationPath(srcPath)) diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index 886234ef6..80a92d41a 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -3,7 +3,10 @@ 'use strict' +const coffee = require('coffee-script') +const fs = require('fs') const glob = require('glob') +const mkdirp = require('mkdirp') const path = require('path') const CONFIG = require('../config') @@ -18,8 +21,9 @@ const GLOBS = [ module.exports = function transpileCoffeeScriptPaths () { + console.log('Transpiling CoffeeScript paths...'); for (let srcPath of getPathsToTranspile()) { - transpileCoffeeScriptPath(srcPath, computeDestinationPath(srcPath)) + transpileCoffeeScriptPath(srcPath, computeDestinationPath(srcPath).replace(/coffee$/, 'js')) } } @@ -32,5 +36,8 @@ function getPathsToTranspile () { } function transpileCoffeeScriptPath (srcPath, destPath) { - console.log(srcPath); + const inputCode = fs.readFileSync(srcPath, 'utf8') + let outputCode = coffee.compile(inputCode) + mkdirp.sync(path.dirname(destPath)) + fs.writeFileSync(destPath, outputCode) }