Skip to content

Commit f0e66fe

Browse files
committed
Compile TypeScript to JavaScript before publishing to npm
1 parent 37b5c64 commit f0e66fe

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

.github/workflows/compat.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ jobs:
4747
with:
4848
targets: ${{ matrix.runner == 'macos-latest' && 'aarch64-apple-ios-sim' || 'aarch64-linux-android' }}
4949

50+
- uses: actions/setup-node@v4
51+
with:
52+
node-version: "20.x"
53+
cache: "yarn"
54+
- run: yarn install
55+
- run: yarn build
56+
5057
- name: Generate & build turbo module
5158
run: |
5259
./scripts/test-turbo-modules.sh \

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ target/
55

66
# Generated by Typescript
77
dist/
8+
lib/
89

910
# For cpp
1011
cpp_modules/

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
"email": "[email protected]"
1313
},
1414
"type": "module",
15-
"main": "./typescript/src/index.ts",
15+
"main": "./lib/index.js",
16+
"types": "./lib/index.d.ts",
1617
"bin": {
1718
"ubrn": "./bin/cli.cjs",
1819
"uniffi-bindgen-react-native": "./bin/cli.cjs"
1920
},
2021
"scripts": {
22+
"build": "tsc",
23+
"prepare": "yarn build",
2124
"test": "./scripts/run-tests.sh"
2225
},
2326
"devDependencies": {

tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"uniffi-bindgen-react-native": ["./typescript/src/index"],/* Specify a set of entries that re-map imports to additional lookup locations. */
77
"@/*": ["./typescript/testing/*"],
88
},
9+
"declaration": true,
10+
"outDir": "./lib", /* Redirect output structure to the directory. */
911
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
1012
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
1113
"strict": true, /* Enable all strict type-checking options. */

0 commit comments

Comments
 (0)