{"id":17244062,"url":"https://github.com/agracio/electron-edge-js","last_synced_at":"2025-05-14T21:04:29.821Z","repository":{"id":37742925,"uuid":"102951950","full_name":"agracio/electron-edge-js","owner":"agracio","description":"Run .NET and Node.js code in-process on Windows, MacOS, and Linux using Electron","archived":false,"fork":false,"pushed_at":"2025-05-11T15:23:20.000Z","size":18511,"stargazers_count":372,"open_issues_count":2,"forks_count":93,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-05-11T16:31:59.019Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agracio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["agracio"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2017-09-09T12:04:50.000Z","updated_at":"2025-05-11T15:23:24.000Z","dependencies_parsed_at":"2024-01-03T02:45:07.077Z","dependency_job_id":"e6382690-81d6-4861-9c50-4096dd2959fc","html_url":"https://github.com/agracio/electron-edge-js","commit_stats":{"total_commits":298,"total_committers":20,"mean_commits":14.9,"dds":0.2516778523489933,"last_synced_commit":"9571bc4521eddb6b0cd782df08bdeeb958dd7005"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agracio%2Felectron-edge-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agracio%2Felectron-edge-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agracio%2Felectron-edge-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agracio%2Felectron-edge-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agracio","download_url":"https://codeload.github.com/agracio/electron-edge-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254032144,"owners_count":22002887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T06:17:40.572Z","updated_at":"2025-05-14T21:04:29.781Z","avatar_url":"https://github.com/agracio.png","language":"C++","funding_links":["https://github.com/sponsors/agracio"],"categories":[],"sub_categories":[],"readme":"# .NET and Node.js in-process on Electron\n\n[![Actions Status](https://github.com/agracio/electron-edge-js/workflows/CI/badge.svg)](https://github.com/agracio/electron-edge-js/actions)\n[![Git Issues][issues-img]][issues-url]\n[![Closed Issues][closed-issues-img]][closed-issues-url]\n\u003c!-- [![NPM Downloads][downloads-img]][downloads-url] --\u003e\n\n**This is a fork of [edge-js](https://github.com/agracio/edge-js) adapted to support [Electron](https://github.com/electron/electron/)**\n\n## Version support policy\n\n### Electron officially supports 3 latest released versions. You can read more about Electron release schedule and support here [Electron Releases](https://www.electronjs.org/docs/latest/tutorial/electron-timelines).\n\n### electron-edge-js support policy\n\n- Windows supports 6 latest Electron releases.\n- macOS comes precompiled with 6 latest Electron releases. When using Electron version that is not pre-compiled `electron-edge-js` binaries will be compiled during `npm install` using `node-gyp`.\n- Linux will will always compile `electron-edge-js` binaries during `npm install` using `node-gyp`.\n\n#### NOTE: Due to `nan` module compatibility issues versions prior to **Electron 29** are not supported.\n-----\n\n### Windows supported versions \n\n| Electron             |  x86/x64           | arm64              |\n| -------------------- |  ----------------- | ------------------ |\n| Electron 31.x - 36.x | :heavy_check_mark: | :heavy_check_mark: |\n\n### macOS binaries pre-compiled for \n\n| Electron             |  x64               | arm64              |\n| -------------------- |  ----------------- | ------------------ |\n| Electron 31.x - 36.x | :heavy_check_mark: | :heavy_check_mark: |\n\n**Supports Electron 29.x - 36.x**\n\n### Linux\nOn Linux  `npm install` will compile binaries with correct Electron headers for a given Electron version.\n\n### Linux supported versions\n\n| Electron             | x64                | arm64              |\n| -------------------- | ------------------ | ------------------ |\n| Electron 29.x - 36.x | :heavy_check_mark: | :heavy_check_mark: |\n\nOther Linux architectures might work but have not been tested.\n\n#### Usage is the same as edge-js, replace `require('edge-js')` with `require('electron-edge-js')`:\n\n```bash\nnpm install electron-edge-js\n```\n\n```diff\n-var edge = require('edge-js');\n+var edge = require('electron-edge-js');\n\nvar helloWorld = edge.func(function () {/*\n    async (input) =\u003e {\n        return \".NET Welcomes \" + input.ToString();\n    }\n*/});\n```\n\n## Quick start\n\nSample app that shows how to work with .NET Core using inline code and compiled C# libraries.  \nhttps://github.com/agracio/electron-edge-js-quick-start\n\n## Pre-requisites\n- Windows: [Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version)\n\n## Packaging Electron application\n\n`electron-edge-js` needs to be specified as an external module, some examples  \n\n### webpack\n \n``webpack.config.js ``\n\n```js\nexternals: {\n    'electron-edge-js': 'commonjs2 electron-edge-js',\n},\nnode: {\n    __dirname: true,\n    __filename: true,\n},\n```\n\n### From [#138](https://github.com/agracio/electron-edge-js/issues/138)\n\n``webpack.config.js ``\n\n```js\nexternals: {\n    'electron-edge-js': 'commonjs2 electron-edge-js',\n},\nnode: {\n    __dirname: false,\n    __filename: false,\n},\nextraResources:[\n    \"./node_modules/electron-edge-js/**\",\n]\n```\n\nElectron `main.js` \n\n```js\n// https://github.com/ScottJMarshall/electron-webpack-module-resolution\nrequire(\"module\").globalPaths.push(process.cwd()+'/node_modules');\nvar edge = require('electron-edge-js');\n```\n\n### Vue.js\n\n``vue.config.js``\n\n```js\nmodule.export = {\n    pluginOptions: {\n        electronBuilder: {\n            externals:[\"electron-edge-js\"]\n        }\n    }\n}\n```  \n \nRelated issues to use for troubleshooting:  \nhttps://github.com/agracio/electron-edge-js/issues/39  \nhttps://github.com/agracio/electron-edge-js/issues/74  \nhttps://github.com/agracio/electron-edge-js/issues/21  \nhttps://github.com/agracio/electron-edge-js/issues/138\n\n## electron-builder\n\n`electron-edge-js` should be excluded from rebuild.\n\n## electron-forge\n\nelectron-forge example based on `electron-edge-js-quick-start`  \nhttps://github.com/agracio/electron-edge-js-quick-start-forge\n\n## Async execution\n\nIf `electron-edge-js` module is used on main Electron thread it will cause Electron app to freeze when executing long-running .NET code even if your C# code is fully async.  \nTo avoid this you can use worker thread packages such as **[threads.js](https://www.npmjs.com/package/threads)** or **[piscina](https://www.npmjs.com/package/piscina)**  \n\n\nThis issue is not present when using Electron [IPC](https://www.electronjs.org/docs/latest/tutorial/ipc)\n\n### Workaround from [#97]( https://github.com/agracio/electron-edge-js/issues/97)\n\n`main.js`\n```js\nconst { fork } = require(\"child_process\"); fork(\"../child.js\", [], { env: {file: 'filename'}, })\n```\n\n`child.js`\n```js\nconst path = require('path');\nconst powerpoint = require('office-script').powerpoint;\nconst filePath = '../../directory/';\n\npowerpoint.open(path.join(${remotePath}${process.env.file}.pptx), function(err) {\n    if(err) throw err;\n});\n```\n\n## Window refresh issue\n\nIf `electron-edge-js` module is used on main Electron thread refreshing the window (F5, Ctrl+R, Command+R etc) will cause a hard crash in `electron-edge-js` module and Electron app.  \nCurrently there is no solution to this issue other than using Electron [IPC](https://www.electronjs.org/docs/latest/tutorial/ipc).\n\n## Documentation\n\nFor full documentation see [edge-js](https://github.com/agracio/edge-js) repo.\n\n[issues-img]: https://img.shields.io/github/issues-raw/agracio/electron-edge-js.svg?style=flat-square\n[issues-url]: https://github.com/agracio/electron-edge-js/issues\n[closed-issues-img]: https://img.shields.io/github/issues-closed-raw/agracio/electron-edge-js.svg?style=flat-square\u0026color=brightgreen\n[closed-issues-url]: https://github.com/agracio/electron-edge-js/issues?q=is%3Aissue+is%3Aclosed\n\n[downloads-img]: https://img.shields.io/npm/d18m/electron-edge-js.svg?style=flat-square\n[downloads-url]: https://img.shields.io/npm/d18m/electron-edge-js.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagracio%2Felectron-edge-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagracio%2Felectron-edge-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagracio%2Felectron-edge-js/lists"}