Skip to content

A Cake AddIn that extends Cake with Electron.NET command tools.

License

Notifications You must be signed in to change notification settings

Blind-Striker/Cake.Electron.Net

Repository files navigation

Cake.Electron.Net

A Cake AddIn that extends Cake with Electron.NET command tools.

cakebuild.net

Stable Nightly
NuGet MyGet

Continuous integration

Build server Platform Build status
Azure Pipelines Ubuntu Build Status
Azure Pipelines macOs Build Status
Azure Pipelines Windows Build Status

Table of Contents

  1. Requirements To Run
  2. Including Add-in
  3. Usage
  4. License
  5. Important Notes

Requirements To Run

Cake.Electron.Net is depends on ElectronNET.CLI cli tool. Make sure you have installed the ElectronNET.CLI packages as global tool:

    dotnet tool install ElectronNET.CLI -g

Including Add-in

Including add-in in cake script is easy.

    #addin "nuget:?package=Cake.Electron.Net"

Usage

Please see Electron.NET for commands usages.

Commands Supported

  • ElectronNetBuild
  • ElectronNetAdd
  • ElectronNetInit
  • ElectronNetStart
  • ElectronNetVersion

Example

using Cake.Electron.Net
using Cake.Electron.Net.Commands.Settings

Task("Build")
.Does(() => {
    ElectronNetVersion(workingDirectory);

    ElectronNetBuildSettings settings = new ElectronNetBuildSettings();
    settings.WorkingDirectory = workingDirectory;
    settings.ElectronTarget = ElectronTarget.Win;
    settings.DotNetConfig = DotNetConfig.Release;

    ElectronNetBuild(settings);
});

Licenses

Licensed under MIT, see LICENSE for the full text.

Important Notes

ElectronNET.API & ElectronNET.CLI Version 5.22.12

Make sure you also have the new Electron.NET CLI 5.22.12 version. This now uses electron-builder and the necessary configuration to build is made in the electron.manifest.json file. In addition, own Electron.NET configurations are stored. Please make sure that your electron.manifest.json file has the following new structure:

{
  "executable": "{{executable}}",
  "splashscreen": {
    "imageFile": ""
  },
  "singleInstance": false,
  "build": {
    "appId": "com.{{executable}}.app",
    "productName": "{{executable}}",
    "copyright": "Copyright © 2019",
    "buildVersion": "1.0.0",
    "compression": "maximum",
    "directories": {
      "output": "../../../bin/Desktop"
    },
    "extraResources": [
      {
        "from": "./bin",
        "to": "bin",
        "filter": ["**/*"]
      }
    ],
    "files": [
      {
        "from": "./ElectronHostHook/node_modules",
        "to": "ElectronHostHook/node_modules",
        "filter": ["**/*"]
      },
      "**/*"
    ]
  }
}

ElectronNET.CLI Version 0.0.9

In the Version 0.0.9 the CLI was not a global tool and needed to be registred like this in the .csproj:

    <ItemGroup>
         <DotNetCliToolReference Include="ElectronNET.CLI" Version="0.0.9" />
    </ItemGroup>

If you still use this version you will need to install Cake.Electron.Net v0.0.9