WIP: Add packageApplication step based on intermediate directory

This commit is contained in:
Nathan Sobo
2016-07-27 18:54:31 -06:00
parent 366cafc64a
commit fa816eab8c
3 changed files with 79 additions and 0 deletions

View File

@@ -7,9 +7,11 @@ 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 packageApplication = require('./lib/package-application')
cleanOutputDirectory()
copyAssets()
transpileBabelPaths()
transpileCoffeeScriptPaths()
transpileCsonPaths()
packageApplication()

View File

@@ -0,0 +1,76 @@
'use strict'
// This is where we'll run electron-packager on our intermediate app dir.
// It takes an ignore regex for paths to exclude, and I've started on a function
// to build up this regexp based on existing work in build-task.coffee. We should
// try to lean on electron-packager to do as much of the work for us as possible
// other than transpilation. It looks like it has a programmatic API. We'll need to
// copy more stuff such as the package.json for the packager to work correctly.
const electronPackager = require('electron-packager')
const CONFIG = require('../config')
module.exports = function () {
console.log(`Running electron-packager on ${CONFIG.intermediateAppPath}`)
// https://github.com/electron-userland/electron-packager/blob/master/docs/api.md
// electronPackager(...)
}
function buildIgnoredPathsRegExp () {
const ignoredPaths = [
'.DS_Store',
'.jshintrc',
'.npmignore',
'.pairs',
'.travis.yml',
'appveyor.yml',
'.idea',
'.editorconfig',
'.lint',
'.lintignore',
'.eslintrc',
'.jshintignore',
'coffeelint.json',
'.coffeelintignore',
'.gitattributes',
'.gitkeep',
path.join('git-utils', 'deps'),
path.join('oniguruma', 'deps'),
path.join('less', 'dist'),
path.join('npm', 'doc'),
path.join('npm', 'html'),
path.join('npm', 'man'),
path.join('npm', 'node_modules', '.bin', 'beep'),
path.join('npm', 'node_modules', '.bin', 'clear'),
path.join('npm', 'node_modules', '.bin', 'starwars'),
path.join('pegjs', 'examples'),
path.join('get-parameter-names', 'node_modules', 'testla'),
path.join('get-parameter-names', 'node_modules', '.bin', 'testla'),
path.join('jasmine-reporters', 'ext'),
path.join('jasmine-node', 'node_modules', 'gaze'),
path.join('jasmine-node', 'spec'),
path.join('node_modules', 'nan'),
path.join('node_modules', 'native-mate'),
path.join('build', 'binding.Makefile'),
path.join('build', 'config.gypi'),
path.join('build', 'gyp-mac-tool'),
path.join('build', 'Makefile'),
path.join('build', 'Release', 'obj.target'),
path.join('build', 'Release', 'obj'),
path.join('build', 'Release', '.deps'),
path.join('vendor', 'apm'),
// These are only required in dev-mode, when pegjs grammars aren't precompiled
path.join('snippets', 'node_modules', 'loophole'),
path.join('snippets', 'node_modules', 'pegjs'),
path.join('snippets', 'node_modules', '.bin', 'pegjs'),
]
const regExpSource = ignoredPaths.map(path => '(' + escapeRegExp(path) + ')').join('|')
return new RegExp(regExpSource)
}
function escapeRegExp (string) {
string.replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&")
}

View File

@@ -2,6 +2,7 @@
"name": "atom-build-scripts",
"description": "Atom build scripts",
"dependencies": {
"electron-packager": "^7.3.0",
"fs-extra": "0.30.0",
"glob": "7.0.3",
"mkdirp": "0.5.1"