Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16
v18
12 changes: 12 additions & 0 deletions docs/.vuepress/build.config.js
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/',
Copy link
Copy Markdown

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 base to '/docs/' causes the existing head entries for favicons and the web manifest to break. VuePress 1.x does not auto-prepend base to href attributes in head config 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)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1c77a8b. Configure here.

dest: 'docs/.vuepress/dist/docs',
hostname: 'https://hyperformula.handsontable.com',
};
25 changes: 23 additions & 2 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
Expand Down Expand Up @@ -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,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-root base breaks hardcoded head asset paths

High Severity

Changing base from '/' to DOCS_BASE (defaulting to '/docs/') breaks the head config entries which use hardcoded absolute paths like /favicon/apple-touch-icon.png. VuePress 1.x does not auto-prepend base to head tag attributes, so these will 404 in production since the actual assets are served under /docs/favicon/....

Additional Locations (1)
Fix in Cursor Fix in Web

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'
}],
Expand Down
6 changes: 6 additions & 0 deletions netlify.toml
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"
Loading