Császár Ákos
10/16/2024, 7:18 AMjsBrowserProductionLibraryDistribution
gradle task of the first module, I will get a generated package in the projectRoot/build/js
folder which contains multiple packages (as you can see in the picture) for both modules. So I have 2 questions:
• If I called jsBrowserProductionLibraryDistribution
only on the first module, why do I get a package also for the second (test ui)?
• Is there a way to avoid generating a <packageName>-test
package for the modules?CLOVIS
10/16/2024, 7:44 AMbuild/js/packages/<name of module>
is the actual Yarn workspace for that module. Kotlin must always generate one for all modules, no matter if it's published or not. Otherwise, you wouldn't be able to use NPM dependencies or even run tests!Császár Ákos
10/16/2024, 8:09 AMmy_lib
and my_lib-test
folders.
Why can't I achieve the same result by running only jsBrowserProductionLibraryDistribution
on the first module?CLOVIS
10/16/2024, 8:22 AMIf I don't include the other module in the settings.gradle it won't generate the 2 other folders.From Yarn's point of view, this is the same as deleting the project entirely.
build/js/packages
isn't some kind of "exported data" that is run specifically for modules you want to export. It's the real Yarn/NPM project that lives underneath the build. That's the working directory in which webpack, your test framework, etc are executed. If you remove it, you can't use anything from the JS ecosystem anymore, since there is no JS anymore. It doesn't have anything to do with publishing libraries.Császár Ákos
10/16/2024, 8:28 AMCLOVIS
10/16/2024, 8:31 AMbuild/js/packages
.Császár Ákos
10/16/2024, 9:13 AMjsBrowserProductionLibraryDistribution
• add an .npmrc and a modified package.json file to the build/js
folder
• run npm publish in the build/js
folder
However I noticed that it contains files from other modules that I don't need in the consumer application. So as I see I have 2 options:
1. exclude unnecessary files
2. finding another way to create a more optimal npm packageCsászár Ákos
10/16/2024, 9:54 AMmoduleName/build/dist/productionLibrary
folder.CLOVIS
10/16/2024, 10:19 AMdist/productionLibrary
is what you're supposed to publish. At least, it's my understanding, I've not published libraries to NPM so far.