Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function buildLinuxWrapper(
builderConfig: electronBuilder.Configuration,
linuxConfig: LinuxConfig,
packageJsonPath: string,
wireJsonPath: string,
envFilePath: string,
): Promise {
const wireJsonResolved = path.resolve(wireJsonPath);
const packageJsonResolved = path.resolve(packageJsonPath);
const envFileResolved = path.resolve(envFilePath);
const {commonConfig} = await getCommonConfig(envFileResolved, wireJsonResolved);
const targets = electronBuilder.Platform.LINUX.createTarget(
linuxConfig.targets,
electronBuilder.archFromString('x64'),
);
logger.info(
`Building ${commonConfig.name} ${commonConfig.version} for Linux (target${
linuxConfig.targets.length === 1 ? '' : 's'
}: ${linuxConfig.targets.join(', ')}) ...`,
);
const backup = await backupFiles([packageJsonResolved, wireJsonResolved]);
const packageJsonContent = await fs.readJson(packageJsonResolved);
await fs.writeJson(
packageJsonResolved,
{...packageJsonContent, productName: commonConfig.name, version: commonConfig.version},
{spaces: 2},
);
grunt.registerMultiTask('electronbuilder', 'Build Electron apps', function() {
const options = this.options();
const {arch, targets} = options;
delete options.targets;
delete options.arch;
const done = this.async();
electronBuilder
.build({
config: options,
targets: electronBuilder.Platform.LINUX.createTarget(targets, electronBuilder.archFromString(arch)),
})
.then(done, done);
});