Skip to content

Commit f8ec00d

Browse files
chore: Fixed build:native command
1 parent cb2d355 commit f8ec00d

File tree

4 files changed

+44
-19
lines changed

4 files changed

+44
-19
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ This project consists of three main components:
1919

2020
3. **TypeScript Wrapper**: A TypeScript API that provides a clean interface to the native module, handling type conversions and providing a more idiomatic JavaScript experience.
2121

22+
## Native Module Structure
23+
24+
The native module is built using NAPI-RS and follows its naming convention:
25+
26+
- Platform-specific builds are named `cel-typescript.<platform>-<arch>.node` (e.g., `cel-typescript.darwin-arm64.node` for Apple Silicon Macs)
27+
- During build and installation, NAPI-RS automatically creates an `index.node` symlink pointing to the appropriate platform-specific build
28+
- This structure allows for cross-platform distribution while maintaining platform-specific optimizations
29+
- The symlink is managed by NAPI-RS and will be different for each contributor based on their platform
30+
31+
2232
## How it Works
2333

2434
When you build this project:

nx.json

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,44 @@
55
"build:native": {
66
"cache": true,
77
"inputs": [
8-
"src/**/*",
9-
"Cargo.toml",
10-
"Cargo.lock"
8+
"{projectRoot}/src/**/*",
9+
"{projectRoot}/Cargo.toml",
10+
"{projectRoot}/Cargo.lock"
1111
],
12-
"outputs": ["target/**/*"]
12+
"outputs": ["{workspaceRoot}/cel-typescript.*.node"]
1313
},
1414
"build:ts": {
1515
"cache": true,
1616
"inputs": [
17-
"src/**/*.ts",
18-
"tsconfig.json",
19-
"package.json"
17+
"{projectRoot}/src/**/*.ts",
18+
"{projectRoot}/tsconfig.json",
19+
"{workspaceRoot}/package.json"
2020
],
21-
"outputs": ["dist/**/*"]
21+
"outputs": ["{workspaceRoot}/dist/**/*"]
2222
},
2323
"test": {
2424
"cache": true,
2525
"inputs": [
26-
"__tests__/**/*",
27-
"src/**/*",
28-
"vitest.config.ts",
26+
"{projectRoot}/__tests__/**/*",
27+
"{projectRoot}/src/**/*",
28+
"{projectRoot}/vitest.config.ts",
29+
"{projectRoot}/Cargo.toml",
30+
"{projectRoot}/build.rs",
2931
"{workspaceRoot}/package.json"
3032
]
3133
},
3234
"format": {
3335
"cache": true,
3436
"inputs": [
35-
"**/*.{ts,tsx,js,jsx,json,md}",
36-
"biome.json"
37+
"{projectRoot}/**/*.{ts,tsx,js,jsx,json,md}",
38+
"{projectRoot}/biome.json"
3739
]
3840
},
3941
"lint": {
4042
"cache": true,
4143
"inputs": [
42-
"**/*.{ts,tsx,js,jsx}",
43-
"biome.json"
44+
"{projectRoot}/**/*.{ts,tsx,js,jsx}",
45+
"{projectRoot}/biome.json"
4446
]
4547
}
4648
},

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"lint": "nx lint",
2525
"check": "nx check",
2626
"build": "nx build",
27-
"test": "nx test"
27+
"test": "nx test",
28+
"clean": "nx clean"
2829
},
2930
"devDependencies": {
3031
"@biomejs/biome": "^1.9.4",

project.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,31 @@
55
"build:native": {
66
"executor": "nx:run-commands",
77
"options": {
8-
"command": "napi build --platform"
9-
}
8+
"command": "npx @napi-rs/cli build --platform"
9+
},
10+
"outputs": ["{workspaceRoot}/cel-typescript.darwin-arm64.node", "{workspaceRoot}/cel-typescript.darwin-x64.node", "{workspaceRoot}/cel-typescript.linux-x64-gnu.node", "{workspaceRoot}/cel-typescript.win32-x64-msvc.node"]
1011
},
1112
"build:ts": {
1213
"executor": "nx:run-commands",
1314
"options": {
1415
"command": "tsc"
15-
}
16+
},
17+
"outputs": ["{workspaceRoot}/dist/**/*"]
1618
},
1719
"build": {
1820
"executor": "nx:noop",
1921
"dependsOn": ["build:native", "build:ts"]
2022
},
23+
"clean": {
24+
"executor": "nx:run-commands",
25+
"options": {
26+
"commands": [
27+
"rm -rf dist",
28+
"rm -f *.node"
29+
],
30+
"parallel": false
31+
}
32+
},
2133
"test": {
2234
"executor": "nx:run-commands",
2335
"options": {

0 commit comments

Comments
 (0)