File tree Expand file tree Collapse file tree 2 files changed +58
-0
lines changed
Expand file tree Collapse file tree 2 files changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ export function cargoTomlTemplate ( projectName : string ) {
2+ return `
3+ [package]
4+ name = ${ projectName }
5+ version = "1.0.0"
6+ edition = "2021"
7+ license = "MIT"
8+
9+ [lib]
10+ crate-type = ["cdylib"]
11+
12+ [dependencies.napi]
13+ version = "3.1"
14+ default-features = false
15+ # see https://nodejs.org/api/n-api.html#node-api-version-matrix
16+ features = ["napi4"]
17+
18+ [dependencies.napi-derive]
19+ version = "3.1"
20+ features = ["type-def"]
21+
22+ [build-dependencies]
23+ napi-build = "2"
24+
25+ [profile.release]
26+ lto = true
27+ codegen-units = 1
28+ strip = "symbols"
29+ opt-level = "z"
30+ panic = "abort"
31+ ` ;
32+ }
33+
34+ export const GIT_IGNORE_TEMPLATE = `
35+ target
36+ Cargo.lock
37+
38+ *.xcframework/
39+ *.apple.node/
40+ *.android.node/
41+
42+ dist
43+ ` ;
44+
45+ export const BUILD_RS_TEMPLATE = `
46+ fn main() {
47+ napi_build::setup();
48+ }
49+ ` ;
50+
51+ export const LIB_RS_TEMPLATE = `
52+ use napi_derive::napi;
53+
54+ #[napi]
55+ pub fn sum(a: i32, b: i32) -> i32 {
56+ a + b
57+ }
58+ ` ;
You can’t perform that action at this time.
0 commit comments