From 6903e941d9f443f289d449aaa7d102ee60712f5d Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 27 Jul 2016 16:39:53 +0200 Subject: [PATCH] Use `path.join` instead of manually creating paths --- build/lib/copy-assets.js | 2 +- build/lib/transpile-babel-paths.js | 4 ++-- build/lib/transpile-coffee-script-paths.js | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build/lib/copy-assets.js b/build/lib/copy-assets.js index 3b15f17f7..f067ff3b2 100644 --- a/build/lib/copy-assets.js +++ b/build/lib/copy-assets.js @@ -19,7 +19,7 @@ module.exports = function () { path.join(CONFIG.repositoryRootPath, 'src'), path.join(CONFIG.repositoryRootPath, 'vendor') ] - srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: '**/*-spec.*'})) + srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')})) for (let srcPath of srcPaths) { fs.copySync(srcPath, computeDestinationPath(srcPath)) } diff --git a/build/lib/transpile-babel-paths.js b/build/lib/transpile-babel-paths.js index fa837ec27..889466961 100644 --- a/build/lib/transpile-babel-paths.js +++ b/build/lib/transpile-babel-paths.js @@ -32,9 +32,9 @@ function transpileBabelPaths () { function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/src/**/*.js`)) + 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(`${CONFIG.electronAppPath}/node_modules/${packageName}/**/*.js`)) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.js'))) } return paths } diff --git a/build/lib/transpile-coffee-script-paths.js b/build/lib/transpile-coffee-script-paths.js index f76d9722e..53407aa5a 100644 --- a/build/lib/transpile-coffee-script-paths.js +++ b/build/lib/transpile-coffee-script-paths.js @@ -6,7 +6,6 @@ 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') @@ -21,11 +20,11 @@ function transpileCoffeeScriptPaths () { function getPathsToTranspile () { let paths = [] - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/src/**/*.coffee`)) - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/spec/*.coffee`, {ignore: '**/*-spec.coffee'})) - paths = paths.concat(glob.sync(`${CONFIG.electronAppPath}/exports/**/*.coffee`)) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'src', '**', '*.coffee'))) + 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(`${CONFIG.electronAppPath}/node_modules/${packageName}/**/*.coffee`)) + paths = paths.concat(glob.sync(path.join(CONFIG.electronAppPath, 'node_modules', packageName, '**', '*.coffee'))) } return paths }