From 1c77a8b3f4a6be4a5c785be118f79d60c858d9a6 Mon Sep 17 00:00:00 2001 From: Mateusz Wojczal Date: Tue, 28 Apr 2026 13:44:44 +0200 Subject: [PATCH 1/2] Make VuePress base, dest and sitemap hostname configurable Move hardcoded `base: '/'` and the implicit dist directory out of the VuePress config so the docs site can be deployed under a sub-path (e.g. `/docs/`) without editing the config file. - `docs/.vuepress/config.js` now reads `base`, `dest` and the sitemap `hostname` from (in precedence order) env vars `DOCS_BASE`, `DOCS_DEST`, `DOCS_HOSTNAME`, then `docs/.vuepress/build.config.js`, then existing built-in defaults. - New `docs/.vuepress/build.config.js` sets the production values (`base: '/docs/'`, `dest: 'docs/.vuepress/dist/docs'`). - `base` is normalized to start and end with `/`. - The sitemap plugin already prepends `base` to every URL and writes `sitemap.xml` to the configured `dest`, so no plugin change is needed. --- docs/.vuepress/build.config.js | 12 ++++++++++++ docs/.vuepress/config.js | 25 +++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 docs/.vuepress/build.config.js diff --git a/docs/.vuepress/build.config.js b/docs/.vuepress/build.config.js new file mode 100644 index 000000000..633ea41f3 --- /dev/null +++ b/docs/.vuepress/build.config.js @@ -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', +}; diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 70456f0da..2726f697a 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -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, + dest: DOCS_DEST, plugins: [ ['sitemap', { - hostname: 'https://hyperformula.handsontable.com', + hostname: DOCS_HOSTNAME, exclude: ['/404.html'], changefreq: 'weekly' }], From 67f61484b75d87d1b45d51f88c8f388437dc108f Mon Sep 17 00:00:00 2001 From: Mateusz Wojczal Date: Tue, 28 Apr 2026 14:36:33 +0200 Subject: [PATCH 2/2] Add netlify.toml and bump .nvmrc to Node 18 The Netlify build was failing with "node: --openssl-legacy-provider is not allowed in NODE_OPTIONS" because Netlify dropped Node 16 support and newer Node versions reject that flag from the env-var allowlist. The publish directory also needed updating to match the new `dest: docs/.vuepress/dist/docs` from this PR. - netlify.toml: declarative build command, publish directory, and NODE_VERSION, replacing the stale UI-side settings. - .nvmrc: v16 -> v18 (Node 16 is EOL and unsupported by Netlify). Node 18 still accepts `--openssl-legacy-provider`, which the current vuepress/webpack toolchain needs. --- .nvmrc | 2 +- netlify.toml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 netlify.toml diff --git a/.nvmrc b/.nvmrc index 6f7f377bf..3f430af82 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v16 +v18 diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 000000000..239f5392e --- /dev/null +++ b/netlify.toml @@ -0,0 +1,6 @@ +[build] + command = "npm run docs:build" + publish = "docs/.vuepress/dist/docs" + +[build.environment] + NODE_VERSION = "18"