chore(js): Unbundle assets in Hugo development and testing environments:
- Keep assets unbundled for easier debugging in development and testing. - Copies other config from development to testing.pull/6079/head
parent
c43df7508f
commit
13129c5687
|
@ -41,7 +41,7 @@ jobs:
|
||||||
- /home/circleci/bin
|
- /home/circleci/bin
|
||||||
- run:
|
- run:
|
||||||
name: Hugo Build
|
name: Hugo Build
|
||||||
command: npx hugo --logLevel info --minify --destination workspace/public
|
command: npx hugo --config config/production/config.yml --logLevel info --minify --destination workspace/public
|
||||||
- persist_to_workspace:
|
- persist_to_workspace:
|
||||||
root: workspace
|
root: workspace
|
||||||
paths:
|
paths:
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Production overrides for CI/CD builds
|
||||||
|
baseURL: 'https://docs.influxdata.com/'
|
||||||
|
|
||||||
|
# Production environment parameters
|
||||||
|
params:
|
||||||
|
env: production
|
||||||
|
environment: production
|
||||||
|
|
||||||
|
# Enable minification for production
|
||||||
|
minify:
|
||||||
|
disableJS: false
|
||||||
|
disableCSS: false
|
||||||
|
disableHTML: false
|
||||||
|
minifyOutput: true
|
||||||
|
|
||||||
|
# Production asset processing
|
||||||
|
build:
|
||||||
|
writeStats: false
|
||||||
|
useResourceCacheWhen: "always"
|
||||||
|
buildOptions:
|
||||||
|
sourcemap: false
|
||||||
|
target: "es2015"
|
||||||
|
|
||||||
|
# Disable development server settings
|
||||||
|
server: {}
|
|
@ -1,20 +1,111 @@
|
||||||
baseURL: 'http://localhost:1315/'
|
baseURL: 'http://localhost:1315/'
|
||||||
|
languageCode: en-us
|
||||||
|
title: InfluxDB Documentation
|
||||||
|
|
||||||
server:
|
# Git history information for lastMod-type functionality
|
||||||
port: 1315
|
enableGitInfo: true
|
||||||
|
|
||||||
|
# Syntax Highlighting
|
||||||
|
pygmentsCodefences: true
|
||||||
|
pygmentsUseClasses: true
|
||||||
|
|
||||||
|
# Preserve case in article tags
|
||||||
|
preserveTaxonomyNames: true
|
||||||
|
|
||||||
|
# Generate a robots.txt
|
||||||
|
enableRobotsTXT: true
|
||||||
|
|
||||||
# Override settings for testing
|
# Override settings for testing
|
||||||
buildFuture: true
|
buildFuture: true
|
||||||
|
|
||||||
# Configure what content is built in testing env
|
# Configure what content is built in testing env
|
||||||
params:
|
params:
|
||||||
|
env: testing
|
||||||
environment: testing
|
environment: testing
|
||||||
buildTestContent: true
|
buildTestContent: true
|
||||||
|
|
||||||
|
# Server configuration for testing
|
||||||
|
server:
|
||||||
|
port: 1315
|
||||||
|
baseURL: 'http://localhost:1315/'
|
||||||
|
watchChanges: true
|
||||||
|
disableLiveReload: false
|
||||||
|
|
||||||
# Keep your shared content exclusions
|
# Keep your shared content exclusions
|
||||||
ignoreFiles:
|
ignoreFiles:
|
||||||
- "content/shared/.*"
|
- "content/shared/.*"
|
||||||
|
|
||||||
# Ignore specific warning logs
|
# Ignore specific warning logs
|
||||||
ignoreLogs:
|
ignoreLogs:
|
||||||
- warning-goldmark-raw-html
|
- warning-goldmark-raw-html
|
||||||
|
|
||||||
|
# Markdown rendering options
|
||||||
|
blackfriday:
|
||||||
|
hrefTargetBlank: true
|
||||||
|
smartDashes: false
|
||||||
|
|
||||||
|
# Copy taxonomies from main config
|
||||||
|
taxonomies:
|
||||||
|
influxdb/v2/tag: influxdb/v2/tags
|
||||||
|
influxdb/cloud/tag: influxdb/cloud/tags
|
||||||
|
influxdb3/cloud-serverless/tag: influxdb/cloud-serverless/tags
|
||||||
|
influxdb3/cloud-dedicated/tag: influxdb/cloud-dedicated/tags
|
||||||
|
influxdb3/clustered/tag: influxdb3/clustered/tags
|
||||||
|
influxdb3/core/tag: influxdb3/core/tags
|
||||||
|
influxdb3/enterprise/tag: influxdb3/enterprise/tags
|
||||||
|
flux/v0/tag: flux/v0/tags
|
||||||
|
|
||||||
|
# Markup configuration
|
||||||
|
markup:
|
||||||
|
goldmark:
|
||||||
|
renderer:
|
||||||
|
unsafe: true
|
||||||
|
extensions:
|
||||||
|
linkify: false
|
||||||
|
parser:
|
||||||
|
attribute:
|
||||||
|
block: true
|
||||||
|
|
||||||
|
# Privacy settings
|
||||||
|
privacy:
|
||||||
|
googleAnalytics:
|
||||||
|
anonymizeIP: false
|
||||||
|
disable: false
|
||||||
|
respectDoNotTrack: true
|
||||||
|
useSessionStorage: false
|
||||||
|
youtube:
|
||||||
|
disable: false
|
||||||
|
privacyEnhanced: true
|
||||||
|
|
||||||
|
# Output formats
|
||||||
|
outputFormats:
|
||||||
|
json:
|
||||||
|
mediaType: application/json
|
||||||
|
baseName: pages
|
||||||
|
isPlainText: true
|
||||||
|
|
||||||
|
# Asset processing for testing (disable minification)
|
||||||
|
build:
|
||||||
|
writeStats: true
|
||||||
|
useResourceCacheWhen: "fallback"
|
||||||
|
buildOptions:
|
||||||
|
sourcemap: "inline"
|
||||||
|
target: "es2020"
|
||||||
|
|
||||||
|
# Disable minification for testing
|
||||||
|
minify:
|
||||||
|
disableJS: true
|
||||||
|
disableCSS: true
|
||||||
|
disableHTML: true
|
||||||
|
minifyOutput: false
|
||||||
|
|
||||||
|
# Asset processing configuration
|
||||||
|
assetDir: "assets"
|
||||||
|
|
||||||
|
# Module mounts
|
||||||
|
module:
|
||||||
|
mounts:
|
||||||
|
- source: assets
|
||||||
|
target: assets
|
||||||
|
- source: node_modules
|
||||||
|
target: assets/node_modules
|
|
@ -17,7 +17,26 @@ enableRobotsTXT: true
|
||||||
|
|
||||||
# Custom staging params
|
# Custom staging params
|
||||||
params:
|
params:
|
||||||
|
env: staging
|
||||||
environment: staging
|
environment: staging
|
||||||
|
server:
|
||||||
|
disableLiveReload: true
|
||||||
|
|
||||||
|
# Staging uses the same asset processing as production
|
||||||
|
# Enable minification for staging
|
||||||
|
minify:
|
||||||
|
disableJS: false
|
||||||
|
disableCSS: false
|
||||||
|
disableHTML: false
|
||||||
|
minifyOutput: true
|
||||||
|
|
||||||
|
# Staging asset processing
|
||||||
|
build:
|
||||||
|
writeStats: false
|
||||||
|
useResourceCacheWhen: "always"
|
||||||
|
buildOptions:
|
||||||
|
sourcemap: false
|
||||||
|
target: "es2015"
|
||||||
|
|
||||||
# Markdown rendering options
|
# Markdown rendering options
|
||||||
blackfriday:
|
blackfriday:
|
||||||
|
|
31
hugo.yml
31
hugo.yml
|
@ -55,10 +55,16 @@ outputFormats:
|
||||||
baseName: pages
|
baseName: pages
|
||||||
isPlainText: true
|
isPlainText: true
|
||||||
|
|
||||||
|
# Asset processing configuration for development
|
||||||
build:
|
build:
|
||||||
# Configure JavaScript build settings for ES6 modules
|
|
||||||
writeStats: true
|
writeStats: true
|
||||||
useResourceCacheWhen: "fallback"
|
useResourceCacheWhen: "fallback"
|
||||||
|
# Enable source maps for debugging
|
||||||
|
buildOptions:
|
||||||
|
sourcemap: "inline"
|
||||||
|
target: "es2020"
|
||||||
|
# Disable asset bundling in development
|
||||||
|
noJSConfigInAssets: false
|
||||||
|
|
||||||
# Asset processing configuration
|
# Asset processing configuration
|
||||||
assetDir: "assets"
|
assetDir: "assets"
|
||||||
|
@ -70,11 +76,22 @@ module:
|
||||||
- source: node_modules
|
- source: node_modules
|
||||||
target: assets/node_modules
|
target: assets/node_modules
|
||||||
|
|
||||||
# Ensure proper JavaScript processing in development
|
|
||||||
minify:
|
|
||||||
disableJS: true
|
|
||||||
minifyOutput: false
|
|
||||||
|
|
||||||
# Development settings
|
# Development settings
|
||||||
params:
|
params:
|
||||||
env: development
|
env: development
|
||||||
|
environment: development
|
||||||
|
|
||||||
|
# Configure the server for development
|
||||||
|
# Specify the port for development to avoid conflicts with testing
|
||||||
|
server:
|
||||||
|
port: 1313
|
||||||
|
baseURL: 'http://localhost:1313/'
|
||||||
|
watchChanges: true
|
||||||
|
disableLiveReload: false
|
||||||
|
|
||||||
|
# Disable minification and bundling for development
|
||||||
|
minify:
|
||||||
|
disableJS: true
|
||||||
|
disableCSS: true
|
||||||
|
disableHTML: true
|
||||||
|
minifyOutput: false
|
||||||
|
|
|
@ -12,21 +12,60 @@
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
{{ $products := .Site.Data.products }}
|
{{ $products := .Site.Data.products }}
|
||||||
{{ $influxdb_urls := .Site.Data.influxdb_urls }}
|
{{ $influxdb_urls := .Site.Data.influxdb_urls }}
|
||||||
<!-- Build index.js -->
|
|
||||||
{{ with resources.Get "js/main.js" }}
|
{{ $isDevelopmentOrTesting := or (eq .Site.Params.environment "development") (eq .Site.Params.environment "testing") (eq (getenv "HUGO_ENV") "development") (eq (getenv "HUGO_ENV") "testing") (not hugo.IsProduction) }}
|
||||||
{{ $opts := dict
|
|
||||||
"minify" hugo.IsProduction
|
{{ if $isDevelopmentOrTesting }}
|
||||||
"sourceMap" (cond hugo.IsProduction "" "external")
|
{{/* Load individual JS files for debugging */}}
|
||||||
"targetPath" "js/main.js"
|
{{ $sharedParams := dict "product" $product "currentVersion" $currentVersion "isServer" hugo.IsServer "products" $products "influxdb_urls" $influxdb_urls "cloudUrls" $cloudUrls }}
|
||||||
"params" (dict "product" $product "currentVersion" $currentVersion "isServer" hugo.IsServer "products" $products "influxdb_urls" $influxdb_urls "cloudUrls" $cloudUrls)
|
|
||||||
}}
|
{{/* Load main.js first to ensure proper initialization */}}
|
||||||
{{ with . | js.Build $opts }}
|
{{ with resources.Get "js/main.js" }}
|
||||||
{{ if hugo.IsProduction }}
|
{{ $opts := dict
|
||||||
{{ with . | fingerprint }}
|
"minify" false
|
||||||
<script defer src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
|
"sourceMap" "inline"
|
||||||
{{ end }}
|
"targetPath" "js/main.js"
|
||||||
{{ else }}
|
"params" $sharedParams
|
||||||
|
}}
|
||||||
|
{{ with . | js.Build $opts }}
|
||||||
<script defer src="{{ .RelPermalink }}"></script>
|
<script defer src="{{ .RelPermalink }}"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
|
{{/* Load other individual JS files for debugging */}}
|
||||||
|
{{ range $file := (readDir "assets/js") }}
|
||||||
|
{{ if and (strings.HasSuffix $file.Name ".js") (ne $file.Name "main.js") }}
|
||||||
|
{{ $jsPath := printf "js/%s" $file.Name }}
|
||||||
|
{{ with resources.Get $jsPath }}
|
||||||
|
{{ $opts := dict
|
||||||
|
"minify" false
|
||||||
|
"sourceMap" "inline"
|
||||||
|
"targetPath" $jsPath
|
||||||
|
"params" $sharedParams
|
||||||
|
}}
|
||||||
|
{{ with . | js.Build $opts }}
|
||||||
|
<script defer src="{{ .RelPermalink }}"></script>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
{{/* Non-development environment: Bundle everything */}}
|
||||||
|
{{ with resources.Get "js/main.js" }}
|
||||||
|
{{ $opts := dict
|
||||||
|
"minify" hugo.IsProduction
|
||||||
|
"sourceMap" (cond hugo.IsProduction "" "external")
|
||||||
|
"targetPath" "js/main.js"
|
||||||
|
"params" (dict "product" $product "currentVersion" $currentVersion "isServer" hugo.IsServer "products" $products "influxdb_urls" $influxdb_urls "cloudUrls" $cloudUrls)
|
||||||
|
}}
|
||||||
|
{{ with . | js.Build $opts }}
|
||||||
|
{{ if hugo.IsProduction }}
|
||||||
|
{{ with . | fingerprint }}
|
||||||
|
<script defer src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
|
||||||
|
{{ end }}
|
||||||
|
{{ else }}
|
||||||
|
<script defer src="{{ .RelPermalink }}"></script>
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
Loading…
Reference in New Issue