Closed thomasballinger closed 3 months ago
The helpers we need are exposed in https://github.com/get-convex/convex-backend/commit/698b96a8ef4dc4961c717131ae1cb06540f6838f, no release yet
Also npx shouldn’t be necessary in scripts- they add the node modules bin to the path iirc
On Mon, Mar 25, 2024 at 1:53 PM Tom Ballinger @.***> wrote:
@.**** commented on this pull request.
In packages/convex-helpers/package.json https://github.com/get-convex/convex-helpers/pull/90#discussion_r1538155191 :
"prebuild": "npm run test",
"test": "tsc --project tsconfig.test.json", "clean": "rm -rf dist",
- "watch": "chokidar '.ts' 'server/.ts' 'react/*.ts' 'tsconfig.json' 'package.json' -c 'npm run build' --initial"
- "watch": "chokidar '.ts' 'server/.ts' 'react/.ts' 'tsconfig.json' 'package.json' -c 'npm run build' --initial",
- "arethetypeswrong": "npx attw $(npm pack)"
it's a lint for troubleshooting, we could run it with tests
— Reply to this email directly, view it on GitHub https://github.com/get-convex/convex-helpers/pull/90#discussion_r1538155191, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZQWZPGFN2UJDNBSFR5PTY2B6BZAVCNFSM6AAAAABFEFATDOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTSNJYGY2TIOBTGY . You are receiving this because you commented.Message ID: @.***>
This works for everything I try to do with it, but that's just loading files in the top-level project that import from convex-helpers. Is there anything else to check here?
Asking online, it sounds like the "development" export condition is not a good idea because some bundlers will be looking for a development build but not be able to transpile the TypeScript. I wonder if we should use a different condition or strip the development condition.
I think we don't need the npm link but we do need the watch process, just like you mentioned in person for the convex dev
bundling process (which you were also right about, esbuild does not by default use the "development" export condition)
I'll land this without the publish script changes you made and you can add them? should be ready now
Oh whoops I force-pushed your publish script changes away, I'll add them back
Compile TypeScript to ESM .js, .d.ts, and .d.ts.map files.
This resolves the issue in https://github.com/get-convex/convex-helpers/pull/80 that required adding node_modules/convex-helpers to the list of files to transpile.
This may be the setup to recommend to others: no CJS so no dual packages, simple tsconfig.json setup, compile step but no bundling, and perhaps this fancy "development" setup although that one could use more testing. If configured right it should allow skipping the compile step when this package is installed in another project from this repo checkout out locally.