napi-rs/cli/src/new/cargo.ts
2021-11-19 18:22:40 +08:00

19 lines
513 B
TypeScript

export const createCargoContent = (name: string) => `[package]
edition = "2021"
name = "${name.replace('@', '').replace('/', '_').toLowerCase()}"
version = "0.0.0"
[lib]
crate-type = ["cdylib"]
[dependencies]
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "NAPI_VERSION", default-features = false, features = ["napi4"] }
napi-derive = "NAPI_DERIVE_VERSION"
[build-dependencies]
napi-build = "NAPI_BUILD_VERSION"
[profile.release]
lto = true
`