Add "hugo mod npm pack"
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 9 Sep 2020 20:31:43 +0000 (22:31 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 13 Sep 2020 18:55:29 +0000 (20:55 +0200)
commit85ba9bfffba9bfd0b095cb766f72700d4c211e31
tree43b66efaafe4cb804234ca7273873ab949305799
parent9df60b62f9c4e36a269f0c6e9a69bee9dc691031
Add "hugo mod npm pack"

This commit also introduces a convention where these common JS config files, including `package.hugo.json`, gets mounted into:

```
assets/_jsconfig
´``

These files mapped to their real filename will be added to the environment when running PostCSS, Babel etc., so you can do `process.env.HUGO_FILE_TAILWIND_CONFIG_JS` to resolve the real filename.

But do note that `assets` is a composite/union filesystem, so if your config file is not meant to be overridden, name them something specific.

This commit also adds adds `workDir/node_modules` to `NODE_PATH` and `HUGO_WORKDIR` to the env when running the JS tools above.

Fixes #7644
Fixes #7656
Fixes #7675
16 files changed:
commands/mod.go
commands/mod_npm.go [new file with mode: 0644]
common/hugo/hugo.go
docs/content/en/hugo-pipes/babel.md
hugofs/files/classifier.go
hugofs/rootmapping_fs.go
hugofs/walk_test.go
hugolib/filesystems/basefs.go
hugolib/hugo_modules_test.go
hugolib/resource_chain_test.go
modules/collect.go
modules/config.go
modules/npm/package_builder.go [new file with mode: 0644]
modules/npm/package_builder_test.go [new file with mode: 0644]
resources/resource_transformers/babel/babel.go
resources/resource_transformers/postcss/postcss.go