Files
atom/build/lib/copy-assets.js
Nathan Sobo 366cafc64a Copy everything to an intermediate electron app directory
We need to do this so we can transpile everything in place, but then we
should be able to run electron-packager directly on this directory.
2016-07-27 18:47:33 -06:00

33 lines
1.2 KiB
JavaScript

// This module exports a function that copies all the static assets into the
// appropriate location in the build output directory.
'use strict'
const path = require('path')
const fs = require('fs-extra')
const CONFIG = require('../config')
const glob = require('glob')
module.exports = function () {
console.log(`Copying assets to ${CONFIG.intermediateAppPath}...`);
let srcPaths = [
path.join(CONFIG.repositoryRootPath, 'dot-atom'),
path.join(CONFIG.repositoryRootPath, 'exports'),
path.join(CONFIG.repositoryRootPath, 'keymaps'),
path.join(CONFIG.repositoryRootPath, 'menus'),
path.join(CONFIG.repositoryRootPath, 'node_modules'),
path.join(CONFIG.repositoryRootPath, 'static'),
path.join(CONFIG.repositoryRootPath, 'src'),
path.join(CONFIG.repositoryRootPath, 'vendor')
]
srcPaths = srcPaths.concat(glob.sync(path.join(CONFIG.repositoryRootPath, 'spec', '*.*'), {ignore: path.join('**', '*-spec.*')}))
for (let srcPath of srcPaths) {
fs.copySync(srcPath, computeDestinationPath(srcPath))
}
}
function computeDestinationPath (srcPath) {
const relativePath = path.relative(CONFIG.repositoryRootPath, srcPath)
return path.join(CONFIG.intermediateAppPath, relativePath)
}