Skip to content

Commit b6ca591

Browse files
chore: Bundle all source files together
1 parent 4ccdb9f commit b6ca591

File tree

7 files changed

+44
-47
lines changed

7 files changed

+44
-47
lines changed

libs/core/artifacts/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

libs/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"url": "https://github.com/kevinmichaelchen/cel-typescript/issues"
1515
},
1616
"homepage": "https://github.com/kevinmichaelchen/cel-typescript#readme",
17-
"files": ["dist/artifacts/**", "dist/src/**"],
17+
"files": ["dist/src/**"],
1818
"keywords": [
1919
"cel",
2020
"common-expression-language",

libs/core/project.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
"command": "bash {projectRoot}/scripts/build.sh {args.target}"
1010
},
1111
"outputs": [
12-
"{projectRoot}/artifacts/cel-typescript.darwin-arm64.node",
13-
"{projectRoot}/artifacts/cel-typescript.darwin-x64.node",
14-
"{projectRoot}/artifacts/cel-typescript.linux-x64-gnu.node",
15-
"{projectRoot}/artifacts/cel-typescript.linux-arm64-gnu.node",
16-
"{projectRoot}/artifacts/cel-typescript.win32-x64-msvc.node"
12+
"{projectRoot}/cel-typescript.darwin-arm64.node",
13+
"{projectRoot}/cel-typescript.darwin-x64.node",
14+
"{projectRoot}/cel-typescript.linux-x64-gnu.node",
15+
"{projectRoot}/cel-typescript.linux-arm64-gnu.node",
16+
"{projectRoot}/cel-typescript.win32-x64-msvc.node",
17+
"{projectRoot}/src/native.cjs",
18+
"{projectRoot}/src/native.d.ts"
1719
]
1820
},
1921
"build:ts": {
@@ -35,7 +37,6 @@
3537
"commands": [
3638
"rm -rf {projectRoot}/dist",
3739
"rm -f {projectRoot}/*.node",
38-
"rm -f {projectRoot}/artifacts/*.node",
3940
"rm -rf {projectRoot}/@kevinmichaelchen"
4041
],
4142
"parallel": false

libs/core/scripts/build.sh

Lines changed: 35 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,47 @@ set -e
55
# Change directories to where the script lives
66
cd libs/core
77

8-
mkdir -p artifacts
9-
108
if [ "$USE_ZIG" = "true" ]; then
119
npx @napi-rs/cli build --platform --target "$1" --release --zig \
12-
--js artifacts/native.cjs \
13-
--dts artifacts/native.d.ts \
10+
--js src/native.cjs \
11+
--dts src/native.d.ts \
1412
--js-package-name @kevinmichaelchen/cel-typescript
1513
else
1614
npx @napi-rs/cli build --platform --target "$1" --release \
17-
--js artifacts/native.cjs \
18-
--dts artifacts/native.d.ts \
15+
--js src/native.cjs \
16+
--dts src/native.d.ts \
1917
--js-package-name @kevinmichaelchen/cel-typescript
2018
fi
2119

22-
# For local development, copy the binary to artifacts so tests can find them locally
23-
cp *.node artifacts
24-
2520
# Copy binaries to their respective platform package directories
26-
if [[ "$1" == "aarch64-apple-darwin" ]]; then
27-
mkdir -p ../darwin-arm64
28-
cp cel-typescript.darwin-arm64.node ../darwin-arm64/
29-
echo "Copied binary to darwin-arm64 package"
30-
fi
31-
32-
if [[ "$1" == "x86_64-apple-darwin" ]]; then
33-
mkdir -p ../darwin-x64
34-
cp cel-typescript.darwin-x64.node ../darwin-x64/
35-
echo "Copied binary to darwin-x64 package"
36-
fi
37-
38-
if [[ "$1" == "x86_64-unknown-linux-gnu" ]]; then
39-
mkdir -p ../linux-x64-gnu
40-
cp cel-typescript.linux-x64-gnu.node ../linux-x64-gnu/
41-
echo "Copied binary to linux-x64-gnu package"
42-
fi
43-
44-
if [[ "$1" == "aarch64-unknown-linux-gnu" ]]; then
45-
mkdir -p ../linux-arm64-gnu
46-
cp cel-typescript.linux-arm64-gnu.node ../linux-arm64-gnu/
47-
echo "Copied binary to linux-arm64-gnu package"
48-
fi
49-
50-
if [[ "$1" == "x86_64-pc-windows-msvc" ]]; then
51-
mkdir -p ../win32-x64-msvc
52-
cp cel-typescript.win32-x64-msvc.node ../win32-x64-msvc/
53-
echo "Copied binary to win32-x64-msvc package"
54-
fi
21+
# Find all .node files in the current directory
22+
echo "******************************************"
23+
echo "DEBUG: Current directory: $(pwd)"
24+
echo "DEBUG: Files in current directory:"
25+
ls -la *.node || echo "No .node files found"
26+
echo "DEBUG: Attempting to copy platform binaries..."
27+
echo "******************************************"
28+
29+
for binary in cel-typescript.*.node; do
30+
if [ -f "$binary" ]; then
31+
# Extract the platform identifier (everything between 'cel-typescript.' and '.node')
32+
platform=$(echo "$binary" | sed -E 's/cel-typescript\.(.+)\.node/\1/')
33+
34+
# Create target directory if it doesn't exist
35+
mkdir -p "../$platform"
36+
37+
# Copy binary to the platform directory
38+
cp "$binary" "../$platform/"
39+
40+
echo "******************************************"
41+
echo "SUCCESS: Copied $binary to ../$platform/"
42+
echo "******************************************"
43+
else
44+
echo "WARNING: Pattern matched $binary but it's not a file"
45+
fi
46+
done
47+
48+
echo "******************************************"
49+
echo "DEBUG: Platform packages after copying:"
50+
ls -la ../*/cel-typescript.*.node || echo "No platform binaries found in packages"
51+
echo "******************************************"

libs/core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CelProgram {
3636
if (!CelProgram.nativeModule) {
3737
// Use the NAPI-RS generated loader which handles platform detection
3838
const require = createRequire(import.meta.url);
39-
const nativeBinding = require("../artifacts/native.cjs");
39+
const nativeBinding = require("./native.cjs");
4040
CelProgram.nativeModule = nativeBinding.CelProgram;
4141
console.log("Imported native CelProgram:", CelProgram.nativeModule);
4242
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)