Coder Social home page Coder Social logo

facetdigital / electron-edge-js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from agracio/electron-edge-js

0.0 1.0 0.0 5.53 MB

Run .NET and Node.js code in-process on Windows, MacOS, and Linux

Python 1.26% Batchfile 0.21% C# 10.07% JavaScript 2.00% C++ 85.90% C 0.46% VBScript 0.11%

electron-edge-js's Introduction

.NET and Node.js in-process on Electron

This is a fork of edge-js adapted to support Electron.

Compatible with

- Electron 10.x - Node.js v12.16.3
- Electron 10.x - Node.js v15.0.1

Usage is the same as edge or edge-js, replace require('edge') or require('edge-js') with require('electron-edge-js'):

```bash
npm install electron-edge-js
```

```diff
-var edge = require('edge-js');
+var edge = require('electron-edge-js');

var helloWorld = edge.func(function () {/*
    async (input) => {
        return ".NET Welcomes " + input.ToString();
    }
*/});
```

Requirements

Windows Only

You must install Microsoft Visual C++ Redistributable (x86)

All Platforms

NOTE: Make sure the 3.1 SDK is the latest SDK on your machine. If you have a newer version, i.e. 5.0, you may run into build and/or runtime issues. NOTE: If you want to build for a specific version of NodeJS, you must have that version of Node installed on your computer.

Why use electron-edge-js

Electron is built using specific version of Node.js. In order to use edge in Electron project you would need to recompile it using the same Node.js version and Electron headers.

electron-edge-js comes precompiled with correct Node.js versions and headers.

Differences from electron-edge

  • Uses same codebase as edge-js that comes with both latest code changes from edge project and additional fixes and improvements available in edge-js project.
  • Supports majority of Electron versions.

Quick start

Simple app that shows how to work with .NET Core using compiled C# libraries. electron-edge-js-quick-start

Documentation

For full documentation please see see original edge-js repo.

Add new Node Version

  1. Update the Readme.md file with the latest version being used. Doing a find/replace of the current version is the easist way to ensure all documentation is updated.
  2. Open up the lib/edge.js file and go to the versionMap array which should start around line 15. Add the latest Node version to the array.
  3. Open up the tools/buildall.bat file and add the latest node version to the end of the prior release listed on line 2. For example, if you added 15.0.2 it would look like this: "%~dp0\build.bat" release 12.16.3 15.0.1 15.0.2

Building

To build the app for the latest Node version, 15.0.1 as of 2020-10-28, with Electron version 10.1.5, enter the following command in the base directory of the application:

node-gyp configure build --target=v10.1.5 --dist-url=https://electronjs.org/headers -v15.0.1

Changing Electron Version

When you build the application, set the --target argument in the command to be the Electron version you want to build for. For example, to build for Electron 11.0.0 you would change the build command to be as follows:

node-gyp configure build --target=v11.0.0 --dist-url=https://electronjs.org/headers -v15.0.1

Publish as Github Package

  1. Open up a terminal to the root directory of this project

  2. Run the build command above from the Building section. If the build succeeds, move on to the next step.

  3. Enter the following command to publish the package:

    yarn publish

    If you do not have yarn installed, use npm

    npm publish
  4. Follow the prompts to publish the package

  5. Commit the package.json file if you updated the package version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.