Summary: This adds a new npm package "internaldocs-fb-helpers", and shows example usage in the flipper package. This will stop everyone from having to inline the function definitions everywhere as is currently the case. (It's using the old internaldocs name, to match the existing docusaurus-plugin-internaldocs-fb package - I don't think that's a big deal.) It currently exports two methods: * `fbContent(internalContent, publicContent)` * Allows you to return internal or external content based on build variant. * Has named args so you don't accidentally put internal stuff in the external arg. * `isInternal(): boolean` * Not strictly necessary, but helps if you want to write your docs using an boolean variable rather than a switching function every time. * `fbInternalOnly(internalContent)` * Convenience method for when you want internal content, or nothing. I could have put these inside the existing docusaurus plugin, but that has docu v2 as a peer dependency, and I want these helpers to work on v1 as well, so made it a standalone package. Reviewed By: passy Differential Revision: D23474462 fbshipit-source-id: 22e5be6de2f3233deb298f1542a06e3575b6555a
172 lines
4.3 KiB
JavaScript
172 lines
4.3 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
const {fbContent, fbInternalOnly} = require('internaldocs-fb-helpers');
|
|
|
|
const repoUrl = 'https://github.com/facebook/flipper';
|
|
const siteConfig = {
|
|
title: fbContent({internal: 'Flipper @FB', external: 'Flipper'}),
|
|
tagline: 'Extensible mobile app debugging',
|
|
url: fbContent({
|
|
internal: 'https://flipper.thefacebook.com/',
|
|
external: 'https://fbflipper.com/',
|
|
}),
|
|
baseUrl: '/',
|
|
projectName: 'flipper',
|
|
// TODO: T69061026 enable once sandy docs are complete: external_domain: 'fbflipper.com',
|
|
themeConfig: {
|
|
navbar: {
|
|
title: fbContent({internal: 'Flipper @FB', external: 'Flipper'}),
|
|
logo: {
|
|
alt: 'Flipper Logo',
|
|
src: 'img/icon.png',
|
|
},
|
|
items: [
|
|
{
|
|
to: 'docs/features/index',
|
|
label: 'Features',
|
|
position: 'right',
|
|
},
|
|
{
|
|
to: 'docs/getting-started/index',
|
|
label: 'Setup',
|
|
position: 'right',
|
|
},
|
|
{
|
|
to: 'docs/extending/index',
|
|
label: 'Extending',
|
|
position: 'right',
|
|
},
|
|
{
|
|
href: repoUrl,
|
|
label: 'GitHub',
|
|
position: 'right',
|
|
},
|
|
...fbInternalOnly([
|
|
{
|
|
to: 'docs/fb/index',
|
|
label: 'FB Internal',
|
|
position: 'right',
|
|
},
|
|
]),
|
|
],
|
|
},
|
|
colorMode: {
|
|
// Nothing against dark mode, but our current CSS doesn't have high contrast
|
|
// so it needs some work before being enabled.
|
|
defaultMode: 'light',
|
|
disableSwitch: true,
|
|
},
|
|
footer: {
|
|
style: 'dark',
|
|
links: [
|
|
{
|
|
title: 'Learn',
|
|
items: [
|
|
{
|
|
label: 'Getting Started',
|
|
to: 'docs/getting-started/index',
|
|
},
|
|
{
|
|
label: 'Plugin Creation Tutorial',
|
|
to: 'docs/tutorial/intro',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: 'Plugins',
|
|
items: [
|
|
{
|
|
label: 'Core Plugins',
|
|
to: 'docs/features/index',
|
|
},
|
|
{
|
|
label: 'Community Plugins',
|
|
href: 'https://www.npmjs.com/search?q=keywords:flipper-plugin',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: 'Legal',
|
|
// Please do not remove the privacy and terms, it's a legal requirement.
|
|
items: [
|
|
{
|
|
label: 'Privacy',
|
|
href: 'https://opensource.facebook.com/legal/privacy/',
|
|
},
|
|
{
|
|
label: 'Terms',
|
|
href: 'https://opensource.facebook.com/legal/terms/',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
title: 'More',
|
|
items: [
|
|
{
|
|
label: 'Twitter',
|
|
href: 'https://twitter.com/flipper_fb',
|
|
},
|
|
{
|
|
label: 'GitHub',
|
|
href: repoUrl,
|
|
},
|
|
],
|
|
},
|
|
],
|
|
copyright: 'Copyright © ' + new Date().getFullYear() + ' Facebook',
|
|
logo: {
|
|
alt: 'Flipper Mascot',
|
|
src: 'img/mascot.png',
|
|
},
|
|
},
|
|
algolia: fbContent({
|
|
internal: undefined,
|
|
external: {
|
|
apiKey: '2df980e7ffc95c19552790f7cad32666',
|
|
indexName: 'fbflipper',
|
|
algoliaOptions: {
|
|
hitsPerPage: 5,
|
|
},
|
|
},
|
|
}),
|
|
prism: {
|
|
additionalLanguages: ['groovy', 'java', 'kotlin', 'ruby', 'swift'],
|
|
},
|
|
},
|
|
favicon: 'img/icon.png',
|
|
scripts: [
|
|
'https://buttons.github.io/buttons.js',
|
|
'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
|
|
'/js/code-blocks-buttons.js',
|
|
'/js/google-analytics.js',
|
|
],
|
|
stylesheets: [],
|
|
// start_config_example
|
|
plugins: [require.resolve('docusaurus-plugin-internaldocs-fb')],
|
|
// end_config_example
|
|
presets: [
|
|
[
|
|
'@docusaurus/preset-classic',
|
|
{
|
|
docs: {
|
|
path: '../docs',
|
|
sidebarPath: require.resolve('./sidebars.js'),
|
|
editUrl: 'https://github.com/facebook/flipper/blob/master/website',
|
|
},
|
|
theme: {
|
|
customCss: require.resolve('./static/css/custom.css'),
|
|
},
|
|
},
|
|
],
|
|
],
|
|
};
|
|
|
|
module.exports = siteConfig;
|