@vantagecompute/docusaurus-theme 0.2.3 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -5,7 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.rehypeTabsTransform = exports.staticDir = void 0;
7
7
  exports.default = themeVantage;
8
+ exports.getProjectVersion = getProjectVersion;
8
9
  const node_path_1 = __importDefault(require("node:path"));
10
+ const node_child_process_1 = require("node:child_process");
9
11
  function themeVantage() {
10
12
  return {
11
13
  name: '@vantagecompute/docusaurus-theme',
@@ -32,6 +34,23 @@ function themeVantage() {
32
34
  * ```
33
35
  */
34
36
  exports.staticDir = node_path_1.default.resolve(__dirname, '../static');
37
+ /**
38
+ * Infer the project version from git tags via `git describe --tags --always`.
39
+ * Returns a string like "v0.3.1" (on a tag) or "v0.3.1-3-gabcdef" (between tags).
40
+ * Falls back to "dev" if git is unavailable or no tags exist.
41
+ */
42
+ function getProjectVersion() {
43
+ try {
44
+ const version = (0, node_child_process_1.execSync)('git describe --tags --always', {
45
+ encoding: 'utf8',
46
+ stdio: ['pipe', 'pipe', 'pipe'],
47
+ }).trim();
48
+ return version;
49
+ }
50
+ catch {
51
+ return 'dev';
52
+ }
53
+ }
35
54
  // Re-export the rehype utility (plain JS, lives in src/utils/)
36
55
  exports.rehypeTabsTransform = require(node_path_1.default.resolve(__dirname, '../src/utils/rehypeTabsTransform'));
37
56
  //# sourceMappingURL=index.cjs.map
package/lib/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":";;;;;;;AAAA,0DAA6B;AAG7B;IACE,OAAO;QACL,IAAI,EAAE,kCAAkC;QAExC,YAAY;YACV,OAAO,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QACj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,IAAI,EAAE,CAAC;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,+DAA+D;AAClD,QAAA,mBAAmB,GAAG,OAAO,CAAC,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC,CAAC"}
package/lib/index.d.cts CHANGED
@@ -12,5 +12,11 @@ export default function themeVantage(): Plugin;
12
12
  * ```
13
13
  */
14
14
  export declare const staticDir: string;
15
+ /**
16
+ * Infer the project version from git tags via `git describe --tags --always`.
17
+ * Returns a string like "v0.3.1" (on a tag) or "v0.3.1-3-gabcdef" (between tags).
18
+ * Falls back to "dev" if git is unavailable or no tags exist.
19
+ */
20
+ export declare function getProjectVersion(): string;
15
21
  export declare const rehypeTabsTransform: any;
16
22
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,YAAY,IAAI,MAAM,CAgB7C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,QAAuC,CAAC;AAG9D,eAAO,MAAM,mBAAmB,KAAuE,CAAC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.cts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,OAAO,UAAU,YAAY,IAAI,MAAM,CAgB7C;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,QAAuC,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAU1C;AAGD,eAAO,MAAM,mBAAmB,KAAuE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vantagecompute/docusaurus-theme",
3
- "version": "0.2.3",
3
+ "version": "0.4.1",
4
4
  "description": "Shared Vantage Compute Docusaurus theme — design system, brand assets, and common theme overrides for all vantagecompute documentation sites.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.cjs",
@@ -1881,6 +1881,23 @@ article {
1881
1881
  }
1882
1882
 
1883
1883
 
1884
+ /* ── Navbar version badge ──────────────────────────────────────────── */
1885
+ .navbar__brand-with-version {
1886
+ display: flex;
1887
+ align-items: center;
1888
+ gap: 0;
1889
+ }
1890
+
1891
+ .navbar__version-badge {
1892
+ font-size: 0.7rem;
1893
+ font-weight: 500;
1894
+ opacity: 0.55;
1895
+ color: var(--vantage-navbar-text);
1896
+ white-space: nowrap;
1897
+ letter-spacing: 0.01em;
1898
+ padding-left: 6px;
1899
+ }
1900
+
1884
1901
  /* Chat sidebar - push layout (navbar excluded) */
1885
1902
  .main-wrapper {
1886
1903
  transition: margin-right 0.3s ease-in-out;
package/src/index.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import path from 'node:path';
2
+ import { execSync } from 'node:child_process';
2
3
  import type { Plugin } from '@docusaurus/types';
3
4
 
4
5
  export default function themeVantage(): Plugin {
@@ -32,5 +33,22 @@ export default function themeVantage(): Plugin {
32
33
  */
33
34
  export const staticDir = path.resolve(__dirname, '../static');
34
35
 
36
+ /**
37
+ * Infer the project version from git tags via `git describe --tags --always`.
38
+ * Returns a string like "v0.3.1" (on a tag) or "v0.3.1-3-gabcdef" (between tags).
39
+ * Falls back to "dev" if git is unavailable or no tags exist.
40
+ */
41
+ export function getProjectVersion(): string {
42
+ try {
43
+ const version = execSync('git describe --tags --always', {
44
+ encoding: 'utf8',
45
+ stdio: ['pipe', 'pipe', 'pipe'],
46
+ }).trim();
47
+ return version;
48
+ } catch {
49
+ return 'dev';
50
+ }
51
+ }
52
+
35
53
  // Re-export the rehype utility (plain JS, lives in src/utils/)
36
54
  export const rehypeTabsTransform = require(path.resolve(__dirname, '../src/utils/rehypeTabsTransform'));
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import Logo from '@theme-original/Navbar/Logo';
3
+ import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
4
+
5
+ export default function LogoWrapper(props) {
6
+ const {siteConfig} = useDocusaurusContext();
7
+ const version = siteConfig.customFields?.projectVersion;
8
+
9
+ return (
10
+ <div className="navbar__brand-with-version">
11
+ <Logo {...props} />
12
+ {version && (
13
+ <span className="navbar__version-badge">
14
+ {String(version).startsWith('v') ? version : `v${version}`}
15
+ </span>
16
+ )}
17
+ </div>
18
+ );
19
+ }