Skip to content

Commit 1cbf81c

Browse files
Add test to CI. Update other packages.
1 parent de64a43 commit 1cbf81c

File tree

9 files changed

+196
-45
lines changed

9 files changed

+196
-45
lines changed

.github/workflows/test-isolated.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
- name: Build Packages
4646
run: pnpm build:packages
4747

48+
- name: Test Package Exports
49+
run: pnpm test:packages:types
50+
4851
- name: Start Verdaccio
4952
run: |
5053
npm install -g verdaccio

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
"format": "prettier --write .",
2121
"lint": "eslint .",
2222
"release": "pnpm build:packages:prod && pnpm changeset publish",
23-
"test": "pnpm run -r --workspace-concurrency=1 test --run"
23+
"test": "pnpm run -r --workspace-concurrency=1 test --run",
24+
"test:packages:types": "pnpm -r --filter {./packages/**} exec attw --pack . "
2425
},
2526
"keywords": [],
2627
"type": "module",
@@ -31,6 +32,7 @@
3132
},
3233
"devDependencies": {
3334
"@actions/core": "^1.10.1",
35+
"@arethetypeswrong/cli": "^0.18.2",
3436
"@changesets/cli": "2.27.2",
3537
"@pnpm/workspace.find-packages": "^4.0.2",
3638
"@rollup/plugin-commonjs": "^25.0.7",

packages/common/package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@
1212
"types": "lib/index.d.ts",
1313
"exports": {
1414
".": {
15-
"types": "./lib/index.d.ts",
16-
"import": "./dist/bundle.mjs",
17-
"require": "./dist/bundle.cjs",
18-
"default": "./dist/bundle.mjs"
15+
"import": {
16+
"types": "./lib/index.d.ts",
17+
"default": "./dist/bundle.mjs"
18+
},
19+
"require": {
20+
"types": "./dist/index.d.cts",
21+
"require": "./dist/bundle.cjs"
22+
}
1923
}
2024
},
2125
"author": "JOURNEYAPPS",

packages/common/rollup.config.mjs

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import inject from '@rollup/plugin-inject';
33
import json from '@rollup/plugin-json';
44
import nodeResolve from '@rollup/plugin-node-resolve';
55
import terser from '@rollup/plugin-terser';
6+
import { dts } from 'rollup-plugin-dts';
67

78
/**
89
* @returns {import('rollup').RollupOptions}
@@ -13,36 +14,43 @@ export default (commandLineArgs) => {
1314
// Clears rollup CLI warning https://github.com/rollup/rollup/issues/2694
1415
delete commandLineArgs.sourceMap;
1516

16-
return {
17-
input: 'lib/index.js',
18-
output: [
19-
{
20-
file: 'dist/bundle.mjs',
21-
format: 'esm',
22-
sourcemap: sourceMap
23-
},
24-
{
25-
file: 'dist/bundle.cjs',
26-
format: 'cjs',
27-
sourcemap: sourceMap
28-
}
29-
],
30-
plugins: [
31-
json(),
32-
nodeResolve({ preferBuiltins: false, browser: true }),
33-
commonjs({}),
34-
inject({
35-
Buffer: ['buffer', 'Buffer'],
36-
ReadableStream: ['web-streams-polyfill/ponyfill', 'ReadableStream'],
37-
// Used by can-ndjson-stream
38-
TextDecoder: ['text-encoding', 'TextDecoder']
39-
}),
40-
terser({ sourceMap })
41-
],
42-
// This makes life easier
43-
external: [
44-
// This has dynamic logic - makes bundling hard
45-
'cross-fetch'
46-
]
47-
};
17+
return [
18+
{
19+
input: 'lib/index.js',
20+
output: [
21+
{
22+
file: 'dist/bundle.mjs',
23+
format: 'esm',
24+
sourcemap: sourceMap
25+
},
26+
{
27+
file: 'dist/bundle.cjs',
28+
format: 'cjs',
29+
sourcemap: sourceMap
30+
}
31+
],
32+
plugins: [
33+
json(),
34+
nodeResolve({ preferBuiltins: false, browser: true }),
35+
commonjs({}),
36+
inject({
37+
Buffer: ['buffer', 'Buffer'],
38+
ReadableStream: ['web-streams-polyfill/ponyfill', 'ReadableStream'],
39+
// Used by can-ndjson-stream
40+
TextDecoder: ['text-encoding', 'TextDecoder']
41+
}),
42+
terser({ sourceMap })
43+
],
44+
// This makes life easier
45+
external: [
46+
// This has dynamic logic - makes bundling hard
47+
'cross-fetch'
48+
]
49+
},
50+
{
51+
input: './lib/index.d.ts',
52+
output: [{ file: 'dist/index.d.cts', format: 'cjs' }],
53+
plugins: [dts()]
54+
}
55+
];
4856
};

packages/powersync-op-sqlite/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"main": "./lib/commonjs/index.js",
77
"module": "./lib/module/index.js",
88
"types": "./lib/typescript/commonjs/src/index.d.ts",
9+
"type": "module",
910
"exports": {
1011
".": {
1112
"import": {
@@ -101,7 +102,7 @@
101102
[
102103
"commonjs",
103104
{
104-
"esm": true
105+
"esm": false
105106
}
106107
],
107108
[

packages/react/package.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66
"access": "public"
77
},
88
"description": "React components for JourneyApps PowerSync",
9+
"type": "module",
910
"main": "./lib/index.js",
1011
"module": "./lib/index.js",
1112
"types": "./lib/index.d.ts",
1213
"files": [
1314
"lib"
1415
],
15-
"exports": {
16-
".": {
17-
"types": "./lib/index.d.ts",
18-
"import": "./lib/index.js",
19-
"default": "./lib/index.js"
20-
}
21-
},
2216
"scripts": {
2317
"build": "tsc -b",
2418
"build:prod": "tsc -b --sourceMap false",

packages/vue/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"access": "public"
77
},
88
"description": "Vue components for JourneyApps PowerSync",
9+
"type": "module",
910
"main": "./lib/index.js",
1011
"types": "./lib/index.d.ts",
1112
"files": [

packages/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"description": "PowerSync web SDK. Sync Postgres, MongoDB or MySQL with SQLite in your web app",
55
"main": "lib/src/index.js",
66
"types": "lib/src/index.d.ts",
7+
"type": "module",
78
"bin": {
89
"powersync-web": "bin/powersync.js"
910
},

0 commit comments

Comments
 (0)