{"id":20156281,"url":"https://github.com/web-infra-dev/napi-template","last_synced_at":"2025-04-09T22:23:46.387Z","repository":{"id":44921257,"uuid":"444358681","full_name":"web-infra-dev/napi-template","owner":"web-infra-dev","description":"Template for generating rust-based native projects","archived":false,"fork":false,"pushed_at":"2022-01-18T19:18:44.000Z","size":71,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-23T13:02:22.905Z","etag":null,"topics":["napi-rs","rust","templates","wasm-bindgen"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/web-infra-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-04T09:26:03.000Z","updated_at":"2024-06-03T05:18:00.000Z","dependencies_parsed_at":"2022-09-16T12:41:08.928Z","dependency_job_id":null,"html_url":"https://github.com/web-infra-dev/napi-template","commit_stats":null,"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-infra-dev%2Fnapi-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-infra-dev%2Fnapi-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-infra-dev%2Fnapi-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/web-infra-dev%2Fnapi-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/web-infra-dev","download_url":"https://codeload.github.com/web-infra-dev/napi-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248120959,"owners_count":21051059,"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":["napi-rs","rust","templates","wasm-bindgen"],"created_at":"2024-11-13T23:38:15.974Z","updated_at":"2025-04-09T22:23:46.343Z","avatar_url":"https://github.com/web-infra-dev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr /\u003e\n\n\u003ch1 align=\"center\"\u003eSpeedy NAPI-RS template\u003c/h1\u003e\n\n## Use this template\n\nClick `use this template` above, then find and replace `speedy-sourcemap` to your desired naming.\n\n## Setup Rust toolchain\n\nThis project uses [Rust](https://www.rust-lang.org/) and [NAPI-RS](https://github.com/napi-rs/napi-rs), so you can install it with:\n\n```bash\n# Install Rust toolchain on MacOS, Linux.\n# For Windows users, you may refer to the website listed above and install the corresponding `.exe`.\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\nThis command will install the latest stable version of Rust standard library, Cargo and other toolchain.\n\nThis project is also using Rust 2021, for those developers who have already installed Rust, you may update your toolchain to the latest stable version, which you can update it as follows:\n\n```bash\nrustup update stable\n```\n\nFor more information about the setup, please heads to [Rust](https://www.rust-lang.org/) and [NAPI-RS](https://github.com/napi-rs/napi-rs)\n\n## Setup Node.js\n\nPnpm is required for handling node modules, also pnpm workspace is enabled for the project, so you can install node modules with:\n\n```bash\nnpm install -g pnpm\n\npnpm install # Install all node modules in the workspace\n```\n\n## Setup WebAssembly\n\n```bash\ncurl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh\n```\n\nNote: for Apple Silicons, you need to use `cargo install wasm-pack` to install wasm-pack\n\n## Repo Structure\n\n```\n.\n├── Cargo.lock\n├── Cargo.toml\n├── README.md\n├── benchmark # Your benchmark goes here\n├── core\n│   └── your_native_repo_goes_here # Your native repo goes here\n├── node\n│   ├── Cargo.toml\n│   ├── __tests__\n│   │   └── unit.spec.ts\n│   ├── binding.js\n│   ├── build.rs\n│   ├── index.d.ts\n│   ├── npm # This package is not intended for editing\n│   ├── package.json\n│   ├── src\n│   │   ├── lib.rs\n│   │   ├── test.rs\n│   │   └── types.rs\n│   └── tsconfig.json\n├── wasm # Your wasm binding goes here\n├── package.json\n├── pnpm-workspace.yaml\n└── rustfmt.toml # This file is not intended for editing\n```\n\nThis project is also using Cargo workspaces for managing multiple crates.\n\n## Development\n\n**Build Node bindings**\n\n```bash\n# This will only build the unoptimized version for testing\n# , which is hugely useful when testing projects with heavy dependencies.\npnpm build:debug --dir node\n\n# Regular optimized build\npnpm build --dir node\n```\n\n**Build WebAssembly bindings**\n\n```bash\npnpm build:wasm\n```\n\n## Testing\n\n**Rust**\n\n```bash\ncargo test # This will test the whole cargo workspaces, and workspace members are declared in the \u003cproject-root\u003e/Cargo.toml\n```\n\n**Node**\n\n```bash\npnpm test # This will run tests under the `node` and `wasm` directory\n```\n\n## Publishing\n\n**Rust(Cargo)**\n\n```bash\ncargo publish\n```\n\n**Node**\n\nNode addons are divided into difference npm packages for different platforms and architectures, which you can find [here](./node/npm) and this is not intended to be edited manually.\n\n```bash\n# Create a new npm release\ncd node\nnpm version\n```\n\nMake sure you have your commit message starts with `chore(release): publish`, and CI will automatically publish the release.\nFor more details please refer to [CI.yaml](.github/workflows/CI.yaml)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb-infra-dev%2Fnapi-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweb-infra-dev%2Fnapi-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweb-infra-dev%2Fnapi-template/lists"}