This repository has been archived by the owner on Dec 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
109 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
'use strict'; | ||
|
||
require('./tasks/build'); | ||
require('./tasks/release'); | ||
require('./tasks/build/build'); | ||
require('./tasks/release/release'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict'; | ||
|
||
var pathUtil = require('path'); | ||
var jetpack = require('fs-jetpack'); | ||
var rollup = require('rollup'); | ||
var Q = require('q'); | ||
|
||
var nodeBuiltInModules = ['assert', 'buffer', 'child_process', 'cluster', | ||
'console', 'constants', 'crypto', 'dgram', 'dns', 'domain', 'events', | ||
'fs', 'http', 'https', 'module', 'net', 'os', 'path', 'process', 'punycode', | ||
'querystring', 'readline', 'repl', 'stream', 'string_decoder', 'timers', | ||
'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib']; | ||
|
||
var electronBuiltInModules = ['electron']; | ||
|
||
var npmModulesUsedInApp = function () { | ||
var appManifest = require('../../app/package.json'); | ||
return Object.keys(appManifest.dependencies); | ||
}; | ||
|
||
var generateExternalModulesList = function () { | ||
return [].concat(nodeBuiltInModules, electronBuiltInModules, npmModulesUsedInApp()); | ||
}; | ||
|
||
module.exports = function (src, dest) { | ||
var deferred = Q.defer(); | ||
|
||
rollup.rollup({ | ||
entry: src, | ||
external: generateExternalModulesList(), | ||
}).then(function (bundle) { | ||
var jsFile = pathUtil.basename(dest); | ||
var result = bundle.generate({ | ||
format: 'cjs', | ||
sourceMap: true, | ||
sourceMapFile: jsFile, | ||
}); | ||
// Wrap code in self invoking function so the variables don't | ||
// pollute the global namespace. | ||
var isolatedCode = '(function () {' + result.code + '\n}());'; | ||
return Q.all([ | ||
jetpack.writeAsync(dest, isolatedCode + '\n//# sourceMappingURL=' + jsFile + '.map'), | ||
jetpack.writeAsync(dest + '.map', result.map.toString()), | ||
]); | ||
}).then(function () { | ||
deferred.resolve(); | ||
}).catch(function (err) { | ||
console.error('Build: Error during rollup', err.stack); | ||
}); | ||
|
||
return deferred.promise; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters