Skip to content

Commit c9618f4

Browse files
authored
Update readme text (#4393)
Signed-off-by: Ian Maddaus <[email protected]>
1 parent f4aa4d7 commit c9618f4

File tree

1 file changed

+110
-117
lines changed

1 file changed

+110
-117
lines changed

README.md

Lines changed: 110 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If you don't find style guidance in the Chef Documentation Style Guide, use [Goo
1818
## Distributed documentation
1919

2020
The Chef documentation source is highly distributed and depends on [Hugo modules](https://gohugo.io/hugo-modules/) to pull in documentation from other Chef repositories.
21-
The content from those repositories is [vendored](#hugo-vendoring) in chef-web-docs.
21+
The content from those repositories is [vendored](#update-documentation-from-other-repositories) in chef-web-docs.
2222

2323
To make changes to the content in those repositories, submit pull requests to the appropriate repository. don't submit pull requests to the vendored files in chef-web-docs. We will update those changes after they're merged or after a new version of a product is released.
2424

@@ -70,25 +70,11 @@ fix build errors before we merge, so you don't have to
7070
worry about passing all of the CI checks, but it might add an extra
7171
few days. The important part is submitting your change.
7272

73-
## Edit on GitHub links
74-
75-
We use a partial `edit_on_github.html` to add "Edit on GitHub" links to each page.
76-
77-
Each page should have a `gh_repo` parameter set to the value of the GitHub repository
78-
that the page comes from. For example, `gh_repo = "chef-server"`
79-
80-
Each repository with documentation has a `config.toml` file with a `params.<REPOSITORY>`
81-
map and a `gh_path` parameter set to the path of the docs content directory in
82-
that repository.
83-
84-
The `edit_on_github` partial appends the page file name to the end of `gh_path`
85-
parameter and adds the link to the text of the page.
86-
8773
## Local development environment
8874

8975
The Chef Documentation website is built using:
9076

91-
- [Hugo](https://gohugo.io/) 0.123.4 or higher
77+
- [Hugo](https://gohugo.io/) 0.142.0 or higher
9278
- [Node](https://www.nodejs.com) 20.0.0 or higher
9379
- [NPM](https://www.npmjs.com/) 10.4.0 or higher
9480
- [Go](https://golang.org/dl/) 1.22 or higher
@@ -124,61 +110,6 @@ To clean your local development environment:
124110
in addition to the functions of `make clean` described above. Those node
125111
modules will be reinstalled the next time you run `make serve`.
126112

127-
## Site theme
128-
129-
The theme for this site is deployed from the [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme/) repository.
130-
131-
### Node modules
132-
133-
The Node modules defined in the `package.json` file are sourced from the `package.hugo.json` file in the `chef/chef-docs-theme` repository.
134-
To update these Node dependencies, update them in `chef/chef-docs-theme`, then [update the theme and the `package.json` file](#update-theme) in this repository.
135-
136-
### Local theme testing
137-
138-
You can test local changes made to the chef-docs-theme repository and preview those changes using Hugo's local development server.
139-
To do this, create a Go workspace file that modifies the source of Hugo's modules, source the workspace file, and start the local server.
140-
141-
For example:
142-
143-
1. Create a `hugo.work` file in root of this project.
144-
145-
1. Add the following config information to the `hugo.work` file:
146-
147-
```go
148-
go 1.22
149-
150-
use .
151-
use ../path/to/local/chef-docs-theme
152-
```
153-
154-
1. Start the Hugo local server:
155-
156-
```sh
157-
make test_theme
158-
```
159-
160-
This command adds the `hugo.work` file to the Hugo workspace and then ignores the contents of `chef-docs-theme` repo in the `_vendor` directory.
161-
162-
### Test theme branch
163-
164-
You can target a Git commit, branch, or tag when importing a module. This allows you to push a test branch up to `chef/chef-docs-theme` and then import it into this repository for local testing.
165-
166-
For example:
167-
168-
```sh
169-
hugo mod get -u github.com/chef/chef-docs-theme@<GIT_COMMIT_SHA>
170-
```
171-
172-
or
173-
174-
```sh
175-
hugo mod get -u github.com/chef/chef-docs-theme@<GIT_BRANCH>
176-
```
177-
178-
### Update theme
179-
180-
Run `make update_theme` to update the chef-docs-theme to the latest commit. This updates the theme and the theme's node dependencies.
181-
182113
## Build and preview the docs
183114

184115
You can preview documentation using one of the following:
@@ -193,6 +124,7 @@ This is automatic for members of the Chef GitHub organization; the Documentation
193124

194125
### Build and preview the docs locally
195126

127+
- [Install the site dependencies](#local-development-environment).
196128
- Run `make serve`
197129
- go to [http://localhost:1313](http://localhost:1313)
198130

@@ -203,7 +135,7 @@ This is useful for previewing redirects configured in the `netlify.toml` file.
203135

204136
Requirements:
205137

206-
- all the requirements for building this site locally
138+
- [all the requirements for building this site locally](#local-development-environment)
207139
- [Netlify CLI](https://docs.netlify.com/cli/get-started/#installation)
208140

209141
Run `netlify dev` to preview the site using the Netlify CLI.
@@ -215,89 +147,74 @@ Run `netlify dev` to preview the site using the Netlify CLI.
215147
Some Chef documentation is stored in private repositories so this option is only
216148
available to Progress Chef employees.
217149

218-
## Hugo vendoring
150+
## Update documentation from other repositories
219151

220-
[Vendoring](https://gohugo.io/commands/hugo_mod_vendor/) stores all of the module content
221-
from other repositories in the `_vendor` directory at the commit specified by
222-
the `go.mod` file. When Hugo builds the documentation, it will grab content from
223-
the `_vendor` directory instead of the original repository OR a local copy of a
224-
that repository. To see which commits the vendored files reference, see the
225-
`_vendor/modules.txt` file.
152+
We [vendor](https://gohugo.io/commands/hugo_mod_vendor/) most documentation, some Javascript dependencies, and our site theme in the `_vendor` directory.
226153

227-
To vendor the modules in chef-web-docs, run `hugo mod vendor`.
154+
### Update vendored content
228155

229-
To update the vendored modules, first update the [Hugo module(s)](#update-hugo-modules),
230-
then run `hugo mod vendor`.
156+
To updated vendored content, follow these steps:
231157

232-
To ignore the vendored files in a Hugo build, run `make serve_ignore_vendor`. This
233-
is the same as `make serve` except it adds the `--ignoreVendor` flag. This will
234-
build the documentation from the GitHub repositories or from a local copy of a repository
235-
if the `go.mod` file specifies pulling content from a local repository. (see above)
158+
1. Update the content from source repository using [`hugo mod get`](https://gohugo.io/commands/hugo_mod_get/). See the list of modules in the [`go.mod` file](https://github.com/chef/chef-web-docs/blob/main/go.mod) or the [module config file](https://github.com/chef/chef-web-docs/blob/main/config/_default/module.toml).
236159

237-
### Update Hugo modules
160+
To update content to the latest commit in the main branch:
238161

239-
Hugo modules are pinned to a particular commit of the master branch in their repository.
240-
If you look in the `go.mod` and `go.sum` files, you'll notice that each repository
241-
specifies a git commit timestamp and SHA.
162+
```sh
163+
hugo mod get -u github.com/<ORG>/<REPO>/<SUBDIRECTORY>
164+
```
242165

243-
To update a particular repo, run:
166+
You can also update a module to a particular Git SHA, branch, or tag. For example:
244167

245-
```bash
246-
hugo mod get github.com/chef/repo_to_update/subdirectory
247-
hugo mod clean
248-
```
168+
```sh
169+
hugo mod get -u github.com/<ORG>/<REPO>/<SUBDIRECTORY>@<GIT_SHA>
170+
```
249171

250-
Then [vendor](#hugo-vendoring) the documentation:
172+
1. Update the vendored content.
251173

252-
```bash
253-
hugo mod vendor
254-
```
174+
```sh
175+
rm -rf _vendor
176+
hugo mod tidy
177+
hugo mod vendor
178+
```
255179

256180
For example, to update the chef-workstation repository:
257181

258182
```bash
259-
hugo mod get github.com/chef/chef-workstation/docs-chef-io
260-
hugo mod clean
183+
hugo mod get -u github.com/chef/chef-workstation/docs-chef-io
184+
rm -rf _vendor
185+
hugo mod tidy
261186
hugo mod vendor
262187
```
263188

264189
This will update that repository to the most recent commit.
265190

266-
You can also update a module to a commit version number. For example:
191+
You can also update a module to a repository tag. For example:
267192

268193
```sh
269194
hugo mod get github.com/chef/chef-workstation/[email protected]
270-
hugo mod clean
195+
rm -rf _vendor
196+
hugo mod tidy
271197
hugo mod vendor
272198
```
273199

274200
And you can update a module to a Git commit. For example:
275201

276202
```sh
277203
hugo mod get github.com/chef/chef-workstation/docs-chef-io@0ad84dd5fa8
278-
hugo mod clean
204+
rm -rf _vendor
205+
hugo mod tidy
279206
hugo mod vendor
280207
```
281208

282-
The `hugo mod clean` command removes references to commits in the
283-
`go.mod` and `go.sum` files that are no longer relevant.
284-
285-
See Hugo's [documentation](https://gohugo.io/hugo-modules/use-modules/#update-modules)
286-
for additional information about updating Hugo Modules.
287-
288-
### Update chef-docs-theme module
289-
290-
The theme for this site is sourced from [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme).
291-
292-
Run `make update_theme` to update the theme module and Node package dependencies.
209+
See [Hugo's documentation](https://gohugo.io/hugo-modules/use-modules/#update-modules) for additional information about updating Hugo Modules.
293210
294211
### What if Hugo doesn't update a module
295212

296213
Sometimes Hugo and Git are a bit difficult and won't update a module cleanly or will leave
297214
references to older commits of a module in the `go.sum` file.
298215
299216
If you get an error indicating that Git can't find a repository that's already
300-
added as a module, try restarting your computer.
217+
added as a module, try cleaning your Hugo cache using `hugo mod clean`, and if that doesn't work, restart your computer.
301218

302219
If you still having trouble, try rebuilding the `go.mod` and `go.sum` files:
303220

@@ -314,6 +231,82 @@ If you still having trouble, try rebuilding the `go.mod` and `go.sum` files:
314231
and `go.sum` files, but it can't hurt either.
315232
1. Vendor the modules in chef-web-docs, `hugo mod vendor`.
316233

234+
## Docs site theme
235+
236+
The theme for this site is sourced from [chef/chef-docs-theme](https://github.com/chef/chef-docs-theme).
237+
238+
### Update theme
239+
240+
Run `make update_theme` to update the site theme.
241+
242+
### Update theme Javascript dependencies
243+
244+
We source Javascript dependencies in the chef/chef-docs-theme repository using Node and GitHub.
245+
246+
#### Node dependencies
247+
248+
To update first-level Node dependencies:
249+
250+
1. Update the dependency in the [chef/chef-docs-theme package.hugo.json file](https://github.com/chef/chef-docs-theme/blob/main/package.hugo.json).
251+
2. Update the [package.json file in chef/chef-docs-theme](https://github.com/chef/chef-docs-theme/blob/main/package.json) by running `hugo mod npm pack`
252+
3. Commit the package file updates to main in chef/chef-docs-theme.
253+
4. Update the theme in this repo by running `make update_theme`.
254+
255+
To update transitive Node dependencies in this repo:
256+
257+
- Run `npm update`.
258+
259+
#### Javascript dependencies imported with Hugo
260+
261+
We use Hugo to import JavaScript dependencies from GitHub repositories. You can see the full list in either the chef/chef-docs-theme [go.mod file](https://github.com/chef/chef-docs-theme/blob/main/go.mod) or the [`hugo.toml` file](https://github.com/chef/chef-docs-theme/blob/main/hugo.toml).
262+
263+
To update these dependencies, follow these steps:
264+
265+
1. Update the dependency in the go.mod file in chef/chef-docs-theme using the [`hugo mod get -u` command](https://gohugo.io/commands/hugo_mod_get/).
266+
2. Tidy the go.sum file with `hugo mod tidy`.
267+
3. Commit the changes to chef/chef-docs-theme
268+
4. Update the theme contents in this repo with `make update_theme`.
269+
270+
### Local theme testing
271+
272+
You can test local changes made to the chef-docs-theme repository and preview those changes using Hugo's local development server.
273+
To do this, create a Go workspace file that modifies the source of Hugo's modules, source the workspace file, and start the local server.
274+
275+
For example:
276+
277+
1. Create a `hugo.work` file in root of this project.
278+
279+
1. Add the following config information to the `hugo.work` file:
280+
281+
```go
282+
go 1.22
283+
284+
use .
285+
use ../path/to/local/chef-docs-theme
286+
```
287+
288+
1. Start the Hugo local server:
289+
290+
```sh
291+
make test_theme
292+
```
293+
294+
This command adds the `hugo.work` file to the Hugo workspace and then ignores the contents of `chef-docs-theme` repo in the `_vendor` directory.
295+
296+
## Edit on GitHub links
297+
298+
We use a partial `edit_on_github.html` to add "Edit on GitHub" links to each page.
299+
300+
Each page should have a `gh_repo` parameter set to the value of the GitHub repository
301+
that the page comes from. For example, `gh_repo = "chef-server"`
302+
303+
Each repository with documentation has a `config.toml` file with a `params.<REPOSITORY>`
304+
map and a `gh_path` parameter set to the path of the docs content directory in
305+
that repository.
306+
307+
The `edit_on_github` partial appends the page file name to the end of `gh_path`
308+
parameter and adds the link to the text of the page.
309+
317310
## Release notes
318311

319312
Release notes are added to release notes pages using Hugo's [`resource.getRemote` function](https://gohugo.io/hugo-pipes/introduction/#get-resource-with-resourcesget-and-resourcesgetremote) and content from [https://omnitruck.chef](omnitruck.chef.io) and [https://packages.chef.io](packages.chef.io).
@@ -362,7 +355,7 @@ The commit history of this repo before February 12, 2016 has been archived to th
362355
We love getting feedback. You can use:
363356

364357
- Each page has a feedback form at the bottom of the page.
365-
- Email --- Send an email to chef-docs@progress.com for documentation bugs,
358+
- Email --- Send an email to <[email protected]> for documentation bugs,
366359
ideas, thoughts, and suggestions. This email address isn't a
367360
support email address, however. If you need support, contact Chef
368361
support.

0 commit comments

Comments
 (0)