Added a hybrid module for node#1132
Conversation
|
please add to the PR description (or into DEVELOPER.md) an explanation of the how, not only the what. As it is, the PR is a collection of scripts, and it's very hard to understand how the pieces combine and what they do. |
a08af09 to
0a56c85
Compare
2a80ea9 to
d7f7389
Compare
Added explanation for both PR and developer.md, please let me know if the explanation is clear and helpful @shachlanAmazon |
d7f7389 to
7f025b1
Compare
shachlanAmazon
left a comment
There was a problem hiding this comment.
great work!
@barshaul thoughts?
IMO we should release a version after this will be merged.
|
please also update the CHANGELOG.md file |
852f4f0 to
a1591cb
Compare
…ig usage in npm folder, enter to change log
6e1fbbc to
4e04973
Compare
4e04973 to
4a890e3
Compare
d8a0f62 to
e8405c9
Compare
e8405c9 to
4b89b95
Compare
4b89b95 to
0539b16
Compare
0539b16 to
739ebf4
Compare
* Added a hybrid module for node * Added explanation to DEVELOPER.md about the hybrid build process * PR fixes - DEVELOPER.md wordings, Script naming, CI structure, tsconfig usage in npm folder, enter to change log * added tsconfig property to jest * Added comment to fixup script file
minor improvment to valkey-io#1132
* Added a hybrid module for node * Added explanation to DEVELOPER.md about the hybrid build process * PR fixes - DEVELOPER.md wordings, Script naming, CI structure, tsconfig usage in npm folder, enter to change log * added tsconfig property to jest * Added comment to fixup script file
minor improvment to valkey-io#1132
Fix for issue 1116:
Some of the client of our package are using Ecma and some Commonjs as they're JS standard.
In order to make it available in both standards, iv'e created an hybrid build, in which the user will get the build fits his need base on his standard.
Added tests of basic usage (the main test that is needed is to see whether its possible to use the built package in the JS projects of different standard type).
Added the tests to the Node workflow.
Changes explanation in a bit more details:
We are using TSC in order to translate our package to JS.
So instead of using one file of tsconfig.json for the rules of the translation we are using a hybrid method -
tsconfig-base as the general tsconfig file, which the other will inherited from.
tsconfig-cjs for commonJS build with commonjs as the target of translation and and tsconfig for ECMA build with ECMA as the target of translation.
While running build we run two different builds - one will use tsconfig and will translate the package into build-ts/mjs, and the other will use tsconfig-cjs and will translate the package into build-ts/cjs.
In our package.json we are adding the rule -
In which depends on what type of import statement the user choose (import in ECMA, and require in commonJS), the user will get the fitting package to his standard.
As part of the build we are running the fixup_pj_files_for_build_type script -
This script add "type" and "types" values to the different package.json that been created for mjs and cjs with the fitting values.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.