htmx-extensions icon indicating copy to clipboard operation
htmx-extensions copied to clipboard

Remove tests from npm packages

Open axelfontaine opened this issue 1 year ago • 4 comments

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:

  • https://github.com/webjars/webjars/issues/2082

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.

axelfontaine avatar Jul 02 '24 12:07 axelfontaine

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

sameer-dudeja avatar Jul 12 '24 17:07 sameer-dudeja

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 !

Telroshan avatar Jul 13 '24 07:07 Telroshan

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

sameer-dudeja avatar Jul 13 '24 23:07 sameer-dudeja

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.

Telroshan avatar Jul 14 '24 06:07 Telroshan

Closing as this has been fixed with the merge of

  • https://github.com/bigskysoftware/htmx-extensions/pull/53

axelfontaine avatar Sep 27 '24 15:09 axelfontaine