-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cre8/issue1321 #1322
Cre8/issue1321 #1322
Conversation
Fixes decentralized-identity#1321 Signed-off-by: Mirko Mollik <[email protected]>
Fixes decentralized-identity#1321 Signed-off-by: Mirko Mollik <[email protected]>
Fixes decentralized-identity#1321 Signed-off-by: Mirko Mollik <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #1322 +/- ##
=======================================
Coverage 85.50% 85.50%
=======================================
Files 170 170
Lines 18946 18946
Branches 2115 2115
=======================================
Hits 16200 16200
Misses 2746 2746 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build failures you were seeing were caused by the presence of the tsconfig.tsbuildinfo
file. If you delete that between builds you should see the call to tsc
succeed. This is also why the build works in the GitHub workflow.
I have some concerns about the CJS output referring to bundled dependencies by their pnpm path. I'm not sure if this would be an issue since I haven't tested the result of this PR.
That being said, how do you propose to test if this set of changes would improve things?
do not bundle dependencies Co-authored-by: Mircea Nistor <[email protected]>
export types Co-authored-by: Mircea Nistor <[email protected]>
In case of testing: I am not sure if we can write tests for a CJS and a ESM case. But it would allow to use the libraires in frameworks like nestjs that are focussed on CJS (you can compile to ESM, but then some features are missing). Even when in some years ESM dominates the backend market, we do not need to support both approaches (unless we see a big drawback with this approach) |
One thing that is not covered in the current update is the type-check. This has to be done with tsc. I excluded it since this gave some errors according to other libraries. So the pro argument of this is that we have CJS and ESM. The downside is more complexity since we are using TSC (for type checking and type generation) and es build (for converting to JS and bundling for CJS). The argument "compiles faster" is not really there, since even when using it in other dependencies you need to generate the types with tsc (I haven't measured the times tsc need for compiling + type generation and only type generation). Writing these lines I am not 100% if this is a feature worth of trying. Maybe esbuild is good for applications where you don't care about available types, you just want a bundled pack of JS files... |
I don't mean unit/integration testing necessarily. I mean, do you have a project that fails to build/work using the current ESM build where we could test the new build setup? We can publish these changes under the |
I like the unstable option. I can setup a nestjs project with then openapi integration. There I always failed to use ESM |
Signed-off-by: Mirko Mollik <[email protected]>
…d export the schemas from each package relates to decentralized-identity#1318 / decentralized-identity#1317
Signed-off-by: Mirko Mollik <[email protected]>
Fixes decentralized-identity#1321 Signed-off-by: Mirko Mollik <[email protected]>
Signed-off-by: Mirko Mollik <[email protected]>
Signed-off-by: Mirko Mollik <[email protected]>
Signed-off-by: Mirko Mollik <[email protected]>
Signed-off-by: Mirko Mollik <[email protected]>
I updated all packages to esbuild and the build command passes. However I removed also the '.js' extensions for the import paths because I thought you do not need them (and there should be a solution for this). WIth the flag
Before reverting the commit with the '.js transformation', I just wanted to check if someone of you has an easy solution how we can deal with it (this explains the +200 file changes ;)) |
I continued the work in a new PR: #1328 since this one had to much files changed |
What issue is this PR fixing
fixes: #1321
The utils package is build with esbuild. However the current task fails since the build task in the
package.json
file with"build": "node esbuild.js && tsc --emitDeclarationOnly",
will not exectute the tsc command. Even when putting the command in a dedicated job like"types": "tsc --emitDeclarationOnly",
it fails. However calling it directly in the folder (and not via the package.json), it works.To get all build work for now:
npm run build
tsc --emitDeclarationOnly
Update: when packing the
package.json
executable the task works (withchmod +x package.json
)What is being changed
It will publish the packages in ESM and commonjs so all developers are happy :)
Quality
Check all that apply:
pnpm i
,pnpm build
,pnpm test
,pnpm test:browser
locally.Details
If applicable, add screen captures, error messages or stack traces to help explain your problem.