From f509981fac7a5be65c56346233ec3f22301c051d Mon Sep 17 00:00:00 2001 From: "vault-token-factory-spectrocloud[bot]" <133815545+vault-token-factory-spectrocloud[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 16:29:08 -0700 Subject: [PATCH] [version-3-4] ci: add prettier to remove uneccessary triggers (#4364) (#4366) * ci: add prettier to remove uneccessary triggers (#4364) (cherry picked from commit 7869b4006a60a56b559e626344da82454dc62357) * ci: adding missing robots.txt or updating noindex in docusaurus.config.js --------- Co-authored-by: Karl Cardenas <29551334+karl-cardenas-coding@users.noreply.github.com> Co-authored-by: vault-token-factory-spectrocloud[bot] --- .github/workflows/versions_robot.yaml | 3 + docusaurus.config.js | 655 ++++++++++++++------------ 2 files changed, 358 insertions(+), 300 deletions(-) diff --git a/.github/workflows/versions_robot.yaml b/.github/workflows/versions_robot.yaml index 413c01e1ce..e38aec6660 100644 --- a/.github/workflows/versions_robot.yaml +++ b/.github/workflows/versions_robot.yaml @@ -85,6 +85,9 @@ jobs: id: check_noindex run: node scripts/noindex_docusaurus_config.js $RUNNER_TEMP $PWD && mv $RUNNER_TEMP/temp.docusaurus.config.js $PWD/docusaurus.config.js + - name: Auto Format (Prettier) + run: make format + - name: Commit Changes id: commit uses: stefanzweifel/git-auto-commit-action@v5 diff --git a/docusaurus.config.js b/docusaurus.config.js index 1d1312e058..13d81e2ac5 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -5,12 +5,8 @@ const themes = require("prism-react-renderer").themes; const lightCodeTheme = themes.oceanicNext; const darkCodeTheme = themes.dracula; const redirects = require("./redirects"); -const { - pluginPacksAndIntegrationsData -} = require("./plugins/packs-integrations"); -const { - pluginImportFontAwesomeIcons -} = require("./plugins/font-awesome"); +const { pluginPacksAndIntegrationsData } = require("./plugins/packs-integrations"); +const { pluginImportFontAwesomeIcons } = require("./plugins/font-awesome"); import path from "path"; import { Logger } from "sass"; @@ -36,318 +32,377 @@ const config = { // to replace "en" with "zh-Hans". i18n: { defaultLocale: "en", - locales: ["en"] + locales: ["en"], }, staticDirectories: ["static", "static/assets/docs/images", "static/assets"], - headTags: [{ - tagName: "script", - attributes: { - type: "text/plain", - "data-usercentrics": "FullStory", - src: "/scripts/fullstory.js" - } - }, { - tagName: "link", - attributes: { - rel: "preconnect", - href: "https://api.usercentrics.eu" - } - }, { - tagName: "link", - attributes: { - rel: "preload", - href: "https://app.usercentrics.eu/browser-ui/latest/loader.js", - as: "script" - } - }, { - tagName: "script", - attributes: { - src: "https://app.usercentrics.eu/browser-ui/latest/loader.js", - "data-settings-id": "0IhiFXOBwy0Z2U", - id: "usercentrics-cmp", - async: "true" - } - }, { - tagName: "link", - attributes: { - rel: "preconnect", - href: "https://www.googletagmanager.com" - } - }, { - tagName: "script", - attributes: { - type: "text/javascript", - "data-usercentrics": "Google Tag Manager", - src: "/scripts/googleTagManager.js" - } - }], - stylesheets: [], - presets: [["classic", /** @type {import('@docusaurus/preset-classic').Options} */ - { - docs: { - path: "docs/docs-content", - showLastUpdateAuthor: false, - showLastUpdateTime: true, - routeBasePath: "/", - lastVersion: "current", - includeCurrentVersion: true, - versions: { - current: { - label: "v3.4.x" - } + headTags: [ + { + tagName: "script", + attributes: { + type: "text/plain", + "data-usercentrics": "FullStory", + src: "/scripts/fullstory.js", }, - admonitions: { - keywords: ["preview", "further"], - extendDefaults: true + }, + { + tagName: "link", + attributes: { + rel: "preconnect", + href: "https://api.usercentrics.eu", }, - // exclude: ["api/v1/palette-apis-3-4"], - - sidebarPath: require.resolve("./sidebars.js"), - async sidebarItemsGenerator({ - defaultSidebarItemsGenerator, - ...args - }) { - const { - docs - } = args; - const filteredDocs = docs.filter(doc => { - return true; - }); - const sidebarItems = await defaultSidebarItemsGenerator({ - ...args, - docs: filteredDocs - }); - return sidebarItems; + }, + { + tagName: "link", + attributes: { + rel: "preload", + href: "https://app.usercentrics.eu/browser-ui/latest/loader.js", + as: "script", }, - editUrl: "https://github.com/spectrocloud/librarium/blob/master" }, - sitemap: { - changefreq: "daily", - priority: 0.5, - ignorePatterns: ["/tags/**"], - filename: "sitemap.xml" + { + tagName: "script", + attributes: { + src: "https://app.usercentrics.eu/browser-ui/latest/loader.js", + "data-settings-id": "0IhiFXOBwy0Z2U", + id: "usercentrics-cmp", + async: "true", + }, }, - theme: { - customCss: require.resolve("./src/css/custom.scss") - } - }]], - plugins: ["docusaurus-plugin-sass", ["@docusaurus/plugin-content-docs", { - id: "api", - path: "docs/api-content/api-docs", - routeBasePath: "api", - docItemComponent: "@theme/ApiItem", - lastVersion: "current", - includeCurrentVersion: true, - admonitions: { - keywords: ["preview", "further"], - extendDefaults: true + { + tagName: "link", + attributes: { + rel: "preconnect", + href: "https://www.googletagmanager.com", + }, }, - versions: { - current: { - label: "3.4.x" - } + { + tagName: "script", + attributes: { + type: "text/javascript", + "data-usercentrics": "Google Tag Manager", + src: "/scripts/googleTagManager.js", + }, }, - sidebarPath: require.resolve("./apisidebar.js") - }], ["docusaurus-plugin-openapi-docs", { - // Visit https://docusaurus-openapi.tryingpan.dev/#config to learn more about this plugin's config options. - id: "apidocs", - docsPluginId: "api", - config: { - palette: { - specPath: "docs/api-content/api-docs/v1/api.json", - outputDir: "docs/api-content/api-docs/v1", - downloadUrl: "https://github.com/spectrocloud/librarium/blob/master/docs/api-content/api-docs/palette-apis.json", - sidebarOptions: { - groupPathsBy: "tag", - categoryLinkSource: "tag" + ], + stylesheets: [], + presets: [ + [ + "classic", + /** @type {import('@docusaurus/preset-classic').Options} */ + { + docs: { + path: "docs/docs-content", + showLastUpdateAuthor: false, + showLastUpdateTime: true, + routeBasePath: "/", + lastVersion: "current", + includeCurrentVersion: true, + versions: { + current: { + label: "v3.4.x", + }, + }, + admonitions: { + keywords: ["preview", "further"], + extendDefaults: true, + }, + // exclude: ["api/v1/palette-apis-3-4"], + + sidebarPath: require.resolve("./sidebars.js"), + async sidebarItemsGenerator({ defaultSidebarItemsGenerator, ...args }) { + const { docs } = args; + const filteredDocs = docs.filter((doc) => { + return true; + }); + const sidebarItems = await defaultSidebarItemsGenerator({ + ...args, + docs: filteredDocs, + }); + return sidebarItems; + }, + editUrl: "https://github.com/spectrocloud/librarium/blob/master", + }, + sitemap: { + changefreq: "daily", + priority: 0.5, + ignorePatterns: ["/tags/**"], + filename: "sitemap.xml", + }, + theme: { + customCss: require.resolve("./src/css/custom.scss"), + }, + }, + ], + ], + plugins: [ + "docusaurus-plugin-sass", + [ + "@docusaurus/plugin-content-docs", + { + id: "api", + path: "docs/api-content/api-docs", + routeBasePath: "api", + docItemComponent: "@theme/ApiItem", + lastVersion: "current", + includeCurrentVersion: true, + admonitions: { + keywords: ["preview", "further"], + extendDefaults: true, }, - template: "api.mustache", - // Customize API MDX with mustache template - hideSendButton: true - } - } - }], process.env.NODE_ENV !== "production" && [() => ({ - name: "plugin-enable-source-map", - configureWebpack() { + versions: { + current: { + label: "3.4.x", + }, + }, + sidebarPath: require.resolve("./apisidebar.js"), + }, + ], + [ + "docusaurus-plugin-openapi-docs", + { + // Visit https://docusaurus-openapi.tryingpan.dev/#config to learn more about this plugin's config options. + id: "apidocs", + docsPluginId: "api", + config: { + palette: { + specPath: "docs/api-content/api-docs/v1/api.json", + outputDir: "docs/api-content/api-docs/v1", + downloadUrl: + "https://github.com/spectrocloud/librarium/blob/master/docs/api-content/api-docs/palette-apis.json", + sidebarOptions: { + groupPathsBy: "tag", + categoryLinkSource: "tag", + }, + template: "api.mustache", + // Customize API MDX with mustache template + hideSendButton: true, + }, + }, + }, + ], + process.env.NODE_ENV !== "production" && [ + () => ({ + name: "plugin-enable-source-map", + configureWebpack() { + return { + devtool: "source-map", + }; + }, + }), + { + id: "enable-source-map", + }, + ], + [ + pluginPacksAndIntegrationsData, + { + repositories: ["Palette Registry", "Public Repo", "Spectro Addon Repo", "Palette Community Registry"], + }, + ], + pluginImportFontAwesomeIcons, + function () { return { - devtool: "source-map" + name: "plugin-watch-custom-plugin-path", + getPathsToWatch() { + return ["plugins/font-awesome.js", "plugins/packs-integrations.js"]; + }, }; - } - }), { - id: "enable-source-map" - }], [pluginPacksAndIntegrationsData, { - repositories: ["Palette Registry", "Public Repo", "Spectro Addon Repo", "Palette Community Registry"] - }], pluginImportFontAwesomeIcons, function () { - return { - name: "plugin-watch-custom-plugin-path", - getPathsToWatch() { - return ["plugins/font-awesome.js", "plugins/packs-integrations.js"]; - } - }; - }, ["@docusaurus/plugin-ideal-image", { - quality: 50, - max: 1035, - steps: 4, - disableInDev: false - }], [require.resolve("docusaurus-plugin-image-zoom"), { - id: "docusaurus-plugin-image-zoom" - }], ["@docusaurus/plugin-client-redirects", { - redirects: [...redirects] - }]].filter(Boolean), - scripts: [{ - src: `https://w.appzi.io/w.js?token=${process.env.APPZI_TOKEN}`, - defer: true - }], + }, + [ + "@docusaurus/plugin-ideal-image", + { + quality: 50, + max: 1035, + steps: 4, + disableInDev: false, + }, + ], + [ + require.resolve("docusaurus-plugin-image-zoom"), + { + id: "docusaurus-plugin-image-zoom", + }, + ], + [ + "@docusaurus/plugin-client-redirects", + { + redirects: [...redirects], + }, + ], + ].filter(Boolean), + scripts: [ + { + src: `https://w.appzi.io/w.js?token=${process.env.APPZI_TOKEN}`, + defer: true, + }, + ], themes: ["docusaurus-theme-openapi-docs"], customFields: { // Put your custom environment here }, - themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ - { - // announcementBar: { - // id: "docs_announcement_bar", - // content: - // REPLACE MESSAGE BELOW - // 'The 2024 State of Production Kubernetes report is now available and it\'s full of insights and goodies. Click here to get your own copy.', - // backgroundColor: "#FBB117", - // textColor: "#091E42", - // isCloseable: false, - // }, - colorMode: { - respectPrefersColorScheme: true - }, - docs: { + themeConfig: + /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ + { + // announcementBar: { + // id: "docs_announcement_bar", + // content: + // REPLACE MESSAGE BELOW + // 'The 2024 State of Production Kubernetes report is now available and it\'s full of insights and goodies. Click here to get your own copy.', + // backgroundColor: "#FBB117", + // textColor: "#091E42", + // isCloseable: false, + // }, + colorMode: { + respectPrefersColorScheme: true, + }, + docs: { + sidebar: { + hideable: false, + autoCollapseCategories: true, + }, + }, + tableOfContents: { + minHeadingLevel: 2, + maxHeadingLevel: 3, + }, + // Replace with your project's social card + image: "img/spectro-cloud-social-card.png", + navbar: { + title: "", + logo: { + href: "/", + target: "self", + width: 144, + height: 36, + alt: "Spectro cloud logo", + src: "img/spectrocloud-logo-light.svg", + srcDark: "img/spectrocloud-logo-dark.svg", + }, + items: [ + { + to: "/", + type: "docSidebar", + sidebarId: "docSidebar", + label: "Docs", + position: "left", + activeBaseRegex: "^(?!/api/).*$", + }, + { + to: "/tutorials", + type: "docSidebar", + sidebarId: "tutorialSidebar", + label: "Tutorials", + position: "left", + activeBaseRegex: "^(?!/api/).*$", + }, + { + to: "/api/introduction", + label: "API", + position: "left", + }, + { + href: "https://github.com/spectrocloud/librarium", + position: "right", + className: "header-github-link", + "aria-label": "GitHub repository", + }, + { + type: "docsVersionDropdown", + position: "left", + docsPluginId: "default", + }, + { + type: "docsVersionDropdown", + position: "left", + docsPluginId: "api", + }, + ], + hideOnScroll: true, + }, + languageTabs: [ + { + highlight: "bash", + language: "curl", + logoClass: "bash", + }, + { + highlight: "python", + language: "python", + logoClass: "python", + variant: "requests", + }, + { + highlight: "go", + language: "go", + logoClass: "go", + }, + { + highlight: "javascript", + language: "nodejs", + logoClass: "nodejs", + variant: "axios", + }, + { + highlight: "java", + language: "java", + logoClass: "java", + variant: "unirest", + }, + ], + algolia: { + // The application ID provided by Algolia + appId: process.env.ALGOLIA_APP_ID, + // Public API key: it is safe to commit it + apiKey: process.env.ALGOLIA_SEARCH_KEY, + indexName: process.env.ALGOLIA_INDEX_NAME, + // Optional: see doc section below + contextualSearch: true, + // Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them. + externalUrlRegex: "external\\.com|domain\\.com", + // Optional: Replace parts of the item URLs from Algolia. Useful when using the same search index for multiple deployments using a different baseUrl. You can use regexp or string in the `from` param. For example: localhost:3000 vs myCompany.com/docs + replaceSearchResultPathname: { + from: "/docs/", + // or as RegExp: /\/docs\// + to: "/", + }, + // Optional: Algolia search parameters + searchParameters: {}, + // Optional: path for search page that enabled by default (`false` to disable it) + searchPagePath: "search", + maxResultsPerGroup: 7, + }, sidebar: { - hideable: false, - autoCollapseCategories: true - } - }, - tableOfContents: { - minHeadingLevel: 2, - maxHeadingLevel: 3 - }, - // Replace with your project's social card - image: "img/spectro-cloud-social-card.png", - navbar: { - title: "", - logo: { - href: "/", - target: "self", - width: 144, - height: 36, - alt: "Spectro cloud logo", - src: "img/spectrocloud-logo-light.svg", - srcDark: "img/spectrocloud-logo-dark.svg" + hideable: true, }, - items: [{ - to: "/", - type: "docSidebar", - sidebarId: "docSidebar", - label: "Docs", - position: "left", - activeBaseRegex: "^(?!/api/).*$" - }, { - to: "/tutorials", - type: "docSidebar", - sidebarId: "tutorialSidebar", - label: "Tutorials", - position: "left", - activeBaseRegex: "^(?!/api/).*$" - }, { - to: "/api/introduction", - label: "API", - position: "left" - }, { - href: "https://github.com/spectrocloud/librarium", - position: "right", - className: "header-github-link", - "aria-label": "GitHub repository" - }, { - type: "docsVersionDropdown", - position: "left", - docsPluginId: "default" - }, { - type: "docsVersionDropdown", - position: "left", - docsPluginId: "api" - }], - hideOnScroll: true - }, - languageTabs: [{ - highlight: "bash", - language: "curl", - logoClass: "bash" - }, { - highlight: "python", - language: "python", - logoClass: "python", - variant: "requests" - }, { - highlight: "go", - language: "go", - logoClass: "go" - }, { - highlight: "javascript", - language: "nodejs", - logoClass: "nodejs", - variant: "axios" - }, { - highlight: "java", - language: "java", - logoClass: "java", - variant: "unirest" - }], - algolia: { - // The application ID provided by Algolia - appId: process.env.ALGOLIA_APP_ID, - // Public API key: it is safe to commit it - apiKey: process.env.ALGOLIA_SEARCH_KEY, - indexName: process.env.ALGOLIA_INDEX_NAME, - // Optional: see doc section below - contextualSearch: true, - // Optional: Specify domains where the navigation should occur through window.location instead on history.push. Useful when our Algolia config crawls multiple documentation sites and we want to navigate with window.location.href to them. - externalUrlRegex: "external\\.com|domain\\.com", - // Optional: Replace parts of the item URLs from Algolia. Useful when using the same search index for multiple deployments using a different baseUrl. You can use regexp or string in the `from` param. For example: localhost:3000 vs myCompany.com/docs - replaceSearchResultPathname: { - from: "/docs/", - // or as RegExp: /\/docs\// - to: "/" + prism: { + defaultLanguage: "json", + theme: lightCodeTheme, + darkTheme: darkCodeTheme, + additionalLanguages: ["hcl", "bash", "json", "powershell", "go", "javascript", "rust"], + magicComments: [ + { + className: "theme-code-block-highlighted-line", + line: "highlight-next-line", + block: { + start: "highlight-start", + end: "highlight-end", + }, + }, + { + className: "code-block-error-line", + line: "This will error", + }, + ], }, - // Optional: Algolia search parameters - searchParameters: {}, - // Optional: path for search page that enabled by default (`false` to disable it) - searchPagePath: "search", - maxResultsPerGroup: 7 - }, - sidebar: { - hideable: true - }, - prism: { - defaultLanguage: "json", - theme: lightCodeTheme, - darkTheme: darkCodeTheme, - additionalLanguages: ["hcl", "bash", "json", "powershell", "go", "javascript", "rust"], - magicComments: [{ - className: "theme-code-block-highlighted-line", - line: "highlight-next-line", - block: { - start: "highlight-start", - end: "highlight-end" - } - }, { - className: "code-block-error-line", - line: "This will error" - }] - }, - zoom: { - selector: ".markdown-image", - background: { - light: "rgb(255, 255, 255)", - dark: "rgb(50, 50, 50)" + zoom: { + selector: ".markdown-image", + background: { + light: "rgb(255, 255, 255)", + dark: "rgb(50, 50, 50)", + }, + config: {}, }, - config: {} - } - } + }, }; module.exports = config; export default function (context, options) { @@ -356,6 +411,6 @@ export default function (context, options) { getPathsToWatch() { const contentPath = path.resolve(context.siteDir, options.path); return [`${contentPath}/_partials/*/*.{mdx}`]; - } + }, }; -} \ No newline at end of file +}