Commit graph

42 commits

Author SHA1 Message Date
Bjørn Erik Pedersen 4d38f47250 Add a field prefix to the deprecated log statements
To make theme easier to spot, esp. on INFO level.
2023-11-01 16:40:26 +01:00
Bjørn Erik Pedersen ab21433689 Fix deprecation printing on info level
Fixes #11638
2023-10-31 10:42:23 +01:00
Razon Yang de4e466036
Fix so hugo get -u updates transitively 2023-10-22 16:32:01 +02:00
Joe Mooring 75c0f88289 commands/gen: Remove default highlight style
Fixes #11445
2023-09-14 12:08:52 +02:00
Bjørn Erik Pedersen 94fbab2a88 Delay the creation of cache directories until they're used
Fixes #11390
2023-08-30 16:39:06 +03:00
Bjørn Erik Pedersen d2ae9e1363
testscripts: Move hugo new tests to where they belong 2023-08-30 10:31:08 +02:00
Bjørn Erik Pedersen ebaa733d45 Make sure resources directory isn't created in hugo new theme
Fixes #11382
2023-08-23 22:50:35 +02:00
Bjørn Erik Pedersen 111f02db2a testscripts: Make mod vendor test stable 2023-08-23 20:52:09 +02:00
Bjørn Erik Pedersen dcf425c846 Fix it so disable a module does not disable transitive dependency required by others
The motivation behind the original implementation was probably to show disabled modules when running `hugo mod graph`.

Fixes #11376
2023-08-23 18:05:18 +02:00
Joe Mooring 9a8c84d600 create/skeletons: Move theme's site config to top level
Closes #11380
2023-08-23 18:05:00 +02:00
Joe Mooring b6538532f4 commands/new: Embed site and theme skeletons
The skeletons are used when creating new sites and themes with the CLI.

Closes #11358
2023-08-21 10:38:22 +02:00
Bjørn Erik Pedersen 30885a6c5f Fix module config watch regression
Fixes #11313
2023-08-01 09:05:53 +02:00
Bjørn Erik Pedersen b3f10556f0
Use os.UserCacheDir as first fallback if cacheDir is not set
We will now try

1. cacheDir (or, commonly set in environment as `HUGO_CACHEDIR`)
2. if on Netlify we use `/opt/build/cache/hugo_cache/`
3. os.UserCacheDir
4. A temp dir

Storing the cache, especially the module cache, in a temporary idea has had lots of hard to debug issues, especially on MacOS,
which this commit tries to fix.

This should also make it easier to locate the Hugo cache:

>UserCacheDir returns the default root directory to use for user-specific cached data. Users should create their own
application-specific subdirectory within this one and use that.
>
>On Unix systems, it returns $XDG_CACHE_HOME as specified by
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.cache. On Darwin, it
returns $HOME/Library/Caches. On Windows, it returns %LocalAppData%. On Plan 9, it returns $home/lib/cache.
>
>If the location cannot be determined (for example, $HOME is not defined), then it will return an error.

Fixes #11286
Fixes #11291
2023-07-27 20:59:47 +02:00
Bjørn Erik Pedersen d947db3713
commands: Move testscript into its correct place 2023-07-19 19:54:36 +02:00
Bjørn Erik Pedersen 7ae62f4aa3 Create hugo_stats.json if it's mounted but does not exists
A common pattern for Tailwind 3 is to mount that file to get it on the server watch list.

A common pattern is also to add hugo_stats.json to .gitignore.

This has meant that the first time you start the server (no hugo_stats.json), it just doesn't work as expected.

Fixes #11264
2023-07-19 19:50:37 +02:00
Bjørn Erik Pedersen f1a061e9ed Re-instate disableLiveReload as a config option (and not just a flag)
Closes #11259
2023-07-19 19:50:37 +02:00
Bjørn Erik Pedersen 0f921ace6f Fix hugo mod vendor for modules with hugo.toml
Fixes #11221
2023-07-08 16:08:46 +02:00
Bjørn Erik Pedersen 80ecb95895
commands: Handle hugo mod get --help
Fixes #11141
2023-06-29 08:53:50 +02:00
Andreas Deininger 793e38f5ce
commands: Fix help message for hugo new theme
Closes #11161.
2023-06-28 09:30:27 +02:00
Bjørn Erik Pedersen fa0e16f4c7 Fix false path warnings with resources.PostProcess
Fixes #7735
2023-06-27 21:55:35 +02:00
Joe Mooring 019299b0b0 commands: Enable format flag with hugo new site
Fixes #11155
2023-06-24 20:26:54 +02:00
Bjørn Erik Pedersen 12dc9a6e4a deploy: Fix deploy defaults for non-zero flag values (e.g. maxDeletes, invalidateCDN)
This was broken in the config rewrite in Hugo 0.112.0.

The workaround is to be explicit about setting these flag values (even if just using the defaults), e.g.:

```
hugo deploy --invalidateCDN --maxDeletes 256
```

Fixes #11127
2023-06-18 19:38:34 +02:00
Bjørn Erik Pedersen 0541a1b57d
Fix handling of aliases (e.g. hugo serve)
Fixes #11090
2023-06-13 10:47:51 +02:00
Bjørn Erik Pedersen cf38c73f53
commands: Add TLS/HTTPS support to hugo server
* commands: Add TLS/HTTPS support to hugo server

The "auto cert" handling in this PR is backed by mkcert (see link below).

To get this up and running on a new PC, you can:

```
hugo server trust
hugo server --tlsAuto
```

When `--tlsAuto` (or `--tlsCertFile` and `--tlsKeyFile`) is set and no `--baseURL` is provided as a flag, the server is
started with TLS and `https` as the protocol.

Note that you only need to run `hugo server trust` once per PC.

If you already have the key and the cert file (e.g. by using mkcert directly), you can do:

```
hugo server --tlsCertFile mycert.pem --tlsKeyFile mykey.pem
```

See https://github.com/FiloSottile/mkcert

Fixes #11064
2023-06-05 09:53:53 +02:00
Bjørn Erik Pedersen a191b38ac8 Don't inject livereload script on hugo -w
Fixes #11061
2023-06-02 09:04:00 +02:00
Bjørn Erik Pedersen fd099331ec Fix Processed images count regression for multiple languages
Fixes #11002
2023-05-28 12:55:44 +02:00
Bjørn Erik Pedersen 43f1282e73 commands: Reinstate some of the removed build flags (e.g. --theme) to new and mod
Fixes #11018
2023-05-28 12:55:44 +02:00
Bjørn Erik Pedersen e96cdfe966 Don't create the public folder unless needed
Fixes #11031
2023-05-28 12:55:44 +02:00
Bjørn Erik Pedersen 273d9f69a6 commands: Fail the build when no config file or config dir
Fixes #11019
2023-05-27 16:56:54 +02:00
Bjørn Erik Pedersen 8f293a1855 Fix --renderStaticToDisk regression
Fixes #11026
2023-05-27 16:56:54 +02:00
Bjørn Erik Pedersen 901cd970db commands: Re-introduce the -f shorthand for hugo new site
Fixes #11015
2023-05-27 16:56:54 +02:00
Bjørn Erik Pedersen 231374a1fa Fix regression when loading config -e is empty or HUGO_ENV or HUGO_ENVIRONMENT is set
Fixes #11013
2023-05-24 16:39:31 +02:00
Bjørn Erik Pedersen 9a235d0afc Fix regression with site.IsServer when not running a server
Fixes #11006
2023-05-24 12:42:56 +02:00
Bjørn Erik Pedersen 85b13c105a Add --format to hugo config
Now default to TOML.
2023-05-22 20:26:02 +02:00
Bjørn Erik Pedersen 288be1976d Fix "unknown command" message when no suggestion
Updates #10953
2023-05-22 18:54:34 +02:00
Bjørn Erik Pedersen 6ca8a40f25 commands: Make all list commands list what 'all' did before
Also, always include the CSV header.

Updates #10953
2023-05-22 12:27:19 +02:00
Bjørn Erik Pedersen e6dc8053bf
commands: Fix build logic when listing expired/future draft content
Fixes #10972
2023-05-21 10:16:25 +02:00
Bjørn Erik Pedersen d6197a41fa Re-add --printUnusedTemplates and --printPathWarnings
And now with tests.

Updates #10953
2023-05-19 11:37:05 +02:00
Bjørn Erik Pedersen 3f00f47535 commands: Load config before creating the filesystem
To allow publishDir to be set in config file.
2023-05-18 15:38:25 +02:00
Bjørn Erik Pedersen 8a69ccbb00 commands: Improve the common build flag handling
Updates #10947
2023-05-17 22:13:29 +02:00
Bjørn Erik Pedersen 5251f015bf Re-establish all the server flags
Updates #10947
2023-05-17 22:13:29 +02:00
Bjørn Erik Pedersen 241b21b0fd Create a struct with all of Hugo's config options
Primary motivation is documentation, but it will also hopefully simplify the code.

Also,

* Lower case the default output format names; this is in line with the custom ones (map keys) and how
it's treated all the places. This avoids doing `stringds.EqualFold` everywhere.

Closes #10896
Closes #10620
2023-05-16 18:01:29 +02:00