Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('redist:linux', function () {
var rename = require('gulp-rename');
var builder = require('electron-builder');
const config = getConfig("linux");
console.log(`Electron mirror: ${getElectronMirrorUrl()}`);
return builder.build({
targets: builder.Platform.LINUX.createTarget(["deb", "AppImage"], builder.Arch.ia32, builder.Arch.x64),
config,
prepackaged: './dist/linux-unpacked'
}).then((filenames) => {
return gulp.src(filenames, { allowEmpty: true })
.pipe(rename(function (path) {
path.basename = setReleaseFilename(path.basename, {
replaceWhitespace: true
});
}))
.pipe(gulp.dest('./dist'));
}).then(() => {
// Wait for the files to be written to disk and closed.
return delay(10000);
});
});
gulp.task('redist:binaries', async () => {
const { getConfig, getElectronMirrorUrl, getReleaseFilename } = common;
var rename = require('gulp-rename');
var builder = require('electron-builder');
const config = getConfig("windows", "nsis");
console.log(`Electron mirror: ${getElectronMirrorUrl()}`);
// create installers
const filenames = await builder.build({
targets: builder.Platform.WINDOWS.createTarget(["nsis"], builder.Arch.ia32),
config,
prepackaged: './dist/win-ia32-unpacked'
});
// rename and move the files to the /dist/ directory
await new Promise(resolve => {
gulp
.src(filenames, { allowEmpty: true })
.pipe(rename(path => {
path.basename = getReleaseFilename();
}))
.pipe(gulp.dest('./dist'))
.on('end', resolve);
});
});
gulp.task('redist:windows-nsis:binaries', function () {
var rename = require('gulp-rename');
var builder = require('electron-builder');
const config = getConfig("windows", "nsis");
console.log(`Electron mirror: ${getElectronMirrorUrl()}`);
return builder.build({
targets: builder.Platform.WINDOWS.createTarget(["nsis"], builder.Arch.ia32),
config,
prepackaged: './dist/win-ia32-unpacked'
}).then((filenames) => {
return gulp.src(filenames, { allowEmpty: true })
.pipe(rename(function (path) {
path.basename = setReleaseFilename(path.basename, {
replaceWhitespace: true
});
}))
.pipe(gulp.dest('./dist'));
}).then(() => {
// Wait for the files to be written to disk and closed.
return delay(10000);
});
});
gulp.task('package', async () => {
const { getElectronMirrorUrl, getConfig, getReleaseFilename } = common;
const rename = require('gulp-rename');
const builder = require('electron-builder');
const config = getConfig('linux');
console.log(`Electron mirror: ${getElectronMirrorUrl(getReleaseFilename)}`);
// create build artifacts
const filenames = await builder.build({
targets: builder.Platform.LINUX.createTarget(['deb', 'AppImage'], builder.Arch.ia32),
config
});
// rename and move the files to the /dist/ directory
await new Promise(resolve => {
gulp
.src(filenames, { allowEmpty: true })
.pipe(rename(path => {
path.basename = getReleaseFilename();
}))
.pipe(gulp.dest('./dist'))
.on('end', resolve);
});
});
gulp.task('package:linux', function () {
var rename = require('gulp-rename');
var builder = require('electron-builder');
const config = getConfig("linux");
console.log(`Electron mirror: ${getElectronMirrorUrl()}`);
return builder.build({
targets: builder.Platform.LINUX.createTarget(["deb", "AppImage"], builder.Arch.ia32, builder.Arch.x64),
config
}).then((filenames) => {
return gulp.src(filenames, { allowEmpty: true })
.pipe(rename(function (path) {
path.basename = setReleaseFilename(path.basename, {
replaceWhitespace: true
});
}))
.pipe(gulp.dest('./dist'));
}).then(() => {
// Wait for the files to be written to disk and closed.
return delay(10000);
});
});
gulp.task('redist:linux', function () {
var rename = require('gulp-rename');
var builder = require('electron-builder');
const config = getConfig("linux");
console.log(`Electron mirror: ${getElectronMirrorUrl()}`);
return builder.build({
targets: builder.Platform.LINUX.createTarget(["deb", "AppImage"], builder.Arch.ia32, builder.Arch.x64),
config,
prepackaged: './dist/linux-unpacked'
}).then((filenames) => {
return gulp.src(filenames, { allowEmpty: true })
.pipe(rename(function (path) {
path.basename = setReleaseFilename(path.basename, {
replaceWhitespace: true
});
}))
.pipe(gulp.dest('./dist'));
}).then(() => {
// Wait for the files to be written to disk and closed.
return delay(10000);
});
});
gulp.task('stage', async () => {
const { getConfig, getElectronMirrorUrl } = common;
const builder = require('electron-builder');
const config = getConfig('windows', 'dir');
console.log(`Electron mirror: ${getElectronMirrorUrl()}`);
// create build artifacts
await builder.build({
targets: builder.Platform.WINDOWS.createTarget(['dir'], builder.Arch.ia32, builder.Arch.x64),
config
});
});
gulp.task('package:windows-squirrel', function () {
var rename = require('gulp-rename');
var builder = require('electron-builder');
const config = getConfig("windows", "squirrel");
console.log(`Electron mirror: ${getElectronMirrorUrl()}`);
return builder.build({
targets: builder.Platform.WINDOWS.createTarget(["squirrel"], builder.Arch.x64),
config
}).then((filenames) => {
return gulp.src(filenames, { allowEmpty: true })
.pipe(rename(function (path) {
path.basename = setReleaseFilename(path.basename, {
lowerCase: false,
replaceName: true,
replaceWhitespace: true,
srcName: config.productName,
dstName: config.squirrelWindows.name
});
}))
.pipe(gulp.dest('./dist'));
}).then(() => {
// Wait for the files to be written to disk and closed.
return delay(10000);
gulp.task('package:windows-nsis:binaries', function () {
var rename = require('gulp-rename');
var builder = require('electron-builder');
const config = getConfig("windows", "nsis");
console.log(`Electron mirror: ${getElectronMirrorUrl()}`);
return builder.build({
targets: builder.Platform.WINDOWS.createTarget(["nsis"], builder.Arch.ia32, builder.Arch.x64),
config
}).then((filenames) => {
return gulp.src(filenames, { allowEmpty: true })
.pipe(rename(function (path) {
path.basename = setReleaseFilename(path.basename, {
replaceWhitespace: true
});
}))
.pipe(gulp.dest('./dist'));
}).then(() => {
// Wait for the files to be written to disk and closed.
return delay(10000);
});
});
const builder = require("electron-builder");
const fs = require('fs');
const os = process.platform;
const Platform = builder.Platform
const Arch = builder.Arch
const targets = new Map();
const archToType = new Map();
const pref = {
productName: "TheDesk",
appId: "top.thedesk",
asarUnpack: [
"node_modules/itunes-nowplaying-mac"
],
directories: {
output: "../build/"
},
win: {
icon: "build/thedesk.ico",
target: [
"nsis",
"portable",