From 580fee0066c45946094a9cecb693fc4fce7da4df Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Fri, 10 Nov 2023 15:52:28 +0100 Subject: [PATCH] Offer Docsy as a single Hugo Module (#1217) --- .../assets => assets}/bootstrap/README.txt | 0 .../bootstrap/scss/_vendor/README.txt | 0 .../bootstrap/scss/_vendor/_rfs.scss | 0 dependencies/config.toml | 43 ------------------- dependencies/go.mod | 8 ---- dependencies/go.sum | 6 --- go.mod | 1 - go.sum | 6 --- hugo.yaml | 19 ++++++++ netlify.toml | 2 +- package.json | 2 + 11 files changed, 22 insertions(+), 65 deletions(-) rename {dependencies/assets => assets}/bootstrap/README.txt (100%) rename {dependencies/assets => assets}/bootstrap/scss/_vendor/README.txt (100%) rename {dependencies/assets => assets}/bootstrap/scss/_vendor/_rfs.scss (100%) delete mode 100644 dependencies/config.toml delete mode 100644 dependencies/go.mod delete mode 100644 dependencies/go.sum diff --git a/dependencies/assets/bootstrap/README.txt b/assets/bootstrap/README.txt similarity index 100% rename from dependencies/assets/bootstrap/README.txt rename to assets/bootstrap/README.txt diff --git a/dependencies/assets/bootstrap/scss/_vendor/README.txt b/assets/bootstrap/scss/_vendor/README.txt similarity index 100% rename from dependencies/assets/bootstrap/scss/_vendor/README.txt rename to assets/bootstrap/scss/_vendor/README.txt diff --git a/dependencies/assets/bootstrap/scss/_vendor/_rfs.scss b/assets/bootstrap/scss/_vendor/_rfs.scss similarity index 100% rename from dependencies/assets/bootstrap/scss/_vendor/_rfs.scss rename to assets/bootstrap/scss/_vendor/_rfs.scss diff --git a/dependencies/config.toml b/dependencies/config.toml deleted file mode 100644 index a701110574..0000000000 --- a/dependencies/config.toml +++ /dev/null @@ -1,43 +0,0 @@ -[module] -_merge = "deep" -# work around https://github.com/golang/go/issues/37397 -[[module.mounts]] - source = "assets/bootstrap/scss/_vendor" - target = "assets/vendor/bootstrap/scss/vendor" -# mount asserts directory -[[module.mounts]] - source = "assets" - target = "assets" -# mount i18n directory -[[module.mounts]] - source = "i18n" - target = "i18n" -# mount layouts directory -[[module.mounts]] - source = "layouts" - target = "layouts" -# mount static directory -[[module.mounts]] - source = "static" - target = "static" -# Dependencies are brought in as modules -# and mount points are declared -[[module.imports]] - path = "github.com/twbs/bootstrap" - disable = false - ignoreConfig = true -[[module.imports.mounts]] - source = "scss" - target = "assets/vendor/bootstrap/scss" -[[module.imports.mounts]] - source = "dist/js" - target = "assets/vendor/bootstrap/dist/js" -[[module.imports]] - path = "github.com/FortAwesome/Font-Awesome" - disable = false -[[module.imports.mounts]] - source = "scss" - target = "assets/vendor/Font-Awesome/scss" -[[module.imports.mounts]] - source = "webfonts" - target = "static/webfonts" diff --git a/dependencies/go.mod b/dependencies/go.mod deleted file mode 100644 index 23c33c76de..0000000000 --- a/dependencies/go.mod +++ /dev/null @@ -1,8 +0,0 @@ -module github.com/google/docsy/dependencies - -go 1.12 - -require ( - github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 // indirect - github.com/twbs/bootstrap v5.2.3+incompatible // indirect -) diff --git a/dependencies/go.sum b/dependencies/go.sum deleted file mode 100644 index 403c1f58cb..0000000000 --- a/dependencies/go.sum +++ /dev/null @@ -1,6 +0,0 @@ -github.com/FortAwesome/Font-Awesome v0.0.0-20230207192303-d02961b01815 h1:IgbtROhk8s9GkcNxrqFKAzR5rmDwV/QQ4Y31pb6crM8= -github.com/FortAwesome/Font-Awesome v0.0.0-20230207192303-d02961b01815/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= -github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 h1:Uv1z5EqCfmiK4IHUwT0m3h/u/WCk+kpRfxvAZhpC7Gc= -github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= -github.com/twbs/bootstrap v5.2.3+incompatible h1:lOmsJx587qfF7/gE7Vv4FxEofegyJlEACeVV+Mt7cgc= -github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= diff --git a/go.mod b/go.mod index de343757a8..4a5e22262d 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,5 @@ go 1.12 require ( github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 // indirect - github.com/google/docsy/dependencies v0.7.2 // indirect github.com/twbs/bootstrap v5.2.3+incompatible // indirect ) diff --git a/go.sum b/go.sum index 0ab0330fe6..2c81b8a9ad 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,4 @@ -github.com/FortAwesome/Font-Awesome v0.0.0-20230207192303-d02961b01815 h1:IgbtROhk8s9GkcNxrqFKAzR5rmDwV/QQ4Y31pb6crM8= -github.com/FortAwesome/Font-Awesome v0.0.0-20230207192303-d02961b01815/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2 h1:Uv1z5EqCfmiK4IHUwT0m3h/u/WCk+kpRfxvAZhpC7Gc= github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo= -github.com/google/docsy/dependencies v0.6.1-0.20230125095517-798c2504905e h1:lfvr9ByCkuIz/ARoEDC/6gucVRjkooYTts5P+0yq5Qk= -github.com/google/docsy/dependencies v0.6.1-0.20230125095517-798c2504905e/go.mod h1:qhtpynRkDn1FOmD1gj0a5n6ptDjDw0O4Zmb+6pfYUKU= -github.com/google/docsy/dependencies v0.6.1-0.20230601182954-ff1818261e64 h1:ZBeOh/qGThEUn/r4vPXyfKXYKvMPmHgGS1BgQI8Xf2E= -github.com/google/docsy/dependencies v0.6.1-0.20230601182954-ff1818261e64/go.mod h1:gihhs5gmgeO+wuoay4FwOzob+jYJVyQbNaQOh788lD4= github.com/twbs/bootstrap v5.2.3+incompatible h1:lOmsJx587qfF7/gE7Vv4FxEofegyJlEACeVV+Mt7cgc= github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0= diff --git a/hugo.yaml b/hugo.yaml index a6581d8161..f92c273bb5 100644 --- a/hugo.yaml +++ b/hugo.yaml @@ -42,3 +42,22 @@ module: target: assets/vendor/Font-Awesome - source: ../../node_modules/@fortawesome/fontawesome-free/webfonts target: static/webfonts + # Mounts for module installations, + # needed to work around a known bug in Go’s module management. + - source: assets/bootstrap/scss/_vendor + target: assets/vendor/bootstrap/scss/vendor + imports: + - path: github.com/twbs/bootstrap + disable: false + mounts: + - source: scss + target: assets/vendor/bootstrap/scss + - source: dist/js + target: assets/vendor/bootstrap/dist/js + - path: github.com/FortAwesome/Font-Awesome + disable: false + mounts: + - source: scss + target: assets/vendor/Font-Awesome/scss + - source: webfonts + target: static/webfonts diff --git a/netlify.toml b/netlify.toml index a5ed464f48..cb0b5781e1 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,7 +6,7 @@ publish = "userguide/public" command = "npm run docs-install && npm run build:preview" [build.environment] -GO_VERSION = "1.19.5" +GO_VERSION = "1.21.4" HUGO_THEME = "repo" [context.production] diff --git a/package.json b/package.json index e580a24ef6..1fc2ad1184 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "docs-install": "npm run _cd:docs -- npm install", "fix:format": "npm run _check:format -- --write", "get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 1}", + "postinstall": "npx mkdirp ../github.com/FortAwesome/Font-Awesome ../github.com/twbs/bootstrap", "serve": "npm run cd:docs serve", "test": "npm run cd:docs test", "update:pkg:hugo": "npm install --save-exact -D hugo-extended@latest", @@ -31,6 +32,7 @@ "devDependencies": { "hugo-extended": "0.120.4", "markdown-link-check": "^3.11.2", + "mkdirp": "^3.0.1", "prettier": "^3.0.3" }, "engines": {