bigskysoftware / htmx-extensions

159 stars 46 forks source link

Remove tests from npm packages #38

Closed axelfontaine closed 1 week ago

axelfontaine commented 3 months ago

The primary way to consume HTMX in the JVM/Java ecosystem is through Webjars.

Webjars makes it convenient to consume NPM dependencies, by automatically transforming them into jar files (the JVM's library format) which lets JVM users consume them through their regular build tool and package management.

A central component of webjars is the locator. Its primary function is allowing you to shorten the directory structure by omitting version numbers and intermediate directories.

All you need to do is write things like

<script src="/webjars/<<npm-package-name>>/<<primary-js-file>>"></script>

which in our case here would translate to something like

<script src="/webjars/htmx-ext-response-targets/response-targets.js"></script>

And the file response-targets.js is then automatically located within the htmx-ext-response-targets webjar (which was built automatically from the corresponsing NPM package).

This works for almost every NPM package out there, including HTMX. Unfortunetly it breaks down for the extensions from this repository:

See:

The reason it breaks down is that both the main extension file and its test share the same name. Either renaming the test files, or even better, excluding them from the NPM package (why are they even in there to begin with?), would instantly fix this issue for all webjar users out there.

While this isn't really your problem per se, the JVM userbase is very large, and I'd like to ask you to please consider fixing this. It should require minimal effort and will make a big difference for many users out there.

sameer-dudeja commented 2 months ago

Hi, I would love to pick this up if someone could guide me a little through the code perspective.

Telroshan commented 2 months ago

excluding them from the NPM package

That would be the best solution, maybe there's a property for that in package.json syntax? Haven't had time to look into this yet, so feel free to dive in @sameer-dudeja !

sameer-dudeja commented 2 months ago

If you think the solution is valid, I will do the same for all the extensions so that none of them will have this issue @Telroshan @alexpetros

Telroshan commented 2 months ago

Oh so there was such a thing as a npm ignore file, nice! Sure, feel free to do it for all extensions at once as the issue is the same for all of them.

axelfontaine commented 1 week ago

Closing as this has been fixed with the merge of