-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtemplate.ts
More file actions
58 lines (47 loc) · 842 Bytes
/
template.ts
File metadata and controls
58 lines (47 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
export function cargoTomlTemplate(projectName: string) {
return `
[package]
name = ${projectName}
version = "1.0.0"
edition = "2021"
license = "MIT"
[lib]
crate-type = ["cdylib"]
[dependencies.napi]
version = "3.1"
default-features = false
# see https://nodejs.org/api/n-api.html#node-api-version-matrix
features = ["napi4"]
[dependencies.napi-derive]
version = "3.1"
features = ["type-def"]
[build-dependencies]
napi-build = "2"
[profile.release]
lto = true
codegen-units = 1
strip = "symbols"
opt-level = "z"
panic = "abort"
`;
}
export const GIT_IGNORE_TEMPLATE = `
target
Cargo.lock
*.xcframework/
*.apple.node/
*.android.node/
dist
`;
export const BUILD_RS_TEMPLATE = `
fn main() {
napi_build::setup();
}
`;
export const LIB_RS_TEMPLATE = `
use napi_derive::napi;
#[napi]
pub fn sum(a: i32, b: i32) -> i32 {
a + b
}
`;