Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eyhn/napi-cs
https://github.com/eyhn/napi-cs
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/eyhn/napi-cs
- Owner: EYHN
- License: mit
- Created: 2021-09-23T03:44:52.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-11-29T06:40:53.000Z (almost 3 years ago)
- Last Synced: 2024-03-04T18:50:07.812Z (9 months ago)
- Language: C#
- Size: 141 KB
- Stars: 15
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> This project is still in the early stages of development. All code, interfaces and features are unstable.
# napi-cs
> Inspired by [napi-rs](https://github.com/napi-rs/napi-rs).
Experimental tool chain for build NodeJS modules with .NET 6.0 and C#.
`napi-cs` will compile your modules into a native (architecture specific) shared library with [Native AOT](https://github.com/dotnet/runtimelab/tree/feature/NativeAOT), modules can be safely distributed without .NET installation.
![](./screenshot.png)
## Getting Started
0. Pre-requisites
* The latest version of [.NET 6.0](https://dotnet.microsoft.com/download/dotnet/6.0).
* c++ toolchain in your system, see more detail here [Pre-requisites for Native AOT](https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/prerequisites.md)1. Install Templates
``` bash
$ dotnet new -i NApi.Template
```2. Create Project
``` bash
$ mkdir foo && cd foo
$ dotnet new nodejs
```3. Build
``` bash
$ dotnet build
```4. Test Your Module
``` bash
$ node
> require("./bin/Debug/net6.0/osx-x64/publish/module.node")
```> PS: Replace `osx-x64` with your operating system
## Limitations
* Only support x64 Windows, Linux, MacOS.
* [Limitations of Native AOT Runtime](https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/limitations.md)> [TODO] CoreCLR Mode: No above limitations, but it depends on .NET installation at runtime