Mayil-AI-Sandbox / openfeature.dev_march24

Creative Commons Attribution 4.0 International
0 stars 0 forks source link

[FEATURE] update docusaurus (hashtag548) #4

Open NobleMathews opened 3 days ago

NobleMathews commented 3 days ago

hashtaghashtaghashtag Requirements

)

mayil-ai[bot] commented 3 days ago

To update the Docusaurus version used in the project, follow these steps:

  1. Update package.json: Modify the package.json file to update the Docusaurus dependencies to the latest version.

    {
      "dependencies": {
        "@docusaurus/core": "^2.0.0",
        "@docusaurus/plugin-client-redirects": "^2.0.0",
        "@docusaurus/preset-classic": "^2.0.0",
        "@docusaurus/theme-mermaid": "^2.0.0"
      }
    }
  2. Install Dependencies: Run the following command to install the updated dependencies.

    yarn
  3. Test Locally: Start the local development server to test the website.

    yarn start
  4. Build and Deploy: Build the static website and deploy it.

    yarn build
    yarn deploy
  5. Verify Compatibility in docusaurus.config.ts: Ensure that the docusaurus.config.ts file is compatible with the updated Docusaurus version. Here is an example configuration:

    import type { Options as PresetClassicOptions } from '@docusaurus/preset-classic';
    import type { UserThemeConfig as ThemeCommonConfig } from '@docusaurus/theme-common';
    import type { UserThemeConfig as AlgoliaThemeConfig } from '@docusaurus/theme-search-algolia';
    import type { Config } from '@docusaurus/types';
    import autoprefixer from 'autoprefixer';
    import { themes } from 'prism-react-renderer';
    import { rehypeGithubAlerts } from 'rehype-github-alerts';
    import remarkBreaks from 'remark-breaks';
    import remarkGfm from 'remark-gfm';
    import tailwindcss from 'tailwindcss';
    
    import { processSdkReadmes } from './scripts/process-sdk-readmes';
    
    const presetClassicOptions: PresetClassicOptions = {
      docs: {
        sidebarPath: require.resolve('./sidebars.js'),
        editUrl: (params) => {
          return `https://github.com/open-feature/openfeature.dev/edit/main/docs/${params.docPath}`;
        },
      },
      blog: {
        showReadingTime: true,
        editUrl: 'https://github.com/open-feature/openfeature.dev/edit/main/',
        blogSidebarCount: 'ALL',
        blogSidebarTitle: 'All Blog Posts',
      },
      theme: {
        customCss: [
          require.resolve('./src/css/custom.css'),
          require.resolve('@fortawesome/fontawesome-svg-core/styles.css'),
        ],
      },
    };
    
    const config: Config = {
      title: 'OpenFeature',
      tagline: 'Feature flag standard',
      url: 'https://openfeature.dev',
      baseUrl: '/',
      onBrokenLinks: 'throw',
      onBrokenMarkdownLinks: 'warn',
      favicon: 'img/favicon.ico',
      organizationName: 'open-feature',
      projectName: 'openfeature.dev',
      presets: [
        [
          '@docusaurus/preset-classic',
          presetClassicOptions,
        ],
      ],
      themeConfig: {
        navbar: {
          title: 'OpenFeature',
          logo: {
            alt: 'OpenFeature Logo',
            src: 'img/logo.svg',
          },
          items: [
            { to: 'docs/', label: 'Docs', position: 'left' },
            { to: 'blog', label: 'Blog', position: 'left' },
            {
              href: 'https://github.com/open-feature/openfeature.dev',
              label: 'GitHub',
              position: 'right',
            },
          ],
        },
        footer: {
          style: 'dark',
          links: [
            {
              title: 'Docs',
              items: [
                {
                  label: 'Documentation',
                  to: 'docs/',
                },
              ],
            },
            {
              title: 'Community',
              items: [
                {
                  label: 'GitHub',
                  href: 'https://github.com/open-feature/openfeature.dev',
                },
              ],
            },
            {
              title: 'More',
              items: [
                {
                  label: 'Blog',
                  to: 'blog',
                },
              ],
            },
          ],
          copyright: `Copyright © ${new Date().getFullYear()} OpenFeature.`,
        },
        prism: {
          theme: themes.github,
          additionalLanguages: ['java', 'kotlin', 'swift'],
        },
      },
      plugins: [
        async function tailwind() {
          return {
            name: 'docusaurus-tailwindcss',
            configurePostCss(postcssOptions) {
              postcssOptions.plugins.push(tailwindcss);
              postcssOptions.plugins.push(autoprefixer);
              return postcssOptions;
            },
          };
        },
        [
          '@docusaurus/plugin-content-docs',
          {
            id: 'community',
            path: 'external-content/community',
            routeBasePath: 'community',
            exclude: ['.github/**/*', 'ISSUE_TEMPLATE/**'],
            sidebarPath: require.resolve('./external-content/community/docusaurus-sidebar.js'),
            editUrl: (params) => {
              return `https://github.com/open-feature/community/edit/main/${params.docPath}`;
            },
          },
        ],
        [
          'docusaurus-plugin-remote-content',
          {
            name: 'sdk-content',
            noRuntimeDownloads: true,
            sourceBaseUrl: 'https://raw.githubusercontent.com/open-feature/',
            outDir: 'docs/reference/technologies',
            documents: processSdkReadmes.paths,
            modifyContent: processSdkReadmes.modifyContent,
          },
        ],
        [
          '@docusaurus/plugin-content-docs',
          {
            id: 'specification',
            path: 'external-content/specification/specification',
            routeBasePath: 'specification',
            editUrl: (params) => {
              return `https://github.com/open-feature/spec/edit/main/specification/${params.docPath}`;
            },
            rehypePlugins: [rehypeGithubAlerts],
            remarkPlugins: [remarkGfm, remarkBreaks],
          },
        ],
        [
          '@docusaurus/plugin-client-redirects',
          {
            createRedirects(existingPath: string) {
              if (existingPath.includes('/docs/specification')) {
                return [existingPath.replace('/docs/specification', '/specification')];
              }
              return undefined;
            },
          },
        ],
        'docusaurus-plugin-sass',
        [
          '@docusaurus/plugin-google-gtag',
          {
            trackingID: 'G-ZG0JSPYJXZ',
            anonymizeIP: true,
          },
        ],
      ],
      markdown: {
        mermaid: true,
      },
      themes: ['@docusaurus/theme-mermaid'],
    };
    
    export default config;

Here are some code snippets that may help you get started:

💡 To rerun Mayil, comment mayil-ai rerun. Mayil will incorporate any new context added to the ticket. Include details in your rerun comment to guide Mayil!