docs: create docs workspace (#5174)
* docs: migrate ui docs to docs universe * created yarn workspace * added eslint and tsconfig configurations * fix eslint configurations * fixed eslint configurations * shared tailwind configurations * added shared ui package * added more shared components * migrating more components * made details components shared * move InlineCode component * moved InputText * moved Loading component * Moved Modal component * moved Select components * Moved Tooltip component * moved Search components * moved ColorMode provider * Moved Notification components and providers * used icons package * use UI colors in api-reference * moved Navbar component * used Navbar and Search in UI docs * added Feedback to UI docs * general enhancements * fix color mode * added copy colors file from ui-preset * added features and enhancements to UI docs * move Sidebar component and provider * general fixes and preparations for deployment * update docusaurus version * adjusted versions * fix output directory * remove rootDirectory property * fix yarn.lock * moved code component * added vale for all docs MD and MDX * fix tests * fix vale error * fix deployment errors * change ignore commands * add output directory * fix docs test * general fixes * content fixes * fix announcement script * added changeset * fix vale checks * added nofilter option * fix vale error
This commit is contained in:
1 parent
19c5d5ba36
commit
fa7c94b4cc
3209 files changed
+32188
-31018
No files matched your search
@@ -0,0 +1,274 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
require("dotenv").config()
|
||||
const fs = require("fs")
|
||||
const reverseSidebar = require("./src/utils/reverseSidebar")
|
||||
|
||||
const announcementBar = JSON.parse(fs.readFileSync("./announcement.json"))
|
||||
|
||||
/** @type {import('@medusajs/docs').MedusaDocusaurusConfig} */
|
||||
const config = {
|
||||
title: "Medusa",
|
||||
tagline: "Explore and learn how to use Medusa",
|
||||
url: "https://docs.medusajs.com",
|
||||
baseUrl: "/",
|
||||
onBrokenLinks: "throw",
|
||||
onBrokenMarkdownLinks: "throw",
|
||||
favicon: "img/favicon.ico",
|
||||
organizationName: "medusajs",
|
||||
projectName: "medusajs/www",
|
||||
plugins: [
|
||||
require.resolve("docusaurus-plugin-image-zoom"),
|
||||
async function tailwindPlugin() {
|
||||
return {
|
||||
name: "docusaurus-tailwindcss",
|
||||
configurePostCss(postcssOptions) {
|
||||
// Appends TailwindCSS and AutoPrefixer.
|
||||
postcssOptions.plugins.push(require("tailwindcss"))
|
||||
postcssOptions.plugins.push(require("autoprefixer"))
|
||||
return postcssOptions
|
||||
},
|
||||
}
|
||||
},
|
||||
function webpackPlugin() {
|
||||
return {
|
||||
name: "custom-webpack-plugin",
|
||||
configureWebpack() {
|
||||
return {
|
||||
devServer: {
|
||||
client: {
|
||||
overlay: {
|
||||
runtimeErrors: (error) => {
|
||||
if (
|
||||
error.message ===
|
||||
"ResizeObserver loop completed with undelivered notifications."
|
||||
) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
themeConfig: {
|
||||
image: "img/docs-meta.jpg",
|
||||
colorMode: {
|
||||
defaultMode: "light",
|
||||
disableSwitch: false,
|
||||
respectPrefersColorScheme: true,
|
||||
},
|
||||
algoliaConfig: {
|
||||
appId: process.env.ALGOLIA_APP_ID || "temp",
|
||||
apiKey: process.env.ALGOLIA_API_KEY || "temp",
|
||||
indexNames: {
|
||||
docs: process.env.DOCS_ALGOLIA_INDEX_NAME,
|
||||
api: process.env.API_ALGOLIA_INDEX_NAME,
|
||||
},
|
||||
filters: [
|
||||
{
|
||||
value: "docs",
|
||||
label: "Docs",
|
||||
},
|
||||
{
|
||||
value: "user-guide",
|
||||
label: "User Guide",
|
||||
},
|
||||
{
|
||||
value: "admin",
|
||||
label: "Admin API",
|
||||
},
|
||||
{
|
||||
value: "store",
|
||||
label: "Store API",
|
||||
},
|
||||
{
|
||||
value: "plugins",
|
||||
label: "Plugins",
|
||||
},
|
||||
{
|
||||
value: "reference",
|
||||
label: "References",
|
||||
},
|
||||
{
|
||||
value: "ui",
|
||||
label: "UI",
|
||||
},
|
||||
],
|
||||
defaultFiltersByPath: [
|
||||
{
|
||||
path: "/user-guide",
|
||||
filters: ["user-guide"],
|
||||
},
|
||||
{
|
||||
path: "/references",
|
||||
filters: ["reference"],
|
||||
},
|
||||
{
|
||||
path: "/plugins",
|
||||
filters: ["plugins"],
|
||||
},
|
||||
],
|
||||
defaultFilters: ["docs"],
|
||||
},
|
||||
analytics: {
|
||||
apiKey: process.env.SEGMENT_API_KEY || "temp",
|
||||
},
|
||||
prism: {
|
||||
defaultLanguage: "js",
|
||||
plugins: ["line-numbers", "show-language"],
|
||||
theme: require("./src/themes/medusaDocs"),
|
||||
},
|
||||
zoom: {
|
||||
selector: ".markdown :not(.no-zoom-img) > img:not(.no-zoom-img)",
|
||||
},
|
||||
navbar: {
|
||||
hideOnScroll: false,
|
||||
logo: {
|
||||
alt: "Medusa",
|
||||
src: "img/logo-icon.png",
|
||||
srcDark: "img/logo-icon-dark.png",
|
||||
width: 20,
|
||||
height: 20,
|
||||
},
|
||||
items: [
|
||||
{
|
||||
type: "docSidebar",
|
||||
sidebarId: "homepage",
|
||||
label: "Docs",
|
||||
position: "left",
|
||||
},
|
||||
{
|
||||
type: "docSidebar",
|
||||
sidebarId: "userGuideSidebar",
|
||||
label: "User Guide",
|
||||
position: "left",
|
||||
},
|
||||
{
|
||||
href: `${process.env.API_URL}/api/store`,
|
||||
label: "Store API",
|
||||
prependBaseUrlToHref: true,
|
||||
target: "_blank",
|
||||
position: "left",
|
||||
},
|
||||
{
|
||||
href: `${process.env.API_URL}/api/admin`,
|
||||
label: "Admin API",
|
||||
prependBaseUrlToHref: true,
|
||||
target: "_blank",
|
||||
position: "left",
|
||||
},
|
||||
{
|
||||
href: `${process.env.API_URL}/ui`,
|
||||
label: "UI",
|
||||
prependBaseUrlToHref: true,
|
||||
target: "_blank",
|
||||
position: "left",
|
||||
},
|
||||
{
|
||||
type: "search",
|
||||
position: "right",
|
||||
},
|
||||
],
|
||||
},
|
||||
navbarActions: [
|
||||
{
|
||||
type: "button",
|
||||
label: "Report an Issue",
|
||||
className: "max-[1014px]:hidden",
|
||||
href: "https://github.com/medusajs/medusa/issues/new?assignees=&labels=type%3A+docs&template=docs.yml",
|
||||
},
|
||||
],
|
||||
mobileLogo: {
|
||||
alt: "Medusa",
|
||||
src: "img/logo-mobile.png",
|
||||
srcDark: "img/logo-mobile-dark.png",
|
||||
width: 82,
|
||||
height: 20,
|
||||
},
|
||||
footer: {
|
||||
copyright: `© ${new Date().getFullYear()} Medusa, Inc. All rights reserved.`,
|
||||
},
|
||||
socialLinks: [
|
||||
{
|
||||
type: "discord",
|
||||
href: "https://discord.gg/medusajs",
|
||||
},
|
||||
{
|
||||
type: "twitter",
|
||||
href: "https://twitter.com/medusajs",
|
||||
},
|
||||
{
|
||||
type: "linkedin",
|
||||
href: "https://www.linkedin.com/company/medusajs",
|
||||
},
|
||||
{
|
||||
type: "github",
|
||||
href: "https://github.com/medusajs/medusa",
|
||||
},
|
||||
],
|
||||
reportCodeLinkPrefix:
|
||||
"https://github.com/medusajs/medusa/issues/new?assignees=&labels=type%3A+docs&template=docs.yml",
|
||||
footerFeedback: {
|
||||
event: "survey",
|
||||
},
|
||||
docs: {
|
||||
sidebar: {
|
||||
hideable: true,
|
||||
autoCollapseCategories: true,
|
||||
},
|
||||
},
|
||||
cloudinaryConfig: {
|
||||
cloudName: process.env.CLOUDINARY_CLOUD_NAME || "",
|
||||
flags: ["fl_lossy", "f_auto"],
|
||||
resize: {
|
||||
action: "pad",
|
||||
aspectRatio: "16:9",
|
||||
},
|
||||
roundCorners: 16,
|
||||
},
|
||||
},
|
||||
presets: [
|
||||
[
|
||||
"@docusaurus/preset-classic",
|
||||
{
|
||||
docs: {
|
||||
sidebarPath: require.resolve("./sidebars.js"),
|
||||
editUrl: "https://github.com/medusajs/medusa/edit/develop/www/docs",
|
||||
path: "content",
|
||||
routeBasePath: "/",
|
||||
remarkPlugins: [
|
||||
[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)
|
||||
},
|
||||
},
|
||||
theme: {
|
||||
customCss: require.resolve("./src/css/custom.css"),
|
||||
},
|
||||
gtag: {
|
||||
trackingID: "G-S7G7X3JYS3",
|
||||
},
|
||||
sitemap: {
|
||||
filename: "sitemap-docs.xml",
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
}
|
||||
|
||||
if (Object.keys(announcementBar).length) {
|
||||
config.themeConfig.announcementBar = announcementBar
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
Reference in new issue
Block a user