Skip to content

Commit 7f025b1

Browse files
committed
Added explanation to developer.md about the hybrid build process
1 parent 30a1a51 commit 7f025b1

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

node/DEVELOPER.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,28 @@ Development on the Node wrapper may involve changes in either the TypeScript or
170170
- [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) - in-editor test runner.
171171
- [Jest Test Explorer](https://marketplace.visualstudio.com/items?itemName=kavod-io.vscode-jest-test-adapter) - adapter to the VSCode testing UI.
172172
- [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) - Rust language support for VSCode.
173+
174+
### Hybrid package publishing methode
175+
176+
In this project we are using hybrid method for building the package for NODE.
177+
Hybrid method -
178+
In order to build the package for usage bothe in mjs and cjs we are using three different tsconfig files.
179+
tsconfig-base as the general tsconfig file, which the others will inherited from.
180+
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.
181+
182+
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.
183+
184+
In our package.json we are adding the rule -
185+
186+
```
187+
"exports": {
188+
".": {
189+
"import": "./build-ts/mjs/index.js",
190+
"require": "./build-ts/cjs/index.js"
191+
}
192+
},
193+
```
194+
195+
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.
196+
As part of the build we are running the fixup_pj_files_for_build_type script -
197+
This script add "type" and "types" values to the different package.json that been created for mjs and cjs with the fitting values.

0 commit comments

Comments
 (0)