1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-19 17:52:45 +02:00

Docusaurus v3 (#8485)

- Upgrades to latest Docusaurus
- Upgrades our OpenAPI plugin to latest too
- Removes old, unneeded dependencies
- Our configs and sidebar files now use TypeScript

[Preview
link](https://unleash-docs-git-alvin-docusaurus-v3-unleash-team.vercel.app/)

---------

Co-authored-by: melindafekete <melinda.fekete@getunleash.io>
Co-authored-by: Christopher Kolstad <chriswk@getunleash.io>
This commit is contained in:
Alvin Bryan 2024-10-30 11:55:51 +00:00 committed by GitHub
parent a1c98c4400
commit a1d6795533
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
28 changed files with 4838 additions and 4783 deletions

2
.gitignore vendored
View File

@ -58,7 +58,7 @@ frontend/src/openapi/apis
frontend/src/openapi/index.ts frontend/src/openapi/index.ts
# Generated docs # Generated docs
website/docs/reference/api/**/sidebar.js website/docs/reference/api/**/sidebar.ts
website/docs/reference/api/**/**.info.mdx website/docs/reference/api/**/**.info.mdx
website/docs/generated website/docs/generated
reports/jest-junit.xml reports/jest-junit.xml

2
website/.gitignore vendored
View File

@ -20,7 +20,7 @@ yarn-debug.log*
yarn-error.log* yarn-error.log*
# OpenAPI docusaurus generated stuff # OpenAPI docusaurus generated stuff
docs/reference/api/**/sidebar.js docs/reference/api/**/sidebar.ts
*.api.mdx *.api.mdx
*.tag.mdx *.tag.mdx

View File

@ -1,3 +0,0 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

View File

@ -15,7 +15,7 @@
// the bits that are specific to the generation source we use, and make the docs // the bits that are specific to the generation source we use, and make the docs
// easier to use. In particular, removing the leading `/ushosted` is likely to // easier to use. In particular, removing the leading `/ushosted` is likely to
// save us loooots of questions. // save us loooots of questions.
const replace = require('replace-in-file'); import { replaceInFileSync } from 'replace-in-file';
const options = { const options = {
files: 'docs/reference/api/**/*.api.mdx', files: 'docs/reference/api/**/*.api.mdx',
@ -27,4 +27,4 @@ const options = {
to: ['', '"<your-unleash-url>"', '"path":['], to: ['', '"<your-unleash-url>"', '"path":['],
}; };
replace(options); replaceInFileSync(options);

View File

@ -13,12 +13,14 @@ In this tutorial, you will learn how to set up and use iOS feature flags with Un
Here are the steps we will cover in this tutorial: Here are the steps we will cover in this tutorial:
1. [Feature flag best practices for client-side apps](#1-architect-to-limit-pii-and-configuration-leakage) - [Prerequisites](#prerequisites)
2. [Spin up a local provider](#2-install-a-local-feature-flag-provider) - [1. Architect to limit PII and configuration leakage](#1-architect-to-limit-pii-and-configuration-leakage)
3. [Configure a feature flag](#3-create-and-configure-the-feature-flag) - [2. Install a local feature flag provider](#2-install-a-local-feature-flag-provider)
4. [Add Unleash to an iOS app](#4-add-unleash-to-an-ios-app) - [3. Create and configure the feature flag](#3-create-and-configure-the-feature-flag)
5. [Log status of iOS feature flag](#5-configure-unleash-and-log-ios-feature-flag-status) - [4. Add Unleash to an iOS app](#4-add-unleash-to-an-ios-app)
6. [Verify the feature flag experience](#6-verify-the-feature-flag-experience) - [5. Configure Unleash and log iOS feature flag status](#5-configure-unleash-and-log-ios-feature-flag-status)
- [6. Verify the feature flag experience](#6-verify-the-feature-flag-experience)
- [Conclusion](#conclusion)
## Prerequisites ## Prerequisites
@ -37,7 +39,7 @@ a. Limit PII (personally identifiable information) leakage from the end-user dev
b. Avoid leakage of configuration information from the central feature flag control service to end-user devices. b. Avoid leakage of configuration information from the central feature flag control service to end-user devices.
Solving both means you need to avoid evaluating feature flags on the user's machine due to security risks like exposing API keys and flag data. Instead, send application context (e.g. username, location, etc) to your feature flag evaluation service to evaluate the results. These results (and only these results) should be stored in the client-side application memory. By keeping the evaluated results for a specific context in memory, you avoid network roundtrips every time your application needs to check the status of a feature flag. This method prevents unauthorized access and data breaches by [keeping configurations and PII secure](/topics/feature-flags/never-expose-pii). Solving both means you need to avoid evaluating feature flags on the user's machine due to security risks like exposing API keys and flag data. Instead, send application context (e.g. username, location, etc) to your feature flag evaluation service to evaluate the results. These results (and only these results) should be stored in the client-side application memory. By keeping the evaluated results for a specific context in memory, you avoid network roundtrips every time your application needs to check the status of a feature flag. This method prevents unauthorized access and data breaches by [keeping configurations and PII secure](/topics/feature-flags/feature-flag-best-practices#2-protect-pii-by-evaluating-flags-server-side).
![Keep configurations and PII secure image](/img/react-tutorial-pii-diagram.png) ![Keep configurations and PII secure image](/img/react-tutorial-pii-diagram.png)

View File

@ -50,7 +50,7 @@ a. Limit PII (personally identifiable information) leakage from the end-user dev
b. Avoid leakage of configuration information from the central feature flag control service to end-user devices. b. Avoid leakage of configuration information from the central feature flag control service to end-user devices.
Solving both means you need to avoid evaluating feature flags on the user's machine due to security risks like exposing API keys and flag data. Instead, send application context (e.g. username, location, etc) to your feature flag evaluation service to evaluate the results. These results (and only these results) should be stored in the client-side application memory. By keeping the evaluated results for a specific context in memory, you avoid network roundtrips every time your application needs to check the status of a feature flag. This method prevents unauthorized access and data breaches by [keeping configurations and PII secure](/topics/feature-flags/never-expose-pii). Solving both means you need to avoid evaluating feature flags on the user's machine due to security risks like exposing API keys and flag data. Instead, send application context (e.g. username, location, etc) to your feature flag evaluation service to evaluate the results. These results (and only these results) should be stored in the client-side application memory. By keeping the evaluated results for a specific context in memory, you avoid network roundtrips every time your application needs to check the status of a feature flag. This method prevents unauthorized access and data breaches by [keeping configurations and PII secure](/topics/feature-flags/feature-flag-best-practices#2-protect-pii-by-evaluating-flags-server-side).
![Keep configurations and PII secure image](/img/react-tutorial-pii-diagram.png) ![Keep configurations and PII secure image](/img/react-tutorial-pii-diagram.png)

View File

@ -76,7 +76,7 @@ To find your Microsoft Entra identifier, go to the single sign-on settings of yo
To finalize the configuration, do the following: To finalize the configuration, do the following:
1. In the Unleash Admin UI, go to **Admin > Single sign-on> SAML 2.0**. 1. In the Unleash Admin UI, go to **Admin > Single sign-on > SAML 2.0**.
2. In **Entity ID**, enter your [Microsoft Entra identifier](#microsoft-entra-identifier). 2. In **Entity ID**, enter your [Microsoft Entra identifier](#microsoft-entra-identifier).
3. In **Single sign-on URL**, enter your [Login URL](#login-url). 3. In **Single sign-on URL**, enter your [Login URL](#login-url).
4. In **X.509 Certificate**, [enter your SAML certificate](#saml-certificate). 4. In **X.509 Certificate**, [enter your SAML certificate](#saml-certificate).

View File

@ -1,7 +1,10 @@
--- ---
title: Environment Import & Export title: Environment Import & Export
--- ---
import VideoContent from '@site/src/components/VideoContent.jsx' import VideoContent from '@site/src/components/VideoContent.jsx'
import Figure from '@site/src/components/Figure/Figure.tsx'
:::note Availability :::note Availability

View File

@ -71,7 +71,7 @@ Marking a flag as stale helps you deprecate a feature flag without removing the
You can use this to signal to your team to stop using the feature in your applications. Stale flags will show as stale in the [technical debt dashboard](./technical-debt). You can use this to signal to your team to stop using the feature in your applications. Stale flags will show as stale in the [technical debt dashboard](./technical-debt).
Marking a flag as stale generates the `feature-stale-on` [event](./reference/events#feature-stale-on). You can use [an integration](/integrations/integrations) to trigger automated workflows, such as posting notifications in a Slack channel, breaking project builds if the code contains stale flags, or automatically opening pull requests to remove stale flags from the code. Marking a flag as stale generates the `feature-stale-on` [event](/reference/events#feature-stale-on). You can use [an integration](/reference/integrations) to trigger automated workflows, such as posting notifications in a Slack channel, breaking project builds if the code contains stale flags, or automatically opening pull requests to remove stale flags from the code.
### Configure expected lifetime ### Configure expected lifetime

View File

@ -70,7 +70,7 @@ server configured for a specific Jira project.
![A table marked Unleash Server Configuration, listing Unleash server instances.](/img/jira_server_manage_servers.png) ![A table marked Unleash Server Configuration, listing Unleash server instances.](/img/jira_server_manage_servers.png)
Once you have configured at least one Unleash server, your users should be ready to [use the Jira Server plugin](/integrations/jira_server_plugin_usage) Once you have configured at least one Unleash server, your users should be ready to [use the Jira Server plugin](/reference/integrations/jira-server-plugin-usage)
### Edit existing servers ### Edit existing servers

View File

@ -77,14 +77,7 @@ The `PROMETHEUS_API` environment variable should point to the base path of the P
This setup means that there is a mutual dependency between Unleash and Prometheus, where Prometheus regularly fetches data from Unleash's backstage API and Unleash fetches and displays this data when you use the network view. This diagram provides a visual representation of that. This setup means that there is a mutual dependency between Unleash and Prometheus, where Prometheus regularly fetches data from Unleash's backstage API and Unleash fetches and displays this data when you use the network view. This diagram provides a visual representation of that.
```mermaid ![](/img/network-view.png)
sequenceDiagram
participant Unleash
loop Scrape data
Prometheus-->>Unleash: fetch internal-backstage/prometheus
end
Unleash->>+Prometheus: Query data for network view
```
[^1]: For instance: when using Unleash in an API setting, a common mistake is to instantiate a new SDK for every request instead of sharing a single instance across requests. This would be visible in the network overview graph as a large number of requests from the same app. [^1]: For instance: when using Unleash in an API setting, a common mistake is to instantiate a new SDK for every request instead of sharing a single instance across requests. This would be visible in the network overview graph as a large number of requests from the same app.

View File

@ -55,7 +55,6 @@ If you see an item marked with a ❌ that you would find useful, feel free to re
::: :::
<!-- prettier-ignore-start -->
| Capability | [Java](/docs/generated/sdks/server-side/java.md) | [Node.js](/docs/generated/sdks/server-side/node.md) | [Go](/docs/generated/sdks/server-side/go.md) | [Python](/docs/generated/sdks/server-side/python.md) | [Ruby](/docs/generated/sdks/server-side/ruby.md) | [.NET](/docs/generated/sdks/server-side/dotnet.md) | [PHP](/docs/generated/sdks/server-side/php.md) | [Rust](/docs/generated/sdks/server-side/rust.md) | | Capability | [Java](/docs/generated/sdks/server-side/java.md) | [Node.js](/docs/generated/sdks/server-side/node.md) | [Go](/docs/generated/sdks/server-side/go.md) | [Python](/docs/generated/sdks/server-side/python.md) | [Ruby](/docs/generated/sdks/server-side/ruby.md) | [.NET](/docs/generated/sdks/server-side/dotnet.md) | [PHP](/docs/generated/sdks/server-side/php.md) | [Rust](/docs/generated/sdks/server-side/rust.md) |
| --- | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: | | --- | :-: | :-: | :-: | :-: | :-: | :-: | :-: | :-: |
@ -89,7 +88,7 @@ If you see an item marked with a ❌ that you would find useful, feel free to re
| Static fields (`environment`, `appName`) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Static fields (`environment`, `appName`) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Defined fields | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Defined fields | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Custom properties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Custom properties | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| **Category: [`isEnabled`](./client-specification#implementation-of-isenabled)** | | | | | | | | | | **Category: [`isEnabled`](/client-specification#implementation-of-isenabled)** | | | | | | | | |
| Can take context | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Can take context | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Override fallback value | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | Override fallback value | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| Fallback function | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ | ⭕ | ⭕ | | Fallback function | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ | ⭕ | ⭕ |
@ -110,7 +109,6 @@ If you see an item marked with a ❌ that you would find useful, feel free to re
| Bootstrap from file | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ | | Bootstrap from file | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ |
| Custom Bootstrap implementation | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ | | Custom Bootstrap implementation | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ⭕ |
<!-- prettier-ignore-end -->
## Community SDKs ❤️ {#community-sdks} ## Community SDKs ❤️ {#community-sdks}
@ -138,7 +136,7 @@ Here's some of the fantastic work our community has done to make Unleash work in
If you can't find an SDK that fits your requirements, you can also develop your own SDK. To make implementation easier, check out these resources: If you can't find an SDK that fits your requirements, you can also develop your own SDK. To make implementation easier, check out these resources:
- [Unleash Client Specifications](https://github.com/Unleash/client-specification) - Used by all official SDKs to make sure they behave correctly across different language implementations. This lets us verify that a gradual rollout to 10% of the users would affect the same users regardless of which SDK you're using. - [Unleash Client Specifications](https://github.com/Unleash/client-specification) - Used by all official SDKs to make sure they behave correctly across different language implementations. This lets us verify that a gradual rollout to 10% of the users would affect the same users regardless of which SDK you're using.
- [Client SDK overview](./client-specification) - A brief, overall guide of the _Unleash Architecture_ and important aspects of the SDK role in it all. - [Client SDK overview](/client-specification) - A brief, overall guide of the _Unleash Architecture_ and important aspects of the SDK role in it all.
## Client-side SDK behavior ## Client-side SDK behavior

View File

@ -52,7 +52,7 @@ In theory, you could create segments with a thousand constraints, each with a mi
By default, you can apply **at most 5 segments to any one strategy**. Separate strategies (even on the same feature) do not count towards the same total, so you can have two strategies with 5 segments each. By default, you can apply **at most 5 segments to any one strategy**. Separate strategies (even on the same feature) do not count towards the same total, so you can have two strategies with 5 segments each.
You **can** [configure segment limits](./using-unleash/deploy/configuring-unleash#segments) with environment variables. You **can** [configure segment limits](/using-unleash/deploy/configuring-unleash#segments) with environment variables.
### A note on large segments {#large-segments} ### A note on large segments {#large-segments}

View File

@ -23,7 +23,7 @@ Before you can connect your application to Unleash you need a Unleash server. Yo
![A visual overview of an Unleash system as described in the following paragraph.](/img/unleash-architecture-edge.png 'System Overview') ![A visual overview of an Unleash system as described in the following paragraph.](/img/unleash-architecture-edge.png 'System Overview')
- [**Unleash API**](/reference/api/unleash) - The Unleash instance. This is where you create feature flags, configure activation strategies, and parameters, etc. The service that contains all feature flags and their configurations. Configurations declare which activation strategies to use and which parameters they should get. - [**Unleash API**](/reference/api/unleash) - The Unleash instance. This is where you create feature flags, configure activation strategies, and parameters, etc. The service that contains all feature flags and their configurations. Configurations declare which activation strategies to use and which parameters they should get.
- **Unleash Admin UI** - The bundled web interface for interacting with the Unleash instance. Manage flags, define strategies, look at metrics, and much more. Use the UI to [create feature flags](/how-to-create-feature-flag), [manage project access roles](../how-to/how-to-create-and-assign-custom-project-roles), [create API tokens](how-to/how-to-create-api-tokens), and more. - **Unleash Admin UI** - The bundled web interface for interacting with the Unleash instance. Manage flags, define strategies, look at metrics, and much more. Use the UI to [create feature flags](/how-to-create-feature-flag), [manage project access roles](../how-to/how-to-create-and-assign-custom-project-roles), [create API tokens](../how-to/how-to-create-api-tokens), and more.
- [**Unleash SDKs**](../reference/sdks) - Unleash SDKs integrate into your applications and get feature configurations from the Unleash API. Use them to check whether features are enabled or disabled and to send metrics to the Unleash API. [See all our SDKs](../reference/sdks) - [**Unleash SDKs**](../reference/sdks) - Unleash SDKs integrate into your applications and get feature configurations from the Unleash API. Use them to check whether features are enabled or disabled and to send metrics to the Unleash API. [See all our SDKs](../reference/sdks)
- [**Unleash Edge**](../reference/unleash-edge) - The Unleash Edge sits between front-end and native applications on one side and the Unleash API on the other. It can also sit between server-side SDKs and the Unleash API as well. You can scale it independently of the Unleash API to handle large request rates without causing issues for the Unleash API. Edge has all endpoints for the client API, frontend API, and proxy API. - [**Unleash Edge**](../reference/unleash-edge) - The Unleash Edge sits between front-end and native applications on one side and the Unleash API on the other. It can also sit between server-side SDKs and the Unleash API as well. You can scale it independently of the Unleash API to handle large request rates without causing issues for the Unleash API. Edge has all endpoints for the client API, frontend API, and proxy API.

View File

@ -144,8 +144,6 @@ As such, if you're relying on the specifics of the error structure for those API
Before you upgrade we strongly recommend that you take a full [database backup](database-backup), to make sure you can downgrade to version 3. Before you upgrade we strongly recommend that you take a full [database backup](database-backup), to make sure you can downgrade to version 3.
You can also read the highlights of **[what's new in v4](/user_guide/v4-whats-new)**.
### 1. All API calls now require a token. {#1-all-api-calls-now-requires-token} ### 1. All API calls now require a token. {#1-all-api-calls-now-requires-token}
If you are upgrading from Unleash Open-Source v3 client SDKs did not need to use an API token in order to connect to Unleash-server. Starting from v4 we have back-ported the API token handling for Enterprise in to the Open-Source version. This means that all client SDKs now need to use a client token in order to connect to Unleash. If you are upgrading from Unleash Open-Source v3 client SDKs did not need to use an API token in order to connect to Unleash-server. Starting from v4 we have back-ported the API token handling for Enterprise in to the Open-Source version. This means that all client SDKs now need to use a client token in order to connect to Unleash.

View File

@ -1,5 +1,8 @@
const { sdks } = require('./remote-content/sdks'); import type { Config } from '@docusaurus/types';
const { docs: edgeAndProxy } = require('./remote-content/edge-proxy');
import { sdks } from './remote-content/sdks';
import { docs as edgeAndProxy } from './remote-content/edge-proxy';
import pluginNpm2Yarn from '@docusaurus/remark-plugin-npm2yarn';
// for a given redirect object, modify it's `from` property such that for every // for a given redirect object, modify it's `from` property such that for every
// path that doesn't start with `/docs/`, a corresponding path that _does_ start // path that doesn't start with `/docs/`, a corresponding path that _does_ start
@ -38,8 +41,8 @@ const addDocsRoutePrefix = ({ from, ...rest }) => {
from: addDocs(from), from: addDocs(from),
}; };
}; };
/** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = { const config: Config = {
title: 'Unleash Documentation', title: 'Unleash Documentation',
tagline: 'The enterprise ready feature flag service', tagline: 'The enterprise ready feature flag service',
url: 'https://docs.getunleash.io', url: 'https://docs.getunleash.io',
@ -50,7 +53,6 @@ module.exports = {
organizationName: 'Unleash', // Usually your GitHub org/user name. organizationName: 'Unleash', // Usually your GitHub org/user name.
projectName: 'unleash.github.io', // Usually your repo name. projectName: 'unleash.github.io', // Usually your repo name.
trailingSlash: false, trailingSlash: false,
markdown: { mermaid: true },
customFields: { customFields: {
// expose env vars etc here // expose env vars etc here
environment: process.env.NODE_ENV, environment: process.env.NODE_ENV,
@ -170,17 +172,13 @@ module.exports = {
], ],
}, },
prism: { prism: {
theme: require('prism-react-renderer/themes/oceanicNext'),
additionalLanguages: [ additionalLanguages: [
'csharp', 'csharp',
'dart', 'dart',
'http',
'java', 'java',
'kotlin',
'php', 'php',
'ruby', 'ruby',
'rust', 'bash',
'swift',
], ],
}, },
languageTabs: [ languageTabs: [
@ -290,22 +288,16 @@ module.exports = {
'@docusaurus/preset-classic', '@docusaurus/preset-classic',
{ {
docs: { docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo. // Please change this to your repo.
editUrl: editUrl:
'https://github.com/Unleash/unleash/edit/main/website/', 'https://github.com/Unleash/unleash/edit/main/website/',
routeBasePath: '/', routeBasePath: '/',
remarkPlugins: [ remarkPlugins: [[pluginNpm2Yarn, { sync: true }]],
[
require('@docusaurus/remark-plugin-npm2yarn'),
{ sync: true },
],
],
docLayoutComponent: '@theme/DocPage',
docItemComponent: '@theme/ApiItem', docItemComponent: '@theme/ApiItem',
sidebarPath: './sidebars.ts',
}, },
theme: { theme: {
customCss: require.resolve('./src/css/custom.css'), customCss: './src/css/custom.css',
}, },
googleAnalytics: { googleAnalytics: {
trackingID: 'UA-134882379-1', trackingID: 'UA-134882379-1',
@ -911,7 +903,6 @@ module.exports = {
], ],
themes: [ themes: [
'docusaurus-theme-openapi-docs', // Allows use of @theme/ApiItem and other components 'docusaurus-theme-openapi-docs', // Allows use of @theme/ApiItem and other components
'@docusaurus/theme-mermaid',
], ],
scripts: [ scripts: [
{ {
@ -924,5 +915,7 @@ module.exports = {
defer: true, defer: true,
}, },
], ],
clientModules: [require.resolve('./global.js')], clientModules: ['./global.js'],
}; };
export default config;

View File

@ -11,7 +11,7 @@
"build": "yarn generate && yarn fetch-remote-content && docusaurus build", "build": "yarn generate && yarn fetch-remote-content && docusaurus build",
"swizzle": "docusaurus swizzle", "swizzle": "docusaurus swizzle",
"fetch-remote-content": "docusaurus download-remote-content-external && docusaurus download-remote-content-sdks", "fetch-remote-content": "docusaurus download-remote-content-external && docusaurus download-remote-content-sdks",
"generate": "docusaurus gen-api-docs all && node clean-generated-docs.js", "generate": "docusaurus gen-api-docs all && node clean-generated-docs.mjs",
"deploy": "yarn generate && yarn fetch-remote-content && docusaurus deploy", "deploy": "yarn generate && yarn fetch-remote-content && docusaurus deploy",
"clear": "docusaurus clear", "clear": "docusaurus clear",
"serve": "docusaurus serve", "serve": "docusaurus serve",
@ -20,40 +20,22 @@
"test": "NODE_ENV=test node --trace-warnings ../node_modules/.bin/jest remote-content" "test": "NODE_ENV=test node --trace-warnings ../node_modules/.bin/jest remote-content"
}, },
"dependencies": { "dependencies": {
"@docusaurus/core": "2.3.1", "@docusaurus/core": "^3.5.2",
"@docusaurus/plugin-client-redirects": "2.3.1", "@docusaurus/plugin-client-redirects": "^3.5.2",
"@docusaurus/plugin-google-analytics": "2.3.1", "@docusaurus/plugin-google-analytics": "^3.5.2",
"@docusaurus/preset-classic": "2.3.1", "@docusaurus/preset-classic": "^3.5.2",
"@docusaurus/remark-plugin-npm2yarn": "2.3.1", "@docusaurus/remark-plugin-npm2yarn": "3.5.2",
"@docusaurus/theme-mermaid": "2.3.1", "@mdx-js/react": "^3.1.0",
"@mdx-js/react": "1.6.22", "docusaurus-plugin-openapi-docs": "^4.1.0",
"@svgr/webpack": "8.1.0", "docusaurus-plugin-remote-content": "^4.0.0",
"browserslist": "^4.16.5", "docusaurus-theme-openapi-docs": "^4.1.0",
"docusaurus-plugin-openapi-docs": "2.0.0-beta.3", "git-url-parse": "^15.0.0",
"docusaurus-plugin-remote-content": "^3.1.0",
"docusaurus-theme-openapi-docs": "2.0.0-beta.2",
"git-url-parse": "^14.0.0",
"plugin-image-zoom": "flexanalytics/plugin-image-zoom", "plugin-image-zoom": "flexanalytics/plugin-image-zoom",
"prism-react-renderer": "^2.4.0",
"prism-svelte": "^0.5.0", "prism-svelte": "^0.5.0",
"react": "18.3.1", "react": "^18.3.1",
"react-dom": "18.3.1", "react-dom": "^18.3.1",
"url-loader": "4.1.1" "replace-in-file": "^8.2.0"
},
"resolutions": {
"axios": "^0.28.0",
"async": "^3.2.4",
"trim": "^1.0.0",
"got": "^13.0.0",
"glob-parent": "^6.0.0",
"browserslist": "^4.16.5",
"set-value": "^4.0.1",
"ansi-regex": "^5.0.1",
"nth-check": "^2.0.1",
"minimatch": "^5.0.0",
"decode-uri-component": "^0.4.0",
"qs": "^6.9.7",
"ws": "^8.18.0",
"semver": "^7.5.3"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
@ -68,14 +50,14 @@
] ]
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.25.9", "@docusaurus/module-type-aliases": "^3.5.2",
"@docusaurus/module-type-aliases": "2.3.1", "@docusaurus/types": "^3.5.2",
"@tsconfig/docusaurus": "2.0.3", "@tsconfig/docusaurus": "2.0.3",
"babel-loader": "9.2.1", "@types/react": "^18.3.12",
"enhanced-resolve": "5.17.1", "typescript": "5.6.3"
"react-router": "6.27.0", },
"replace-in-file": "7.2.0", "resolutions": {
"typescript": "5.4.5" "http-proxy-middleware": "3.0.3"
}, },
"packageManager": "yarn@4.5.1" "packageManager": "yarn@4.5.1"
} }

View File

@ -1,10 +1,10 @@
const { import {
enrich, enrich,
mapObject, mapObject,
modifyContent, modifyContent,
getRepoData, getRepoData,
getUrls, getUrls,
} = require('./shared'); } from './shared';
const DOCS = mapObject(enrich)({ const DOCS = mapObject(enrich)({
'unleash-proxy': { 'unleash-proxy': {
@ -46,7 +46,7 @@ const modifyContent2 = modifyContent({
getAdditionalAdmonitions: getAdmonitions, getAdditionalAdmonitions: getAdmonitions,
}); });
module.exports.docs = { export const docs = {
urls: getUrls(DOCS), urls: getUrls(DOCS),
modifyContent: modifyContent2, modifyContent: modifyContent2,
}; };

View File

@ -1,9 +1,9 @@
const { import {
enrichAdditional, enrichAdditional,
modifyContent, modifyContent,
getRepoData, getRepoData,
getUrls, getUrls,
} = require('./shared'); } from './shared';
// Type definitions // Type definitions
// //
@ -117,7 +117,7 @@ const modifyContent2 = modifyContent({
getAdditionalAdmonitions: getAdmonitions, getAdditionalAdmonitions: getAdmonitions,
}); });
module.exports.sdks = { export const sdks = {
urls: getUrls(SDKS), urls: getUrls(SDKS),
modifyContent: modifyContent2, modifyContent: modifyContent2,
}; };

View File

@ -1,4 +1,4 @@
const { docs } = require('./edge-proxy'); import { docs } from './edge-proxy';
test('Should get all sub pages', () => { test('Should get all sub pages', () => {
expect(docs.urls).toStrictEqual([ expect(docs.urls).toStrictEqual([

View File

@ -1,9 +1,9 @@
const path = require('path'); import path from 'node:path';
module.exports.mapObject = (fn) => (o) => export const mapObject = (fn) => (o) =>
Object.fromEntries(Object.entries(o).map(fn)); Object.fromEntries(Object.entries(o).map(fn));
module.exports.enrichAdditional = export const enrichAdditional =
(additionalProperties) => (additionalProperties) =>
([repoName, repoData]) => { ([repoName, repoData]) => {
const repoUrl = `https://github.com/Unleash/${repoName}`; const repoUrl = `https://github.com/Unleash/${repoName}`;
@ -17,9 +17,10 @@ module.exports.enrichAdditional =
{ ...repoData, repoUrl, slugName, branch, ...additionalProperties }, { ...repoData, repoUrl, slugName, branch, ...additionalProperties },
]; ];
}; };
module.exports.enrich = module.exports.enrichAdditional({});
module.exports.getRepoData = (documents) => (filename) => { export const enrich = enrichAdditional({});
export const getRepoData = (documents) => (filename) => {
const repoName = filename.split('/')[0]; const repoName = filename.split('/')[0];
const repoData = documents[repoName]; const repoData = documents[repoName];
@ -80,7 +81,7 @@ const replaceLinks = ({ content, repo }) => {
.replaceAll(imageSrcLink, replaceImageSrcLink); .replaceAll(imageSrcLink, replaceImageSrcLink);
}; };
module.exports.modifyContent = export const modifyContent =
({ ({
getRepoDataFn, getRepoDataFn,
filePath = () => {}, filePath = () => {},
@ -128,11 +129,15 @@ module.exports.modifyContent =
content: `--- content: `---
title: ${subpage?.sidebarName ?? data.sidebarName} title: ${subpage?.sidebarName ?? data.sidebarName}
slug: ${processedSlug} slug: ${processedSlug}
custom_edit_url: ${data.repoUrl}/edit/${data.branch}/${subpage ? subpageKey : 'README.md'} custom_edit_url: ${data.repoUrl}/edit/${data.branch}/${
subpage ? subpageKey : 'README.md'
}
--- ---
:::info Generated content :::info Generated content
This document was generated from ${subpage ? subpageKey : 'README.md'} in the [${data.sidebarName} GitHub repository](${data.repoUrl}). This document was generated from ${
subpage ? subpageKey : 'README.md'
} in the [${data.sidebarName} GitHub repository](${data.repoUrl}).
::: :::
${additionalAdmonitions} ${additionalAdmonitions}
@ -152,7 +157,7 @@ This content was generated on <time dateTime="${generationTime.toISOString()}">$
}; };
}; };
module.exports.getUrls = (documents) => export const getUrls = (documents) =>
Object.entries(documents).flatMap(([repo, { branch, subPages }]) => [ Object.entries(documents).flatMap(([repo, { branch, subPages }]) => [
`${repo}/${branch}/README.md`, `${repo}/${branch}/README.md`,
...(Object.keys(subPages ?? {}).map( ...(Object.keys(subPages ?? {}).map(

View File

@ -9,10 +9,11 @@
Create as many sidebars as you want. Create as many sidebars as you want.
*/ */
// TODO: Add warning to legacy API docs - but generated items import type { SidebarsConfig } from '@docusaurus/plugin-content-docs';
// TODO: Continue to clean URLs & redirects - but wait for SEO results first
module.exports = { import docsSidebar from './docs/reference/api/unleash/sidebar.ts';
const sidebars: SidebarsConfig = {
academy: [ academy: [
{ {
label: 'Unleash Academy', label: 'Unleash Academy',
@ -237,7 +238,7 @@ module.exports = {
label: 'iOS', label: 'iOS',
link: { link: {
type: 'doc', type: 'doc',
id: 'feature-flag-tutorials/ios/implementing-feature-flags', id: 'feature-flag-tutorials/ios/implementing-feature-flags-ios',
}, },
items: [ items: [
{ {
@ -381,7 +382,7 @@ module.exports = {
slug: '/reference/api/unleash', slug: '/reference/api/unleash',
}, },
items: [ items: [
require('./docs/reference/api/unleash/sidebar.js'), docsSidebar,
{ {
'System API': [ 'System API': [
'reference/api/legacy/unleash/internal/prometheus', 'reference/api/legacy/unleash/internal/prometheus',
@ -686,3 +687,5 @@ module.exports = {
}, },
], ],
}; };
export default sidebars;

View File

@ -1,7 +1,7 @@
// biome-ignore lint/correctness/noUnusedImports: Needs this for React to work // biome-ignore lint/correctness/noUnusedImports: Needs this for React to work
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { getContributors } from './contributors'; import { getContributors } from './contributors';
import styles from './contributors.module.scss'; import styles from './contributors.module.css';
const unleashTeam = new Map([ const unleashTeam = new Map([
['alvinometric', 'developer advocate, Unleash'], ['alvinometric', 'developer advocate, Unleash'],

View File

@ -8,18 +8,18 @@
gap: 20px; gap: 20px;
margin: 0; margin: 0;
padding: 0; padding: 0;
li{
list-style: none;
}
} }
.unleash{ .wrapper li {
list-style: none;
}
.unleash {
position: relative; position: relative;
display: block; display: block;
} }
.unleash:before{ .unleash:before {
display: block; display: block;
position: absolute; position: absolute;
z-index: 2; z-index: 2;
@ -33,18 +33,18 @@
.contributor { .contributor {
margin-top: 10px; margin-top: 10px;
img{
border-radius: 100%;
margin:0;
padding: 0;
border: 2px solid var(--unleash-color-gray);
transition: border-color var(--ifm-transition-fast) var(--ifm-transition-timing-default),
scale var(--ifm-transition-fast) var(--ifm-transition-timing-default);
}
} }
.contributor img:hover{ .contributor img {
border-radius: 100%;
margin: 0;
padding: 0;
border: 2px solid var(--unleash-color-gray);
transition: border-color var(--ifm-transition-fast) var(--ifm-transition-timing-default),
scale var(--ifm-transition-fast) var(--ifm-transition-timing-default);
}
.contributor img:hover {
border-color: var(--ifm-pagination-nav-color-hover); border-color: var(--ifm-pagination-nav-color-hover);
scale: 1.1; scale: 1.1;
} }
@ -53,4 +53,4 @@
.wrapper { .wrapper {
display: block; display: block;
} }
} }

View File

@ -1,7 +1,7 @@
// biome-ignore lint/correctness/noUnusedImports: Needs this for React to work // biome-ignore lint/correctness/noUnusedImports: Needs this for React to work
import React from 'react'; import React from 'react';
import Footer from '@theme-original/DocItem/Footer'; import Footer from '@theme-original/DocItem/Footer';
import { useDoc } from '@docusaurus/theme-common/internal'; import { useDoc } from '@docusaurus/plugin-content-docs/client';
import GitHubContributors from './GitHubContributors'; import GitHubContributors from './GitHubContributors';
import GitUrlParse from 'git-url-parse'; import GitUrlParse from 'git-url-parse';

View File

@ -1,9 +1,15 @@
import siteConfig from '@generated/docusaurus.config'; import siteConfig from '@generated/docusaurus.config';
export default function prismIncludeLanguages(PrismObject) { import type * as PrismNamespace from 'prismjs';
import type { Optional } from 'utility-types';
export default function prismIncludeLanguages(
PrismObject: typeof PrismNamespace,
): void {
const { const {
themeConfig: { prism }, themeConfig: { prism },
} = siteConfig; } = siteConfig;
const { additionalLanguages } = prism; const { additionalLanguages } = prism as { additionalLanguages: string[] };
// Prism components work on the Prism instance on the window, while prism- // Prism components work on the Prism instance on the window, while prism-
// react-renderer uses its own Prism instance. We temporarily mount the // react-renderer uses its own Prism instance. We temporarily mount the
// instance onto window, import components to enhance it, then remove it to // instance onto window, import components to enhance it, then remove it to
@ -11,12 +17,17 @@ export default function prismIncludeLanguages(PrismObject) {
// You can mutate PrismObject: registering plugins, deleting languages... As // You can mutate PrismObject: registering plugins, deleting languages... As
// long as you don't re-assign it // long as you don't re-assign it
globalThis.Prism = PrismObject; globalThis.Prism = PrismObject;
additionalLanguages.forEach((lang) => { additionalLanguages.forEach((lang) => {
if (lang === 'php') {
// eslint-disable-next-line global-require
require('prismjs/components/prism-markup-templating.js');
}
// eslint-disable-next-line global-require, import/no-dynamic-require // eslint-disable-next-line global-require, import/no-dynamic-require
require(`prismjs/components/prism-${lang}`); require(`prismjs/components/prism-${lang}`);
}); });
require('prism-svelte'); require('prism-svelte');
delete globalThis.Prism; delete (globalThis as Optional<typeof globalThis, 'Prism'>).Prism;
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

File diff suppressed because it is too large Load Diff