From 8a911be2018ec6e8c8a7a4b1b086a8200dae9f73 Mon Sep 17 00:00:00 2001 From: Daniel Holbach Date: Wed, 22 Jun 2022 17:19:29 +0200 Subject: [PATCH] Move to docsy as Hugo module Fixes: #889 Signed-off-by: Daniel Holbach --- .github/dependabot.yml | 2 +- .gitignore | 4 -- .stignore | 2 - Makefile | 46 +++-------------- README.md | 1 - assets/scss/main.scss | 2 +- config.yaml | 49 +++++++++++++++++-- .../flux/migration/helm-operator-migration.md | 3 +- go.mod | 9 ++++ go.sum | 8 +++ netlify.toml | 1 + okteto.yml | 2 +- 12 files changed, 75 insertions(+), 54 deletions(-) create mode 100644 go.mod create mode 100644 go.sum diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 574a2df76..b14c9e59e 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,7 +9,7 @@ updates: directory: "/" # Location of package manifests schedule: interval: "daily" - - package-ecosystem: "gitsubmodule" + - package-ecosystem: "gomod" directory: "/" # Location of package manifests schedule: interval: "daily" diff --git a/.gitignore b/.gitignore index 1e6bb62e2..c4f855276 100644 --- a/.gitignore +++ b/.gitignore @@ -5,10 +5,6 @@ node_modules/ .hugo_build.lock public/ resources/ -themes/docsy -themes/docsy-* -themes/hugo-shortcode-gallery -themes/hugo-shortcode-gallery-* # clone of gohugoio/hugo for docker-support hugo/ diff --git a/.stignore b/.stignore index a8eb87cb2..80a51307a 100644 --- a/.stignore +++ b/.stignore @@ -10,8 +10,6 @@ _tmp # These are generated or imported by hack/* public/ -# Output of "make theme" -themes/ !content/en/flux/components/*/_index.md content/en/flux/components/*/*.md diff --git a/Makefile b/Makefile index b0d999e2e..ff64c82cf 100644 --- a/Makefile +++ b/Makefile @@ -3,13 +3,6 @@ BLOCK_STDOUT_CMD := python -c "import os,sys,fcntl; \ flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); \ fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);" -DOCSY_COMMIT ?= 7489c354a3ca873182e4748ba7bb57cea2d7f468 -DOCSY_COMMIT_FOLDER := docsy-$(DOCSY_COMMIT) -DOCSY_TARGET := themes/$(DOCSY_COMMIT_FOLDER) -GALLERY_COMMIT ?= c7d1cd23f718bb74e25a769d5e72443539fb49f8 -GALLERY_COMMIT_FOLDER := hugo-shortcode-gallery-$(GALLERY_COMMIT) -GALLERY_TARGET := themes/$(GALLERY_COMMIT_FOLDER) - DEV_IMAGE_REGISTRY_NAME ?= fluxcd HUGO_VERSION ?= $(shell grep HUGO_VERSION netlify.toml | cut -d'"' -f2) HUGO_IMAGE_BASE_NAME := website:hugo-$(HUGO_VERSION)-extended @@ -25,28 +18,8 @@ help: ## Display this help menu. @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) .PHONY: help -theme: $(DOCSY_TARGET) $(GALLERY_TARGET) ## Downloads the themes. - -$(DOCSY_TARGET): ## Downloads the Docsy theme. - mkdir -p themes/ - rm -rf themes/docsy - curl -Lfs "https://github.com/google/docsy/archive/${DOCSY_COMMIT}.tar.gz" -o "/tmp/${DOCSY_COMMIT_FOLDER}.tar.gz" - tar -zxf "/tmp/${DOCSY_COMMIT_FOLDER}.tar.gz" --directory themes/ - mv themes/${DOCSY_COMMIT_FOLDER} themes/docsy - ln -sf docsy themes/${DOCSY_COMMIT_FOLDER} - cd themes/docsy && npm install - cd themes/docsy/assets && ln -s ../node_modules vendor - cd themes/docsy/assets/vendor && \ - ln -s ../node_modules vendor && \ - ln -s @fortawesome/fontawesome-free/ Font-Awesome - -$(GALLERY_TARGET): ## Downloads the hugo-shortcode-gallery theme. - mkdir -p themes/ - rm -rf themes/hugo-shortcode-gallery - curl -Lfs "https://github.com/mfg92/hugo-shortcode-gallery/archive/${GALLERY_COMMIT}.tar.gz" -o "/tmp/${GALLERY_COMMIT_FOLDER}.tar.gz" - tar -zxf "/tmp/${GALLERY_COMMIT_FOLDER}.tar.gz" --directory themes/ - mv themes/${GALLERY_COMMIT_FOLDER} themes/hugo-shortcode-gallery - ln -sf hugo-shortcode-gallery themes/${GALLERY_COMMIT_FOLDER} +prereqs: + npm install gen-content: ## Generates content from external sources. hack/adopters.py @@ -55,21 +28,21 @@ gen-content: ## Generates content from external sources. hack/import-calendar.py hack/import-flux2-assets.sh -serve: gen-content theme ## Spawns a development server. +serve: gen-content prereqs ## Spawns a development server. hugo server \ --bind ${HUGO_BIND_ADDRESS} \ --buildDrafts \ --buildFuture \ --disableFastRender -production-build: gen-content theme ## Builds production build. +production-build: gen-content prereqs ## Builds production build. hugo \ --baseURL $(URL) \ --gc \ --minify \ --enableGitInfo -preview-build: gen-content theme ## Builds a preview build (for e.g. a pull requests). +preview-build: gen-content prereqs ## Builds a preview build (for e.g. a pull requests). hugo \ --baseURL $(DEPLOY_PRIME_URL) \ --buildFuture \ @@ -77,7 +50,7 @@ preview-build: gen-content theme ## Builds a preview build (for e.g. a pull requ --minify \ --enableGitInfo -branch-build: gen-content theme ## Builds a Git branch (for e.g. development branches). +branch-build: gen-content prereqs ## Builds a Git branch (for e.g. development branches). hugo \ --baseURL $(DEPLOY_PRIME_URL) \ --buildDrafts \ @@ -87,12 +60,7 @@ branch-build: gen-content theme ## Builds a Git branch (for e.g. development bra --enableGitInfo .PHONY: docker-preview -docker-preview: docker-theme docker-serve - -.PHONY: docker-theme -docker-theme: - docker run -v $(shell pwd):/site -it $(SUPPORT_IMAGE_NAME) \ - make \"MAKEFLAGS=$(MAKEFLAGS)\" theme +docker-preview: docker-serve .PHONY: docker-serve docker-serve: diff --git a/README.md b/README.md index 7eb0baaef..f9a6aba8f 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ Once those tools are installed, fetch the assets necessary to run the site: ```cli npm install -make theme python3 -m pip install -r requirements.txt ``` diff --git a/assets/scss/main.scss b/assets/scss/main.scss index 272320355..b08aabbdf 100644 --- a/assets/scss/main.scss +++ b/assets/scss/main.scss @@ -1,5 +1,5 @@ @import "variables_project"; -@import "../../themes/docsy/assets/scss/main.scss"; +@import "docsy/main.scss"; @import "buttons"; @import "blocks/blocks"; @import "adopters"; diff --git a/config.yaml b/config.yaml index f43cdc52b..317074ce5 100644 --- a/config.yaml +++ b/config.yaml @@ -4,16 +4,58 @@ enableRobotsTXT: true enableEmoji: true # Language configuration -contentDir: content/en defaultContentLanguage: en defaultContentLanguageInSubdir: false enableMissingTranslationPlaceholders: true -theme: [docsy, hugo-shortcode-gallery] - # Provide .LastMod values enableGitInfo: true +module: + proxy: direct + hugoVersion: + extended: true + imports: + - path: github.com/google/docsy + disable: false + mounts: + # The following entry is the one we actually need, to be able to + # refer to it in our own assets/scss files. + - source: assets/scss + target: assets/scss/docsy + # Unfortunately that means we need to redefine all of Docsy's + # module mounts here... + # https://github.com/google/docsy/commit/215f68033bbc7bddf8dbec2bbabf8749d1998a17 (lines 24f) + # + # I hope this use-case will be simplified one day. + - source: content + target: content + - source: static + target: static + - source: layouts + target: layouts + - source: data + target: data + - source: assets + target: assets + - source: i18n + target: i18n + - source: archetypes + target: archetypes + - source: node_modules/bootstrap + target: assets/vendor/bootstrap + - source: node_modules/@fortawesome/fontawesome-free + target: assets/vendor/Font-Awesome + - source: node_modules/@fortawesome/fontawesome-free/webfonts + target: static/webfonts + - path: github.com/google/docsy/dependencies + disable: false + - path: github.com/mfg92/hugo-shortcode-gallery + disable: false + mounts: + - source: content/en + target: content + # Markup settings # Ref: https://gohugo.io/getting-started/configuration-markup#goldmark markup: @@ -33,7 +75,6 @@ languages: languageCode: en time_format_default: 2006-01-02 time_format_blog: 2006-01-02 - contentDir: content/en permalinks: blog: /:section/:year/:month/:slug/ diff --git a/content/en/flux/migration/helm-operator-migration.md b/content/en/flux/migration/helm-operator-migration.md index acd6b5366..c24e5c8a0 100644 --- a/content/en/flux/migration/helm-operator-migration.md +++ b/content/en/flux/migration/helm-operator-migration.md @@ -862,7 +862,8 @@ Probably, but with some side notes: Helm Controller depends on [Source Controller](../components/source/_index.md), you can install both controllers and manager Helm releases in a declarative way without GitOps. -For more details please see this [answer]({{< ref "flux/faq/_index.md#can-i-use-flux-helmreleases-without-gitops" >}}). + +For more details please see this [answer]({{< relref "../faq.md#can-i-use-flux-helmreleases-without-gitops" >}}). ### I have another question diff --git a/go.mod b/go.mod new file mode 100644 index 000000000..88d174eae --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module github.com/fluxcd/website + +go 1.18 + +require ( + github.com/google/docsy v0.5.1-0.20221017155306-99eacb09ffb0 // indirect + github.com/google/docsy/dependencies v0.5.1-0.20221017155306-99eacb09ffb0 // indirect + github.com/mfg92/hugo-shortcode-gallery v0.0.0-20221009204324-c7d1cd23f718 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 000000000..d771f16ca --- /dev/null +++ b/go.sum @@ -0,0 +1,8 @@ +github.com/FortAwesome/Font-Awesome v0.0.0-20220831210243-d3a7818c253f/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= +github.com/google/docsy v0.5.1-0.20221017155306-99eacb09ffb0 h1:BAyzzjQTB5MxdWaXT/n1uCY4L0KBOJ7VAkKks69n9LU= +github.com/google/docsy v0.5.1-0.20221017155306-99eacb09ffb0/go.mod h1:nbAerLgCh3rTKPxh3njZK5EadG4jPzrVs+07VYn1SkQ= +github.com/google/docsy/dependencies v0.5.1-0.20221017155306-99eacb09ffb0 h1:at2I9lLiAiPOdQxRKiT0vOv3oRcSGESIM23MdUvt2gw= +github.com/google/docsy/dependencies v0.5.1-0.20221017155306-99eacb09ffb0/go.mod h1:EDGc2znMbGUw0RW5kWwy2oGgLt0iVXBmoq4UOqstuNE= +github.com/mfg92/hugo-shortcode-gallery v0.0.0-20221009204324-c7d1cd23f718 h1:MA/Morgm61jTM0W7hhnWWA4XD0GBLnAJsaepRsNS8Us= +github.com/mfg92/hugo-shortcode-gallery v0.0.0-20221009204324-c7d1cd23f718/go.mod h1:uP48acoDrLxll/agXBGFRWEv5F237K3XKWyAeVZ+Mm8= +github.com/twbs/bootstrap v4.6.2+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= diff --git a/netlify.toml b/netlify.toml index fd9db6576..697dd4bf3 100644 --- a/netlify.toml +++ b/netlify.toml @@ -5,6 +5,7 @@ [build.environment] HUGO_VERSION = "0.104.3" NODE_VERSION = "16" + GO_VERSION = "1.18" [context.production.environment] HUGO_ENV = "production" diff --git a/okteto.yml b/okteto.yml index 9f3aac133..b85192d6a 100644 --- a/okteto.yml +++ b/okteto.yml @@ -5,7 +5,7 @@ workdir: /site command: - sh - -c - - make theme; make serve + - make serve autocreate: true forward: - 1313:1313