diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cd5260e141..485daff9a3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,8 +12,8 @@ # 1Secure team /docs/1secure/ @netwrix/1secure-docs /sidebars/1secure.js @netwrix/1secure-docs -/docs/1securebeta/ @netwrix/1secure-docs -/sidebars/1securebeta.js @netwrix/1secure-docs +/docs/1secureaisecurity/ @netwrix/1secure-docs +/sidebars/1secureaisecurity.js @netwrix/1secure-docs /static/files/1secure/ @netwrix/1secure-docs /static/images/1secure/ @netwrix/1secure-docs diff --git a/docs/1secureaisecurity/index.md b/docs/1secureaisecurity/index.md new file mode 100644 index 0000000000..22f770d1bf --- /dev/null +++ b/docs/1secureaisecurity/index.md @@ -0,0 +1,11 @@ +--- +title: "Netwrix 1Secure AI Security Documentation" +description: "Pre-release documentation for Netwrix 1Secure AI Security." +sidebar_position: 1 +--- + +# Netwrix 1Secure AI Security Documentation + +This section holds pre-release documentation for Netwrix 1Secure AI Security. It isn't listed in the site navigation or search results. + +{/* TODO: replace this placeholder with the beta overview */} diff --git a/docs/1securebeta/index.md b/docs/1securebeta/index.md deleted file mode 100644 index aeba2bcef0..0000000000 --- a/docs/1securebeta/index.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -title: "Netwrix 1Secure Beta Documentation" -description: "Pre-release documentation for Netwrix 1Secure Beta." -sidebar_position: 1 ---- - -# Netwrix 1Secure Beta Documentation - -This section holds pre-release documentation for Netwrix 1Secure Beta. It isn't listed in the site navigation or search results. - -{/* TODO: replace this placeholder with the beta overview */} diff --git a/package.json b/package.json index 76d45cf779..d3a28380e6 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "quality:readability": "node scripts/quality/readability.mjs", "quality:fix": "node scripts/quality/fix-loop.mjs", "slack:sync": "node scripts/sync-team-slack-map.mjs", - "test:scripts": "bash scripts/test-slugify.sh && bash scripts/test-heading-skip.sh && bash scripts/test-md-extension-autofix.sh && node --test scripts/test-set-blob-metadata.mjs && node scripts/test-set-blob-metadata-integration.mjs && node --test scripts/claude/test-log-summary.mjs && node --test scripts/test-vale-local.mjs && node --test scripts/test-resolve-path-labels.mjs && node --test scripts/test-sync-team-slack-map.mjs && node --test scripts/test-preserve-content.mjs && node --test src/plugins/robotsTxt.test.mjs && node --test src/config/docVariables.test.mjs && node scripts/quality/gen-lint-digest.mjs --check", + "test:scripts": "bash scripts/test-slugify.sh && bash scripts/test-heading-skip.sh && bash scripts/test-md-extension-autofix.sh && node --test scripts/test-set-blob-metadata.mjs && node scripts/test-set-blob-metadata-integration.mjs && node --test scripts/claude/test-log-summary.mjs && node --test scripts/test-vale-local.mjs && node --test scripts/test-resolve-path-labels.mjs && node --test scripts/test-sync-team-slack-map.mjs && node --test scripts/test-preserve-content.mjs && node --test src/plugins/robotsTxt.test.mjs && node --test src/config/docVariables.test.mjs && node --test src/config/products.test.mjs && node scripts/quality/gen-lint-digest.mjs --check", "prepare": "node scripts/hooks/install.mjs" }, "dependencies": { diff --git a/sidebars/1securebeta.js b/sidebars/1secureaisecurity.js similarity index 100% rename from sidebars/1securebeta.js rename to sidebars/1secureaisecurity.js diff --git a/src/config/products.js b/src/config/products.js index d19c09005a..9a7f24fd8f 100644 --- a/src/config/products.js +++ b/src/config/products.js @@ -11,6 +11,8 @@ * - Easier maintenance and fewer places for errors */ +import { isIndexableSite } from './indexing.js'; + /** * @typedef {Object} ProductVersion * @property {string} version - Version string (e.g., "12.0", "saas") @@ -33,6 +35,7 @@ * @property {string} [icon] - Icon for the product * @property {string} [navbarGroup] - Products sharing a navbarGroup are shown as one nested submenu with this label inside their category dropdown * @property {boolean} [hideFromNavbar] - Leave the product out of the navbar dropdowns and the landing page. Its pages stay reachable by URL. + * @property {boolean} [devOnly] - Build the product on docs-dev and locally but not on the production site (docs.netwrix.com). The pages still merge to main with the rest of dev; production just doesn't build them. Remove the flag to release the product. * @property {boolean} [noIndex] - Keep the product out of search engines and site search: its pages carry a noindex tag and are left out of the sitemap, production robots.txt disallows its routes, and it is not offered in the search product filter. Pair with hideFromNavbar for an unlisted product such as a beta. */ @@ -40,7 +43,7 @@ * All Netwrix products and their configurations * @type {Product[]} */ -export const PRODUCTS = [ +const ALL_PRODUCTS = [ { id: '1secure', name: '1Secure', @@ -58,20 +61,21 @@ export const PRODUCTS = [ ], }, { - id: '1securebeta', - name: '1Secure Beta', - description: 'Pre-release documentation for Netwrix 1Secure', - path: 'docs/1securebeta', + id: '1secureaisecurity', + name: '1Secure AI Security', + description: 'Pre-release documentation for Netwrix 1Secure AI Security', + path: 'docs/1secureaisecurity', categories: ['Data Security Posture Management (DSPM)'], icon: '', hideFromNavbar: true, // Unlisted beta: reachable by URL only noIndex: true, + devOnly: true, // Not built on production until the beta is released versions: [ { version: 'current', label: 'Current', isLatest: true, - sidebarFile: './sidebars/1securebeta.js', + sidebarFile: './sidebars/1secureaisecurity.js', kb: false, // No Knowledge Base for the beta }, ], @@ -789,6 +793,23 @@ export const PRODUCTS = [ }, ]; +/** + * True when this build is for the production site (docs.netwrix.com). The + * client bundle has no APP_EXTERNAL_URL, so there it is false and devOnly + * products stay in the list. That is harmless: they have no routes in production. + */ +function isProductionBuild() { + const url = typeof process !== 'undefined' ? process.env?.APP_EXTERNAL_URL : undefined; + return Boolean(url) && isIndexableSite(url); +} + +/** + * Products the site builds. Products flagged devOnly are left out of the + * production build, so they get no plugin, routes, or pages there. + * @type {Product[]} + */ +export const PRODUCTS = ALL_PRODUCTS.filter((product) => !(product.devOnly && isProductionBuild())); + /** * Product categories with their metadata */ diff --git a/src/config/products.test.mjs b/src/config/products.test.mjs new file mode 100644 index 0000000000..3be61aaeee --- /dev/null +++ b/src/config/products.test.mjs @@ -0,0 +1,30 @@ +import assert from 'node:assert/strict'; +import { test } from 'node:test'; + +// products.js reads APP_EXTERNAL_URL when it loads, so each case imports a fresh copy. +async function loadProducts(siteUrl, tag) { + const previous = process.env.APP_EXTERNAL_URL; + if (siteUrl === undefined) delete process.env.APP_EXTERNAL_URL; + else process.env.APP_EXTERNAL_URL = siteUrl; + try { + return (await import(`./products.js?${tag}`)).PRODUCTS; + } finally { + if (previous === undefined) delete process.env.APP_EXTERNAL_URL; + else process.env.APP_EXTERNAL_URL = previous; + } +} + +const ids = (products) => products.map((product) => product.id); + +test('devOnly products are left out of the production build', async () => { + const products = await loadProducts('https://docs.netwrix.com', 'production'); + assert.equal(ids(products).includes('1secureaisecurity'), false); + assert.equal(ids(products).includes('1secure'), true); +}); + +test('devOnly products are built on docs-dev and locally', async () => { + for (const [url, tag] of [['https://docs-dev.netwrix.com', 'dev'], ['http://localhost:4500', 'local'], [undefined, 'unset']]) { + const products = await loadProducts(url, tag); + assert.equal(ids(products).includes('1secureaisecurity'), true, String(url)); + } +}); diff --git a/src/plugins/robotsTxt.js b/src/plugins/robotsTxt.js index f828ae623d..5ad4b2691d 100644 --- a/src/plugins/robotsTxt.js +++ b/src/plugins/robotsTxt.js @@ -3,7 +3,7 @@ import { join } from 'path'; import { isIndexableSite } from '../config/indexing.js'; import { PRODUCTS, generateRouteBasePath } from '../config/products.js'; -/** Route prefixes of products flagged noIndex, for example /docs/1securebeta. */ +/** Route prefixes of products flagged noIndex, for example /docs/1secureaisecurity. */ export function noIndexRoutes(products = PRODUCTS) { return products .filter((product) => product.noIndex)