Skip to content

Commit 20d4942

Browse files
automatic export tests
1 parent 964f3f9 commit 20d4942

File tree

11 files changed

+53
-18
lines changed

11 files changed

+53
-18
lines changed

.github/workflows/test-isolated.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
run: pnpm build:packages
4747

4848
- name: Test Package Exports
49-
run: pnpm test:packages:types
49+
run: pnpm test:packages:exports
5050

5151
- name: Start Verdaccio
5252
run: |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"lint": "eslint .",
2222
"release": "pnpm build:packages:prod && pnpm changeset publish",
2323
"test": "pnpm run -r --workspace-concurrency=1 test --run",
24-
"test:packages:types": "pnpm -r --filter {./packages/**} exec attw --pack . "
24+
"test:packages:exports": "pnpm -r --filter {./packages/**} test:exports "
2525
},
2626
"keywords": [],
2727
"type": "module",

packages/attachments/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
"build:prod": "tsc -b --sourceMap false && rollup --config --sourceMap=false",
4242
"clean": "rm -rf lib tsconfig.tsbuildinfo",
4343
"watch": "tsc -b -w",
44-
"test": "pnpm build && vitest"
44+
"test": "pnpm build && vitest",
45+
"test:exports": "attw --pack ."
4546
},
4647
"peerDependencies": {
4748
"@powersync/common": "workspace:^1.35.0"

packages/common/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
"build": "tsc -b && rollup -c rollup.config.mjs",
4141
"build:prod": "tsc -b --sourceMap false && rollup -c rollup.config.mjs --sourceMap false",
4242
"clean": "rm -rf lib dist tsconfig.tsbuildinfo",
43-
"test": "vitest"
43+
"test": "vitest",
44+
"test:exports": "attw --pack ."
4445
},
4546
"dependencies": {
4647
"js-logger": "^1.6.1"

packages/drizzle-driver/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"build:prod": "tsc -b --sourceMap false && rollup --config --sourceMap=false",
3939
"clean": "rm -rf lib tsconfig.tsbuildinfo",
4040
"watch": "tsc --build -w",
41-
"test": "vitest"
41+
"test": "vitest",
42+
"test:exports": "attw --pack ."
4243
},
4344
"peerDependencies": {
4445
"@powersync/common": "workspace:^1.35.0",

packages/kysely-driver/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"build:prod": "tsc -b --sourceMap false && rollup --config --sourceMap=false",
3939
"clean": "rm -rf lib tsconfig.tsbuildinfo",
4040
"watch": "tsc --build -w",
41-
"test": "pnpm build && vitest"
41+
"test": "pnpm build && vitest",
42+
"test:exports": "attw --pack ."
4243
},
4344
"peerDependencies": {
4445
"@powersync/common": "workspace:^1.35.0"

packages/node/package.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,30 @@
1818
"build:prod": "tsc -b --sourceMap false && rollup --config",
1919
"clean": "rm -rf lib dist tsconfig.tsbuildinfo",
2020
"watch": "tsc -b -w",
21-
"test": "vitest"
21+
"test": "vitest",
22+
"test:exports": "attw --pack . --ignore-rules no-resolution "
2223
},
2324
"type": "module",
2425
"exports": {
2526
".": {
26-
"import": "./lib/index.js",
27-
"require": "./dist/bundle.cjs",
28-
"types": "./lib/index.d.ts"
27+
"import": {
28+
"default:": "./lib/index.js",
29+
"types": "./lib/worker.d.ts"
30+
},
31+
"require": {
32+
"default:": "./dist/bundle.cjs",
33+
"types": "./dist/bundle.d.cts"
34+
}
2935
},
3036
"./worker.js": {
31-
"import": "./lib/worker.js",
32-
"require": "./dist/worker.cjs",
33-
"types": "./lib/worker.d.ts"
37+
"import": {
38+
"default:": "./lib/worker.js",
39+
"types": "./lib/worker.d.ts"
40+
},
41+
"require": {
42+
"default:": "./dist/worker.cjs",
43+
"types": "./dist/worker.d.cts"
44+
}
3445
},
3546
"./package.json": "./package.json"
3647
},

packages/node/rollup.config.mjs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import dts from 'rollup-plugin-dts';
2+
13
const plugin = () => {
24
return {
35
name: 'mark-as-commonjs',
@@ -7,7 +9,7 @@ const plugin = () => {
79
}
810

911
return null;
10-
},
12+
}
1113
};
1214
};
1315

@@ -21,6 +23,14 @@ export default [
2123
sourcemap: true
2224
}
2325
},
26+
{
27+
input: 'lib/index.d.ts',
28+
output: {
29+
file: 'dist/bundle.d.cts',
30+
format: 'cjs'
31+
},
32+
plugins: [dts()]
33+
},
2434
{
2535
input: 'lib/db/DefaultWorker.js',
2636
plugins: [plugin()],
@@ -38,5 +48,13 @@ export default [
3848
format: 'cjs',
3949
sourcemap: true
4050
}
51+
},
52+
{
53+
input: 'lib/worker.d.ts',
54+
output: {
55+
file: 'dist/worker.d.cts',
56+
format: 'cjs'
57+
},
58+
plugins: [dts()]
4159
}
4260
];

packages/react-native/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"build": "tsc -b && rollup -c rollup.config.mjs",
1818
"build:prod": "tsc -b --sourceMap false && rollup -c rollup.config.mjs --sourceMap false",
1919
"clean": "rm -rf lib dist tsconfig.tsbuildinfo",
20-
"watch": "tsc -b -w"
20+
"watch": "tsc -b -w",
21+
"test:exports": "attw --pack ."
2122
},
2223
"repository": {
2324
"type": "git",

packages/tanstack-react-query/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"description": "PowerSync integration with TanStack Query for offline-first and real-time data synchronization in React apps",
99
"main": "./lib/index.js",
1010
"types": "./lib/index.d.ts",
11+
"type": "module",
1112
"files": [
1213
"lib"
1314
],
@@ -16,7 +17,8 @@
1617
"build:prod": "tsc -b --sourceMap false",
1718
"clean": "rm -rf lib tsconfig.tsbuildinfo",
1819
"test": "vitest",
19-
"watch": "tsc -b -w"
20+
"watch": "tsc -b -w",
21+
"test:exports": "attw --pack . --ignore-rules cjs-resolves-to-esm"
2022
},
2123
"repository": {
2224
"type": "git",

0 commit comments

Comments
 (0)