Skip to content

Commit 0740fed

Browse files
committed
website: re-generate commons
1 parent 7579631 commit 0740fed

File tree

12 files changed

+116
-81
lines changed

12 files changed

+116
-81
lines changed

website/customFields.ts

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// DO NOT EDIT!
2+
// Automatically generated from docusaurus-template-liquid/templates/docusaurus.
3+
4+
import { fileURLToPath } from 'node:url';
5+
import path from 'node:path';
6+
import fs from 'node:fs';
7+
8+
// ----------------------------------------------------------------------------
9+
10+
export function getCustomFields() {
11+
const pwd = fileURLToPath(import.meta.url);
12+
// console.log(pwd);
13+
14+
// First get the version from the top package.json.
15+
const topFilePath = path.join(path.dirname(path.dirname(pwd)), 'package.json');
16+
// console.log(filePath);
17+
const topFileContent = fs.readFileSync(topFilePath);
18+
19+
const topPackageJson = JSON.parse(topFileContent.toString());
20+
const releaseVersion = topPackageJson.version.replace(/[.-]pre/, '');
21+
22+
console.log(`package version: ${topPackageJson.version}`);
23+
24+
let versionFields;
25+
26+
if (topPackageJson.xpack && !releaseVersion.startsWith('0.0.0')) {
27+
// Remove the first part, up to the last dot.
28+
const npmSubversion = releaseVersion.replace(/^.*[.]/, '');
29+
30+
// Remove from the last dot to the end.
31+
const xpackVersion = releaseVersion.replace(/[.][0-9]*$/, '');
32+
33+
// Remove the pre-release.
34+
const xpackSemver = xpackVersion.replace(/[-].*$/, '');
35+
36+
// Remove the first part, up to the dash.
37+
const xpackSubversion = xpackVersion.replace(/^.*[-]/, '');
38+
39+
let upstreamVersion = xpackSemver;
40+
if (xpackSemver.endsWith('.0')) {
41+
// Remove the patch number if zero (wine uses both 2 and 3 numbers).
42+
upstreamVersion = xpackSemver.replace(/[.]0*$/, '');
43+
}
44+
45+
versionFields = {
46+
releaseVersion,
47+
xpackVersion,
48+
xpackSemver,
49+
xpackSubversion,
50+
npmSubversion,
51+
upstreamVersion,
52+
}
53+
} else {
54+
versionFields = {
55+
releaseVersion
56+
}
57+
}
58+
59+
let engineVersionFields;
60+
61+
if (topPackageJson?.engines?.node) {
62+
const enginesNodeVersion = topPackageJson.engines.node.replace(/[^0-9]*/, '') || '';
63+
const enginesNodeVersionMajor = enginesNodeVersion.replace(/[.].*/, '');
64+
engineVersionFields = {
65+
enginesNodeVersion,
66+
enginesNodeVersionMajor
67+
}
68+
} else {
69+
engineVersionFields = {};
70+
}
71+
72+
const docusaurusFields = {
73+
docusaurusVersion: require('@docusaurus/core/package.json').version,
74+
buildTime: new Date().getTime(),
75+
}
76+
77+
let websiteFields = {};
78+
try {
79+
const websiteFilePath = path.join(path.dirname(path.dirname(pwd)), 'website', 'package.json');
80+
// console.log(filePath);
81+
const websiteFileContent = fs.readFileSync(websiteFilePath);
82+
const websitePackageJson = JSON.parse(websiteFileContent.toString());
83+
websiteFields = websitePackageJson?.websiteConfig?.customFields ?? {};
84+
} catch (error) {
85+
// Most probably there is no website/package.json.
86+
}
87+
88+
return {
89+
...versionFields,
90+
...engineVersionFields,
91+
...docusaurusFields,
92+
...websiteFields,
93+
}
94+
}
95+
96+
// ----------------------------------------------------------------------------

website/docs/developer/_common/_platform-docker-section.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ or, for more verbosity, run the similar development build:
4747
archive and its SHA signature, created in
4848
the <code>build-assets/build/{props.platform}/deploy</code> folder:
4949

50-
* <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz</code>
51-
* <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz.sha</code>
50+
- <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz</code>
51+
- <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz.sha</code>
5252

5353
To rerun the build, invoke the **deep-clean** action and repeat from install:
5454

website/docs/developer/_common/_platform-native-section.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ or, for more verbosity, run the similar development build:
4444
archive and its SHA signature, created in
4545
the <code>build-assets/build/{props.platform}/deploy</code> folder:
4646

47-
* <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz</code>
48-
* <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz.sha</code>
47+
- <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz</code>
48+
- <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz.sha</code>
4949

5050
To rerun the build, invoke the **deep-clean** action and repeat from install:
5151

website/docs/install/_folders-hierarchies-linux.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import customField from '@site/src/libs/customField';
66
{/* ------------------------------------------------------------------------ */}
77

88
<CodeBlock language="console"> {
9-
`$ tree -L 2 ~/.local/xPacks/\@xpack-dev-tools/sed/${customField('version')}/.content/
10-
/home/ilg/.local/xPacks/\@xpack-dev-tools/sed/${customField('version')}/.content/
9+
`$ tree -L 2 ~/.local/xPacks/\@xpack-dev-tools/sed/${customField('releaseVersion')}/.content/
10+
/home/ilg/.local/xPacks/\@xpack-dev-tools/sed/${customField('releaseVersion')}/.content/
1111
├── README.md
1212
├── bin
1313
│ ├── gsed -> sed

website/docs/install/_folders-hierarchies-macos.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import customField from '@site/src/libs/customField';
66
{/* ------------------------------------------------------------------------ */}
77

88
<CodeBlock language="console"> {
9-
`$ tree -L 2 ~/Library/xPacks/\@xpack-dev-tools/sed/${customField('version')}/.content/
10-
/Users/ilg/Library/xPacks/\@xpack-dev-tools/sed/${customField('version')}/.content/
9+
`$ tree -L 2 ~/Library/xPacks/\@xpack-dev-tools/sed/${customField('releaseVersion')}/.content/
10+
/Users/ilg/Library/xPacks/\@xpack-dev-tools/sed/${customField('releaseVersion')}/.content/
1111
├── README.md
1212
├── bin
1313
│ ├── gsed -> sed

website/docs/install/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ The command to install the **latest** available version of **sed** is:
246246
To install a **specific version**, specify it explicitly:
247247

248248
<CodeBlock language="sh"> {
249-
`xpm install @xpack-dev-tools/sed@${customField('version')} --verbose
249+
`xpm install @xpack-dev-tools/sed@${customField('releaseVersion')} --verbose
250250
`} </CodeBlock>
251251

252252
<Tabs groupId="operating-systems">

website/docs/maintainer/_common/_platform-docker-build.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ xpm run docker-build-development --config ${props.platform} -C ~/Work/xpack-dev-
4141
archive and its SHA signature, created in
4242
the <code>build-assets/build/{props.platform}/deploy</code> folder:
4343

44-
* <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.{props.platform === 'win32-x64' ? 'zip' : 'tar.gz'}</code>
45-
* <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.{props.platform === 'win32-x64' ? 'zip' : 'tar.gz'}.sha</code>
44+
- <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.{props.platform === 'win32-x64' ? 'zip' : 'tar.gz'}</code>
45+
- <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.{props.platform === 'win32-x64' ? 'zip' : 'tar.gz'}.sha</code>
4646

4747
To update the build scripts and build the release binaries:
4848

website/docs/maintainer/_common/_platform-native-build.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ xpm run build-development --config ${props.platform} -C ~/Work/xpack-dev-tools/s
4040
archive and its SHA signature, created in
4141
the <code>build-assets/build/{props.platform}/deploy</code> folder:
4242

43-
* <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz</code>
44-
* <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz.sha</code>
43+
- <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz</code>
44+
- <code>xpack-sed-{customField('xpackVersion')}-{props.platform}.tar.gz.sha</code>
4545

4646
To update the build scripts and build the release binaries:
4747

website/docs/user/_common/_arm-toolchain-versioning.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ upstream **Arm GNU Toolchain** project is a bit unusual and unstable in time,
2020
(like <code>{versionMajor()}.{versionMinor()}.Rel1</code>)
2121
therefore the upstream GCC version is preferred, which
2222
is a three number string
23-
like <code>{customField('xpackVersion')}</code>;
23+
like <code>{customField('xpackSemver')}</code>;
2424
to this string the xPack distribution adds a fourth number that represents
2525
the Arm release with the same GCC release, and a fifth number
2626
that represents the xPack release of the same Arm release;
2727
since [SemVer](https://semver.org) allows only three numbers,
2828
all additional ones can
2929
be added only as pre-release strings, separated by a dash,
30-
like <code>{customField('xpackVersion')}-<b>{customField('xpackSubversion')}</b></code>. When
30+
like <code>{customField('xpackSemver')}-<b>{customField('xpackSubversion')}</b></code>. When
3131
published as a npm package, the version gets
3232
a sixth number,
3333
like <code>{customField('xpackVersion')}.<b>{customField('npmSubversion')}</b></code>.

website/docs/user/_common/_versioning.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import LinksVsForwarders from '@site/src/components/LinksVsForwarders'
1515
The version string used by the
1616
upstream {props.upstreamName ? props.upstreamName : 'GNU sed'} project
1717
is a three number string
18-
like <code>{customField('xpackVersion')}</code>;
18+
like <code>{customField('xpackSemver')}</code>;
1919
to this string the xPack distribution adds a fourth number,
2020
but since [SemVer](https://semver.org) allows only three numbers,
2121
all additional ones can
2222
be added only as pre-release strings, separated by a dash,
23-
like <code>{customField('xpackVersion')}</code>. When
23+
like <code>{customField('xpackSemver')}-<b>{customField('xpackSubversion')}</b></code>. When
2424
published as a npm package, the version gets
2525
a fifth number,
26-
like <code>{customField('xpackVersion')}.{customField('npmSubversion')}</code>.
26+
like <code>{customField('xpackVersion')}.<b>{customField('npmSubversion')}</b></code>.
2727

2828
Since adherence of third party packages to SemVer is not guaranteed,
2929
it is recommended to avoid referring to the xPack GNU sed dependency via

0 commit comments

Comments
 (0)