commit 06a49f0ec3e3e8786fd0231a695bbc3ce717476a
parent 9fad772f7da1e690bda14c89383b4275dbd22b6c
Author: triesap <tyson@radroots.org>
Date: Thu, 1 May 2025 01:43:26 +0000
workspace: add `bindings` tsconfig.json and edit module build scripts
Diffstat:
5 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,5 +1,6 @@
/target
node_modules
+dist
.turbo
justfile
notes*.txt
diff --git a/bindings/ts/build.sh b/bindings/ts/build.sh
@@ -1,15 +0,0 @@
-generate_index() {
- local output_file="index.ts"
- echo "// Generated index.ts" > "$output_file"
-
- for file in ./*.ts; do
- filename=$(basename "$file" .ts)
- if [[ "$filename" != "index" ]]; then
- echo "export * from './$filename';" >> "$output_file"
- fi
- done
-}
-
-generate() {
- generate_index
-}
diff --git a/bindings/ts/package.json b/bindings/ts/package.json
@@ -1,15 +1,28 @@
{
"name": "@radroots/radroots-common-bindings",
"version": "1.0.0",
+ "private": true,
+ "license": "AGPLv3",
+ "type": "module",
+ "module": "index.ts",
"main": "index.ts",
"types": "index.ts",
"sideEffects": false,
- "license": "AGPLv3",
"scripts": {
- "prebuild": "ts-to-zod types.ts schema.ts",
- "build": "source build.sh && generate"
+ "gen:index": "echo \"// Generated @radroots/radroots-common-bindings\" > index.ts && for f in *.ts; do fn=$(basename \"$f\" .ts); [ \"$fn\" != \"index\" ] && echo \"export * from './$fn';\" >> index.ts; done",
+ "gen:schema": "ts-to-zod types.ts schema.ts",
+ "gen:types": "command -v typeshare >/dev/null && typeshare ../../src --lang=typescript --output-file=types.ts || echo 'Skipping typeshare (not installed)'",
+ "prebuild": "npm run gen:types && npm run gen:schema",
+ "build": "tsc",
+ "postbuild": "npm run gen:index"
},
"devDependencies": {
"ts-to-zod": "^3.15.0"
+ },
+ "dependencies": {
+ "zod": "^3.23.8"
+ },
+ "publishConfig": {
+ "access": "public"
}
}
\ No newline at end of file
diff --git a/bindings/ts/tsconfig.json b/bindings/ts/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "strict": true,
+ "target": "es2021",
+ "lib": [
+ "es2021",
+ "dom"
+ ],
+ "module": "CommonJS",
+ "outDir": "./dist",
+ "rootDir": ".",
+ "declaration": true,
+ "emitDeclarationOnly": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true
+ },
+ "include": [
+ "index.ts",
+ "schema.ts",
+ "types.ts"
+ ],
+ "exclude": [
+ "node_modules"
+ ],
+}
+\ No newline at end of file
diff --git a/scripts/build.sh b/scripts/build.sh
@@ -1,3 +0,0 @@
-gen_ts_types() {
- typeshare ./src --lang=typescript --output-file=bindings/ts/types.ts
-}
-\ No newline at end of file