-
Notifications
You must be signed in to change notification settings - Fork 157
Make VuePress base, dest and sitemap hostname configurable #1663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| v16 | ||
| v18 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * Docs build configuration. | ||
| * Override any of these via environment variables: | ||
| * DOCS_BASE — public base path (must start and end with `/`) | ||
| * DOCS_DEST — output directory (relative to repo root) | ||
| * DOCS_HOSTNAME — absolute origin used for the sitemap | ||
| */ | ||
| module.exports = { | ||
| base: '/docs/', | ||
| dest: 'docs/.vuepress/dist/docs', | ||
| hostname: 'https://hyperformula.handsontable.com', | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,26 @@ const includeCodeSnippet = require('./plugins/markdown-it-include-code-snippet') | |
|
|
||
| const searchPattern = new RegExp('^/api', 'i'); | ||
|
|
||
| // Build configuration (override via env vars or docs/.vuepress/build.config.js) | ||
| const buildConfigOverrides = (() => { | ||
| try { | ||
| return require('./build.config.js'); | ||
| } catch (e) { | ||
| return {}; | ||
| } | ||
| })(); | ||
|
|
||
| const normalizeBase = (b) => { | ||
| if (!b) return '/'; | ||
| let v = b.startsWith('/') ? b : '/' + b; | ||
| if (!v.endsWith('/')) v += '/'; | ||
| return v; | ||
| }; | ||
|
|
||
| const DOCS_BASE = normalizeBase(process.env.DOCS_BASE || buildConfigOverrides.base || '/'); | ||
| const DOCS_DEST = process.env.DOCS_DEST || buildConfigOverrides.dest || 'docs/.vuepress/dist'; | ||
| const DOCS_HOSTNAME = process.env.DOCS_HOSTNAME || buildConfigOverrides.hostname || 'https://hyperformula.handsontable.com'; | ||
|
|
||
| module.exports = { | ||
| title: 'HyperFormula (v' + HyperFormula.version + ')', | ||
| description: 'HyperFormula is an open-source, high-performance calculation engine for spreadsheets and web applications.', | ||
|
|
@@ -61,10 +81,11 @@ module.exports = { | |
| ['link', { rel: 'manifest', href: '/favicon/site.webmanifest' }], | ||
| ['link', { rel: 'mask-icon', color: '#ffffff', href: '/favicon/safari-pinned-tab.svg' }], | ||
| ], | ||
| base: '/', | ||
| base: DOCS_BASE, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-root base breaks hardcoded head asset pathsHigh Severity Changing Additional Locations (1)Reviewed by Cursor Bugbot for commit 67f6148. Configure here. |
||
| dest: DOCS_DEST, | ||
| plugins: [ | ||
| ['sitemap', { | ||
| hostname: 'https://hyperformula.handsontable.com', | ||
| hostname: DOCS_HOSTNAME, | ||
| exclude: ['/404.html'], | ||
| changefreq: 'weekly' | ||
| }], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| [build] | ||
| command = "npm run docs:build" | ||
| publish = "docs/.vuepress/dist/docs" | ||
|
|
||
| [build.environment] | ||
| NODE_VERSION = "18" |


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New default base breaks hardcoded favicon head paths
Medium Severity
Setting the default
baseto'/docs/'causes the existingheadentries for favicons and the web manifest to break. VuePress 1.x does not auto-prependbasetohrefattributes inheadconfig entries. The five favicon/manifest links still reference/favicon/...instead of/docs/favicon/..., so they will 404 when deployed under the new default sub-path.Additional Locations (1)
docs/.vuepress/config.js#L83-L84Reviewed by Cursor Bugbot for commit 1c77a8b. Configure here.