diff --git a/app/package.json b/app/package.json index 826756e23..74088edd3 100644 --- a/app/package.json +++ b/app/package.json @@ -9,6 +9,7 @@ "dependencies": { "fs-jetpack": "^0.7.0" }, + "packageNameTemplate": "{{name}}-v{{version}}-{{platform}}-{{arch}}", "osx": { "build": "1", "identifier": "com.example.electron-boilerplate", diff --git a/tasks/build/build.js b/tasks/build/build.js index f9508fe0d..04576c7f1 100644 --- a/tasks/build/build.js +++ b/tasks/build/build.js @@ -24,13 +24,13 @@ var paths = { './**/*.html', './**/*.+(jpg|png|svg)' ], -} +}; // ------------------------------------- // Tasks // ------------------------------------- -gulp.task('clean', function (callback) { +gulp.task('clean', function () { return destDir.dirAsync('.', { empty: true }); }); diff --git a/tasks/release/linux.js b/tasks/release/linux.js index 7135b10c0..8f87b197b 100644 --- a/tasks/release/linux.js +++ b/tasks/release/linux.js @@ -20,11 +20,11 @@ var init = function () { tmpDir = projectDir.dir('./tmp', { empty: true }); releasesDir = projectDir.dir('./releases'); manifest = projectDir.read('app/package.json', 'json'); - packName = manifest.name + '_' + manifest.version; + packName = utils.getReleasePackageName(manifest); packDir = tmpDir.dir(packName); readyAppDir = packDir.cwd('opt', manifest.name); - return Q(); + return new Q(); }; var copyRuntime = function () { @@ -58,20 +58,20 @@ var finalize = function () { // Copy icon projectDir.copy('resources/icon.png', readyAppDir.path('icon.png')); - return Q(); + return new Q(); }; var renameApp = function () { - return readyAppDir.renameAsync("electron", manifest.name); + return readyAppDir.renameAsync('electron', manifest.name); }; var packToDebFile = function () { var deferred = Q.defer(); - var debFileName = packName + '_amd64.deb'; + var debFileName = packName + '.deb'; var debPath = releasesDir.path(debFileName); - gulpUtil.log('Creating DEB package...'); + gulpUtil.log('Creating DEB package... (' + debFileName + ')'); // Counting size of the app in KiB var appSize = Math.round(readyAppDir.inspectTree('.').size / 1024); @@ -91,7 +91,7 @@ var packToDebFile = function () { childProcess.exec('fakeroot dpkg-deb -Zxz --build ' + packDir.path().replace(/\s/g, '\\ ') + ' ' + debPath.replace(/\s/g, '\\ '), function (error, stdout, stderr) { if (error || stderr) { - console.log("ERROR while building DEB package:"); + console.log('ERROR while building DEB package:'); console.log(error); console.log(stderr); } else { diff --git a/tasks/release/osx.js b/tasks/release/osx.js index 0127d64c7..2cede1202 100644 --- a/tasks/release/osx.js +++ b/tasks/release/osx.js @@ -56,7 +56,6 @@ var finalize = function () { copyright: manifest.copyright, LSApplicationCategoryType: manifest.osx.LSApplicationCategoryType }); - finalAppDir.write('Contents/Info.plist', info); // Prepare Info.plist of Helper apps @@ -145,7 +144,7 @@ var packToDmgFile = function () { var deferred = Q.defer(); var appdmg = require('appdmg'); - var dmgName = manifest.name + '_' + manifest.version + '.dmg'; + var dmgName = utils.getReleasePackageName(manifest) + '.dmg'; // Prepare appdmg config var dmgManifest = projectDir.read('resources/osx/appdmg.json'); @@ -160,7 +159,7 @@ var packToDmgFile = function () { // Delete DMG file with this name if already exists releasesDir.remove(dmgName); - gulpUtil.log('Packaging to DMG file...'); + gulpUtil.log('Packaging to DMG file... (' + dmgName + ')'); var readyDmgPath = releasesDir.path(dmgName); appdmg({ diff --git a/tasks/release/windows.js b/tasks/release/windows.js index c4c45d827..709754733 100644 --- a/tasks/release/windows.js +++ b/tasks/release/windows.js @@ -20,7 +20,7 @@ var init = function () { manifest = projectDir.read('app/package.json', 'json'); readyAppDir = tmpDir.cwd(manifest.name); - return Q(); + return new Q(); }; var copyRuntime = function () { @@ -76,7 +76,7 @@ var renameApp = function () { var createInstaller = function () { var deferred = Q.defer(); - var finalPackageName = manifest.name + '_' + manifest.version + '.exe'; + var finalPackageName = utils.getReleasePackageName(manifest) + '.exe'; var installScript = projectDir.read('resources/windows/installer.nsi'); installScript = utils.replace(installScript, { @@ -92,7 +92,7 @@ var createInstaller = function () { }); tmpDir.write('installer.nsi', installScript); - gulpUtil.log('Building installer with NSIS...'); + gulpUtil.log('Building installer with NSIS... (' + finalPackageName + ')'); // Remove destination file if already exists. releasesDir.remove(finalPackageName); diff --git a/tasks/utils.js b/tasks/utils.js index b6794b4bc..5042327d1 100644 --- a/tasks/utils.js +++ b/tasks/utils.js @@ -23,6 +23,17 @@ module.exports.replace = function (str, patterns) { return str; }; +module.exports.getReleasePackageName = function(manifest) { + return module.exports.replace(manifest.packageNameTemplate, { + name: manifest.name, + version: manifest.version, + build: manifest.build, + productName: manifest.productName, + platform: process.platform, + arch: process.arch + }); +} + module.exports.getEnvName = function () { return argv.env || 'development'; };