How to use the electron-builder.build function in electron-builder

To help you get started, we’ve selected a few electron-builder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BenjaminDobler / ngtron / builders / package / index_1.js View on Github external
let result;
        try {
            result = yield server.result;
        }
        catch (error) {
            context.reportStatus("Error: " + error);
        }
        // Copy electron main
        const fromMain = path_1.join(context.workspaceRoot, options.electronMain);
        const toMain = path_1.join(result.outputPath, path_1.basename(options.electronMain));
        fs_1.copyFileSync(fromMain, toMain);
        // write electron package to dist
        fs_1.writeFileSync(path_1.join(result.outputPath, "package.json"), JSON.stringify(options.electronPackage), { encoding: "utf-8" });
        // Build!
        try {
            yield builder.build(options.packagerConfig);
        }
        catch (e) {
            console.log("Publish error", e);
        }
        return {
            success: true
        };
    });
}
github ubports / ubports-installer / build.js View on Github external
var build = () => {
  // Build
  if (!cli.downloadOnly) {
    builder
      .build({
        targets: builder.createTargets([targetOs]),
        config: Object.assign(buildConfig, {
          extraMetadata: cli.package
            ? Object.assign(cli.extraMetadata, { package: cli.package })
            : cli.extraMetadata
        })
      })
      .then(() => {
        console.log("Done");
      })
      .catch(e => {
        if (
          e.message.indexOf("GitHub Personal Access Token is not set") !== -1
        ) {
          console.log("Done");
github ra-gg / Delir / gulpfile.ts View on Github external
await fs.remove(join(paths.build, 'node_modules'))

  await new Promise((resolve, reject) => {
    spawn(yarnBin, ['install'], { cwd: paths.build, stdio: 'inherit' })
      .on('error', err => reject(err))
      .on('close', (code, signal) => (code === 0 ? resolve() : reject(new Error(code))))
  })

  const targets = [
    ...(isMacOS ? [builder.Platform.MAC.createTarget()] : []),
    ...(isWindows ? [builder.Platform.WINDOWS.createTarget()] : []),
    ...(isLinux ? [builder.Platform.LINUX.createTarget()] : []),
  ]

  for (const target of targets) {
    await builder.build({
      // targets: builder.Platform.MAC.createTarget(),
      targets: target,
      config: {
        appId: 'studio.delir',
        copyright: '© 2017 Ragg',
        productName: 'Delir',
        electronVersion,
        asar: true,
        asarUnpack: ['node_modules/'],
        npmRebuild: true,
        // nodeGypRebuild: true,
        directories: {
          buildResources: join(__dirname, 'build-assets/build'),
          app: paths.build,
          output: paths.release,
        },
github redhat-developer-tooling / developer-platform-install / gulp-tasks / dist-darwin.js View on Github external
function buildInstaller(gulp, origin, destination, extraFiles) {
  const builder = require('electron-builder');
  const Platform = builder.Platform;

  // Promise is returned
  return builder.build({
    targets: Platform.MAC.createTarget(),
    config: {
      appId: 'com.redhat.devsuite.installer',
      mac: {
        category: 'public.app-category.developer-tools',
        icon: 'resources/devsuite.icns',
        target: ['dmg'],
        publish: null
      },
      files: '**/*',
      extraFiles,
      directories: {
        app : 'transpiled'
      }
    }
  }).then(() => {
github OpenAcousticDevices / AudioMoth-Configuration-App / builder.js View on Github external
};
    break;
case "mac":
    console.log("Using build configuration to macOS.");
    target = Platform.MAC.createTarget();
    break;
case "linux":
    console.log("Using build configuration to Linux (64-bit).");
    target = Platform.LINUX.createTarget();
    break;
default:
    console.error("ERROR - Build target not recognised. Accepted targets: win, win32, mac, linux.");
    return;
}

builder.build({
    targets: target,
    config: config
}).then(function (m) {
    console.log("Generated files:");
    console.log(m);
}).catch(function (e) {
    console.error(e);
});
github seokju-na / geeks-diary / scripts / package.ts View on Github external
async function build(): Promise {
    console.log('Remove build directory.');
    await remove(BUILD_PATH);

    const packageInfo: PackageInfo = await readJson(
        path.resolve(DIST_PATH, 'package.json'),
        { throws: true },
    );

    console.log('Build started...');
    const buildTargets = {
        mac: os.platform() === 'darwin' ? ['dmg'] : undefined,
        linux: ['snap', 'AppImage'],
        win: ['nsis'],
    };
    await Builder.build({
        config: {
            appId: packageInfo.appId,
            productName: packageInfo.productName,
            buildVersion: packageInfo.version,
            asar: true,
            npmRebuild: false,
            directories: {
                app: DIST_PATH,
                output: BUILD_PATH,
            },
            mac: {
                category: 'public.app-category.developer-tools',
                darkModeSupport: true,
                icon: path.resolve(SRC_PATH, 'assets/logos/icon-logo.icns'),
            },
            appImage: {
github BenjaminDobler / ngtron / builders / util / electron.ts View on Github external
return new Observable(observer => {
    builder.build(config).then(
      () => {
        observer.next({success: true});
        observer.complete();
      },
      e => {
        console.log("Error ", e);
        observer.error();
      }
    );
  });
}
github microsoft / BotFramework-Emulator / packages / app / main / gulpfile.js View on Github external
gulp.task('redist: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,
    prepackaged: './dist/win-ia32-unpacked'
  }).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(() => {
github Zettlr / Zettlr / scripts / build-app.js View on Github external
async function runBuilder () {
  for (let flag of buildTargets) {
    let target
    if (flag === '--mac') target = Platform.MAC.createTarget()
    if (flag === '--win') target = Platform.WINDOWS.createTarget()
    if (flag === '--linux') target = Platform.LINUX.createTarget()
    if (flag === '--app-image') target = Platform.LINUX.createTarget()
    await builder.build({ 'targets': target, 'config': config })
    log.success(`Build for ${flag.substr(2)} complete!`)
  }
}
github willyb321 / media_mate / gulpfile.babel.js View on Github external
gulp.task('build:dist', ['default'], cb => {
	builder.build({
		platform: (isCI === true && process.platform === 'linux' ? ['linux', 'win32'] : process.platform),
		arch: 'x64',
		config: {
			appId: 'com.willyb321.media_mate',
			nsis: {
				oneClick: false,
				allowToChangeInstallationDirectory: true
			},
			mac: {
				category: 'public.app-category.entertainment',
				target: ['zip'],
				publish: [
					"github"
				]
			},
			win: {