build-assets/build/{props.platform}/deploy
folder:
-* xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz
-* xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz.sha
+- xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz
+- xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz.sha
To rerun the build, invoke the **deep-clean** action and repeat from install:
diff --git a/website/docs/developer/_common/_platform-native-section.mdx b/website/docs/developer/_common/_platform-native-section.mdx
index ab9394c..2e74a9e 100644
--- a/website/docs/developer/_common/_platform-native-section.mdx
+++ b/website/docs/developer/_common/_platform-native-section.mdx
@@ -44,8 +44,8 @@ or, for more verbosity, run the similar development build:
archive and its SHA signature, created in
the build-assets/build/{props.platform}/deploy
folder:
-* xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz
-* xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz.sha
+- xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz
+- xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz.sha
To rerun the build, invoke the **deep-clean** action and repeat from install:
diff --git a/website/docs/install/index.mdx b/website/docs/install/index.mdx
index daf072b..8e6fb30 100644
--- a/website/docs/install/index.mdx
+++ b/website/docs/install/index.mdx
@@ -246,7 +246,7 @@ The command to install the **latest** available version of **ninja-build** is:
To install a **specific version**, specify it explicitly:
build-assets/build/{props.platform}/deploy
folder:
-* xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.{props.platform === 'win32-x64' ? 'zip' : 'tar.gz'}
-* xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.{props.platform === 'win32-x64' ? 'zip' : 'tar.gz'}.sha
+- xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.{props.platform === 'win32-x64' ? 'zip' : 'tar.gz'}
+- xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.{props.platform === 'win32-x64' ? 'zip' : 'tar.gz'}.sha
To update the build scripts and build the release binaries:
diff --git a/website/docs/maintainer/_common/_platform-native-build.mdx b/website/docs/maintainer/_common/_platform-native-build.mdx
index de2934c..c741df5 100644
--- a/website/docs/maintainer/_common/_platform-native-build.mdx
+++ b/website/docs/maintainer/_common/_platform-native-build.mdx
@@ -40,8 +40,8 @@ xpm run build-development --config ${props.platform} -C ~/Work/xpack-dev-tools/n
archive and its SHA signature, created in
the build-assets/build/{props.platform}/deploy
folder:
-* xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz
-* xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz.sha
+- xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz
+- xpack-ninja-build-{customField('xpackVersion')}-{props.platform}.tar.gz.sha
To update the build scripts and build the release binaries:
diff --git a/website/docs/user/_common/_arm-toolchain-versioning.mdx b/website/docs/user/_common/_arm-toolchain-versioning.mdx
index e5952ab..2db7a96 100644
--- a/website/docs/user/_common/_arm-toolchain-versioning.mdx
+++ b/website/docs/user/_common/_arm-toolchain-versioning.mdx
@@ -20,14 +20,14 @@ upstream **Arm GNU Toolchain** project is a bit unusual and unstable in time,
(like {versionMajor()}.{versionMinor()}.Rel1
)
therefore the upstream GCC version is preferred, which
is a three number string
-like {customField('xpackVersion')}
;
+like {customField('xpackSemver')}
;
to this string the xPack distribution adds a fourth number that represents
the Arm release with the same GCC release, and a fifth number
that represents the xPack release of the same Arm release;
since [SemVer](https://semver.org) allows only three numbers,
all additional ones can
be added only as pre-release strings, separated by a dash,
-like {customField('xpackVersion')}-{customField('xpackSubversion')}
. When
+like {customField('xpackSemver')}-{customField('xpackSubversion')}
. When
published as a npm package, the version gets
a sixth number,
like {customField('xpackVersion')}.{customField('npmSubversion')}
.
diff --git a/website/docs/user/_common/_versioning.mdx b/website/docs/user/_common/_versioning.mdx
index 01f0b2f..faa3baa 100644
--- a/website/docs/user/_common/_versioning.mdx
+++ b/website/docs/user/_common/_versioning.mdx
@@ -15,15 +15,15 @@ import LinksVsForwarders from '@site/src/components/LinksVsForwarders'
The version string used by the
upstream {props.upstreamName ? props.upstreamName : 'Ninja Build'} project
is a three number string
-like {customField('xpackVersion')}
;
+like {customField('xpackSemver')}
;
to this string the xPack distribution adds a fourth number,
but since [SemVer](https://semver.org) allows only three numbers,
all additional ones can
be added only as pre-release strings, separated by a dash,
-like {customField('xpackVersion')}
. When
+like {customField('xpackSemver')}-{customField('xpackSubversion')}
. When
published as a npm package, the version gets
a fifth number,
-like {customField('xpackVersion')}.{customField('npmSubversion')}
.
+like {customField('xpackVersion')}.{customField('npmSubversion')}
.
Since adherence of third party packages to SemVer is not guaranteed,
it is recommended to avoid referring to the xPack Ninja Build dependency via
diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.ts
index bb1b51c..2162851 100644
--- a/website/docusaurus.config.ts
+++ b/website/docusaurus.config.ts
@@ -8,70 +8,13 @@ import type * as Preset from '@docusaurus/preset-classic';
import util from 'node:util';
import {redirects} from './docusaurus-config-redirects'
+import {getCustomFields} from './customFields'
// The node.js modules cannot be used in modules imported in browser code:
// webpack < 5 used to include polyfills for node.js core modules by default.
// so the entire initialisation code must be in this file, that is
// not processed by webpack.
-import {fileURLToPath} from 'node:url';
-import path from 'node:path';
-import fs from 'node:fs';
-
-// ----------------------------------------------------------------------------
-
-function getCustomFields() {
- const pwd = fileURLToPath(import.meta.url);
- // console.log(pwd);
-
- // First get the version from the top package.json.
- const topFilePath = path.join(path.dirname(path.dirname(pwd)), 'package.json');
- // console.log(filePath);
- const topFileContent = fs.readFileSync(topFilePath);
-
- const topPackageJson = JSON.parse(topFileContent.toString());
- const jsonVersion = topPackageJson.version.replace(/[.-]pre/, '');
-
- console.log(`package version: ${topPackageJson.version}`);
-
- // Remove the first part, up to the last dot.
- const npmSubversion = jsonVersion.replace(/^.*[.]/, '');
-
- // Remove from the last dot to the end.
- const xpackVersion = jsonVersion.replace(/[.][0-9]*$/, '');
-
- // Remove the pre-release.
- const xpackSemver = xpackVersion.replace(/[-].*$/, '');
-
- // Remove the first part, up to the dash.
- const xpackSubversion = xpackVersion.replace(/^.*[-]/, '');
-
- let websitePackageJson = {}
- try {
- const websiteFilePath = path.join(path.dirname(path.dirname(pwd)), 'website', 'package.json');
- // console.log(filePath);
- const websiteFileContent = fs.readFileSync(websiteFilePath);
- websitePackageJson = JSON.parse(websiteFileContent.toString());
- } catch (error) {
- }
-
- const customFields = websitePackageJson?.websiteConfig?.customFields ?? {};
-
- let upstreamVersion = xpackSemver;
-
- return {
- version: jsonVersion,
- xpackVersion,
- xpackSemver,
- xpackSubversion,
- npmSubversion,
- upstreamVersion,
- docusaurusVersion: require('@docusaurus/core/package.json').version,
- buildTime: new Date().getTime(),
- ...customFields,
- }
-}
-
// ----------------------------------------------------------------------------
const customFields = getCustomFields();
diff --git a/website/src/pages/index.tsx b/website/src/pages/index.tsx
index b108cdc..c0454c8 100644
--- a/website/src/pages/index.tsx
+++ b/website/src/pages/index.tsx
@@ -34,7 +34,7 @@ function HomepageHeader() {
{siteConfig.tagline}