Here is an issue I have been struggling with figuring out for a while:
I have a theme that uses some NPM dependencies, and I would like to avoid having to commit the built files to the repo, but so far I have not found away that lets Hugo pull package.json from the theme when it is added as a module to run the build process on each theme instance.
For reference here is the theme repo:
And one theme instance (blog):
Currently, Hugo does not download files in root of the module repo, thus package.json is omitted.
I am not sure if I understand your issue. I would (without what I will write in the following paragraph) write a little shell script, that iterates through all the places and update dependencies and run build scripts and then go down to the repo root and run hugo.
But: Did anything with your issue change by using the new hugo npm command? I did not use it yet, but the documentation sounds like it might magically solve your issues. (v0.75.1 solves an issue with package.json, but I linked the 0.75.0 because it’s described there)
I was hopeful of 0.75 solving the issue, but with my trials I could not find a way that it does.
The issue is that when you add the module to hugo it only mounts the predefined asset directories, and not files in the root directory. Thus, my package.json does not get downloaded. Perhaps I can use ‘hugo npm’ if I put the package.json from the theme in a subfolder, but this is not ideal either