docs: small fixes across documentation (#3815)

This commit is contained in:
Shahed Nasser
2023-04-12 15:04:09 +03:00
committed by GitHub
parent 8e7e346683
commit bd21277142
4 changed files with 79 additions and 71 deletions
+67 -65
View File
@@ -1,14 +1,14 @@
require('dotenv').config();
require("dotenv").config()
const path = require("path")
const fs = require("fs")
const docsPath = path.join(__dirname, "../../docs/content")
const apisPath = path.join(__dirname, "../../docs/api")
const reverseSidebar = require('./src/utils/reverseSidebar')
const reverseSidebar = require("./src/utils/reverseSidebar")
const algoliaAppId = process.env.ALGOLIA_APP_ID || "temp"
const algoliaApiKey = process.env.ALGOLIA_API_KEY || "temp"
const announcementBar = JSON.parse(fs.readFileSync('./announcement.json'))
const announcementBar = JSON.parse(fs.readFileSync("./announcement.json"))
/** @type {import('@docusaurus/types').DocusaurusConfig} */
const config = {
@@ -25,15 +25,15 @@ const config = {
[
"docusaurus-plugin-segment",
{
apiKey: process.env.SEGMENT_API_KEY || "temp"
}
apiKey: process.env.SEGMENT_API_KEY || "temp",
},
],
require.resolve("docusaurus-plugin-image-zoom"),
],
themeConfig: {
image: 'img/docs-banner.jpg',
image: "img/docs-banner.jpg",
colorMode: {
defaultMode: 'light',
defaultMode: "light",
disableSwitch: false,
respectPrefersColorScheme: true,
},
@@ -43,7 +43,7 @@ const config = {
placeholder: "Search docs...",
appId: algoliaAppId,
contextualSearch: false,
externalUrlRegex: "https://medusajs.com"
externalUrlRegex: "https://medusajs.com",
},
prism: {
defaultLanguage: "js",
@@ -51,46 +51,46 @@ const config = {
theme: require("./src/themes/medusaDocs"),
},
zoom: {
selector: '.markdown :not(.no-zoom-img) > img:not(.no-zoom-img)'
selector: ".markdown :not(.no-zoom-img) > img:not(.no-zoom-img)",
},
navbar: {
hideOnScroll: false,
logo: {
alt: "Medusa",
src: "img/logo.png",
srcDark: "img/logo-dark.png"
srcDark: "img/logo-dark.png",
},
items: [
{
type: 'search',
position: 'left',
type: "search",
position: "left",
},
{
type: "docSidebar",
sidebarId: "homepage",
label: "Docs",
position: "right"
position: "right",
},
{
type: "docSidebar",
sidebarId: "userGuideSidebar",
label: "User Guide",
position: "right"
position: "right",
},
{
href: "/api/store",
label: "Store API",
prependBaseUrlToHref: true,
target: '_blank',
position: "right"
target: "_blank",
position: "right",
},
{
href: "/api/admin",
label: "Admin API",
prependBaseUrlToHref: true,
target: '_blank',
position: "right"
}
target: "_blank",
position: "right",
},
],
},
navbarActions: [
@@ -98,51 +98,49 @@ const config = {
type: "link",
href: "https://github.com/medusajs/medusa/issues/new?assignees=&labels=type%3A+docs&template=docs.yml",
title: "Report an Issue",
icon: "report"
}
icon: "report",
},
],
footer: {
copyright: `© ${new Date().getFullYear()} Medusa, Inc. All rights reserved.`,
},
socialLinks: [
{
type: 'discord',
href: 'https://discord.gg/medusajs'
type: "discord",
href: "https://discord.gg/medusajs",
},
{
type: 'twitter',
href: 'https://twitter.com/medusajs'
type: "twitter",
href: "https://twitter.com/medusajs",
},
{
type: 'linkedin',
href: 'https://www.linkedin.com/company/medusajs'
type: "linkedin",
href: "https://www.linkedin.com/company/medusajs",
},
{
type: 'github',
href: 'https://github.com/medusajs/medusa'
}
type: "github",
href: "https://github.com/medusajs/medusa",
},
],
reportCodeLinkPrefix: 'https://github.com/medusajs/medusa/issues/new?assignees=&labels=type%3A+docs&template=docs.yml',
reportCodeLinkPrefix:
"https://github.com/medusajs/medusa/issues/new?assignees=&labels=type%3A+docs&template=docs.yml",
footerFeedback: {
event: 'survey'
event: "survey",
},
docs: {
sidebar: {
autoCollapseCategories: true
}
autoCollapseCategories: true,
},
},
cloudinaryConfig: {
cloudName: process.env.CLOUDINARY_CLOUD_NAME || "",
flags: [
'fl_lossy',
'f_auto'
],
flags: ["fl_lossy", "f_auto"],
resize: {
action: 'pad',
aspectRatio: '16:9'
action: "pad",
aspectRatio: "16:9",
},
roundCorners: 16
}
roundCorners: 16,
},
},
presets: [
[
@@ -150,50 +148,54 @@ const config = {
{
docs: {
sidebarPath: require.resolve("./sidebars.js"),
editUrl: "https://github.com/medusajs/medusa/edit/master/docs/content",
editUrl:
"https://github.com/medusajs/medusa/edit/develop/docs/content",
path: docsPath,
routeBasePath: "/",
remarkPlugins: [
[require('@docusaurus/remark-plugin-npm2yarn'), {sync: true}],
[require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }],
],
showLastUpdateTime: true,
// breadcrumbs: false,
async sidebarItemsGenerator({defaultSidebarItemsGenerator, ...args}) {
const sidebarItems = await defaultSidebarItemsGenerator(args);
return reverseSidebar(sidebarItems, args.item);
async sidebarItemsGenerator({
defaultSidebarItemsGenerator,
...args
}) {
const sidebarItems = await defaultSidebarItemsGenerator(args)
return reverseSidebar(sidebarItems, args.item)
},
},
theme: {
customCss: require.resolve("./src/css/custom.css")
customCss: require.resolve("./src/css/custom.css"),
},
gtag: {
trackingID: 'G-S7G7X3JYS3',
trackingID: "G-S7G7X3JYS3",
},
},
],
[
'redocusaurus',
"redocusaurus",
{
// Plugin Options for loading OpenAPI files
specs: [
{
spec: path.join(apisPath, 'store/openapi.yaml'),
route: '/api/store',
spec: path.join(apisPath, "store/openapi.yaml"),
route: "/api/store",
layout: {
noFooter: true
}
noFooter: true,
},
},
{
spec: path.join(apisPath, 'admin/openapi.yaml'),
route: '/api/admin',
spec: path.join(apisPath, "admin/openapi.yaml"),
route: "/api/admin",
layout: {
noFooter: true
}
}
noFooter: true,
},
},
],
// Theme Options for modifying how redoc renders them
theme: {
primaryColorDark: '#161618',
primaryColorDark: "#161618",
options: {
disableSearch: true,
nativeScrollbars: true,
@@ -203,14 +205,14 @@ const config = {
generatedPayloadSamplesMaxDepth: 4,
showObjectSchemaExamples: true,
requiredPropsFirst: true,
hideRequestPayloadSample: true
hideRequestPayloadSample: true,
},
theme: {
sidebar: {
width: '250px'
}
}
}
width: "250px",
},
},
},
},
],
],