Skip to content

Commit

Permalink
docs: change configurations to make v2 the main docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser committed Oct 23, 2024
1 parent 8891c0a commit 5608069
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 112 deletions.
2 changes: 1 addition & 1 deletion www/apps/api-reference/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ NEXT_PUBLIC_DOCS_ALGOLIA_INDEX_NAME=
NEXT_PUBLIC_API_ALGOLIA_INDEX_NAME=
NEXT_PUBLIC_ALGOLIA_API_KEY=
NEXT_PUBLIC_ALGOLIA_APP_ID=
NEXT_PUBLIC_ENV=
NEXT_PUBLIC_ENV=development # change to production when running npm start
NEXT_PUBLIC_BASE_URL=
NEXT_PUBLIC_DOCS_URL=
NEXT_PUBLIC_UI_URL=
Expand Down
2 changes: 1 addition & 1 deletion www/apps/api-reference/app/_mdx/admin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ If you click on the workflow, you'll view a reference of that workflow, includin

This is useful if you want to extend an API route and pass additional data or perform custom actions.

Refer to [this guide](https://docs.medusajs.com/v2/customization/extend-models/extend-create-product) to find an example of extending an API route.
Refer to [this guide](https://docs.medusajs.com/customization/extend-models/extend-create-product) to find an example of extending an API route.

<Feedback
event="survey_api-ref"
Expand Down
4 changes: 2 additions & 2 deletions www/apps/api-reference/app/_mdx/client-libraries.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DownloadFull from "@/components/DownloadFull"

<H3 className="!mt-0">Just Getting Started?</H3>

Check out the [Medusa v2 Documentation](https://docs.medusajs.com/v2).
Check out the [Medusa v2 Documentation](https://docs.medusajs.com).

<Space bottom={8} />

Expand All @@ -16,7 +16,7 @@ To use Medusa's JS SDK library, install the following packages in your project (
npm install @medusajs/js-sdk@rc @medusajs/types@rc
```

Learn more about the JS SDK in [this documentation](https://docs.medusajs.com/v2/resources/js-sdk).
Learn more about the JS SDK in [this documentation](https://docs.medusajs.com/resources/js-sdk).

### Download Full Reference

Expand Down
4 changes: 2 additions & 2 deletions www/apps/api-reference/app/_mdx/store.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ and associate placed orders with the specified sales channel.

{/* TODO add v2 links */}

Create a publishable API key either using the [admin REST APIs](https://docs.medusajs.com/v2/api/admin#api-keys_postapikeys), or using the Medusa Admin.
Create a publishable API key either using the [admin REST APIs](https://docs.medusajs.com/api/admin#api-keys_postapikeys), or using the Medusa Admin.

### How to Use a Publishable API Key

Expand Down Expand Up @@ -847,7 +847,7 @@ If you click on the workflow, you'll view a reference of that workflow, includin

This is useful if you want to extend an API route and pass additional data or perform custom actions.

Refer to [this guide](https://docs.medusajs.com/v2/customization/extend-models/extend-create-product) to find an example of extending an API route.
Refer to [this guide](https://docs.medusajs.com/customization/extend-models/extend-create-product) to find an example of extending an API route.

<Feedback
event="survey_api-ref"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const TagsOperationDescriptionSectionWorkflowBadge = ({
<p className="my-1">
Workflow{" "}
<Link
href={`${config.baseUrl}/v2/resources/references/medusa-workflows/${workflow}`}
href={`${config.baseUrl}/resources/references/medusa-workflows/${workflow}`}
className="align-middle"
target="_blank"
rel="noreferrer"
Expand Down
2 changes: 1 addition & 1 deletion www/apps/api-reference/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import rehypeSlug from "rehype-slug"

/** @type {import('next').NextConfig} */
const nextConfig = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2/api",
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/api",
webpack: (config) => {
config.ignoreWarnings = [{ module: /node_modules\/keyv\/src\/index\.js/ }]

Expand Down
2 changes: 1 addition & 1 deletion www/apps/api-reference/vercel.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"crons": [{
"path": "/v2/api/api/algolia",
"path": "/api/api/algolia",
"schedule": "0 0 * * 4"
}],
"framework": "nextjs",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ export default MyCustom

## Properties Reference

Refer to the [Data Model API reference](https://docs.medusajs.com/v2/resources/references/data-model) for a full reference of the properties.
Refer to the [Data Model API reference](!resources!/references/data-model) for a full reference of the properties.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This chapter covers how to extend the Create Product API route to link a product

## Additional Data in API Routes

Some API routes, including the [Create Product API route](https://docs.medusajs.com/v2/api/admin#products_postproducts), accept an `additional_data` request body parameter.
Some API routes, including the [Create Product API route](!api!/admin#products_postproducts), accept an `additional_data` request body parameter.

It's useful when you want to pass custom data, such as the brand ID, then perform an action based on this data, such as link the brand to the product.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ In this chapter, you’ll learn how to install and use the Next.js Starter store
},
]} />

1. Clone the `v2` branch of the [Next.js Starter](https://github.com/medusajs/nextjs-starter-medusa/tree/v2):
1. Clone the `v2` branch of the [Next.js Starter](https://github.com/medusajs/nextjs-starter-medusa):

```bash
git clone https://github.com/medusajs/nextjs-starter-medusa -b v2 my-medusa-storefront
git clone https://github.com/medusajs/nextjs-starter-medusa my-medusa-storefront
```

2. Change to the `my-medusa-storefront` directory, install the dependencies, and rename the template environment variable:
Expand Down
6 changes: 3 additions & 3 deletions www/apps/book/components/Homepage/LinksSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const HomepageLinksSection = () => {
text: "Build a Module",
},
{
href: "https://docs.medusajs.com/v2/resources/integrations",
href: "https://docs.medusajs.com/resources/integrations",
text: "Browse third-party integrations",
},
],
Expand All @@ -41,11 +41,11 @@ const HomepageLinksSection = () => {
title: "Storefront Development",
links: [
{
href: "https://docs.medusajs.com/v2/resources/nextjs-starter",
href: "https://docs.medusajs.com/resources/nextjs-starter",
text: "Explore our storefront starter",
},
{
href: "https://docs.medusajs.com/v2/resources/storefront-development",
href: "https://docs.medusajs.com/resources/storefront-development",
text: "Build a custom storefront",
},
{
Expand Down
10 changes: 5 additions & 5 deletions www/apps/book/components/Homepage/RecipesSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@ const HomepageRecipesSection = () => {
type: "large",
title: "Marketplace",
text: "Build a marketplace with multiple vendors",
href: "https://docs.medusajs.com/v2/resources/recipes/marketplace/examples/vendors",
href: "https://docs.medusajs.com/resources/recipes/marketplace/examples/vendors",
icon: ShopIcon,
},
{
type: "large",
title: "Subscriptions",
text: "Implement a subscription-based commerce store.",
href: "https://docs.medusajs.com/v2/resources/recipes/subscriptions/examples/standard",
href: "https://docs.medusajs.com/resources/recipes/subscriptions/examples/standard",
icon: CalendarRefreshIcon,
},
{
type: "large",
title: "Restaurant-Delivery",
text: "Build a restaurant marketplace inspired by UberEats, with real-time delivery handling",
href: "https://docs.medusajs.com/v2/resources/recipes/marketplace/examples/restaurant-delivery",
href: "https://docs.medusajs.com/resources/recipes/marketplace/examples/restaurant-delivery",
icon: ChefHatIcon,
},
{
type: "large",
title: "Digital Products",
text: "Sell digital products with custom fulfillment.",
href: "https://docs.medusajs.com/v2/resources/recipes/digital-products/examples/standard",
href: "https://docs.medusajs.com/resources/recipes/digital-products/examples/standard",
icon: ImageBinaryIcon,
},
]
Expand All @@ -63,7 +63,7 @@ const HomepageRecipesSection = () => {
</span>
</div>
<Link
href={"https://docs.medusajs.com/v2/resources/recipes"}
href={"https://docs.medusajs.com/resources/recipes"}
className="flex gap-0.25 items-center text-compact-small-plus"
withIcon
>
Expand Down
63 changes: 11 additions & 52 deletions www/apps/book/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ const withMDX = mdx({
projectUrls: {
resources: {
url: process.env.NEXT_PUBLIC_RESOURCES_URL,
path: "v2/resources",
path: "resources",
},
"user-guide": {
url: process.env.NEXT_PUBLIC_RESOURCES_URL,
path: "v2/user-guide",
path: "user-guide",
},
ui: {
url: process.env.NEXT_PUBLIC_RESOURCES_URL,
path: "ui",
},
api: {
url: process.env.NEXT_PUBLIC_RESOURCES_URL,
path: "v2/api",
path: "api",
},
},
useBaseUrl:
Expand Down Expand Up @@ -81,29 +81,28 @@ const nextConfig = {
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"],

transpilePackages: ["docs-ui"],
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2",
async rewrites() {
return {
fallback: [
{
source: "/v2/resources",
source: "/resources",
destination: `${
process.env.NEXT_PUBLIC_RESOURCES_URL || "https://localhost:3001"
}/v2/resources`,
}/resources`,
basePath: false,
},
{
source: "/v2/resources/:path*",
source: "/resources/:path*",
destination: `${
process.env.NEXT_PUBLIC_RESOURCES_URL || "https://localhost:3001"
}/v2/resources/:path*`,
}/resources/:path*`,
basePath: false,
},
{
source: "/v2/api/:path*",
source: "/api/:path*",
destination: `${
process.env.NEXT_PUBLIC_API_URL || "https://localhost:3001"
}/v2/api/:path*`,
}/api/:path*`,
basePath: false,
},
// TODO comment out once we have the user guide published
Expand All @@ -123,48 +122,8 @@ const nextConfig = {
async redirects() {
return [
{
source: "/advanced-development/:path*",
destination: "/learn/advanced-development/:path*",
permanent: true,
},
{
source: "/basics/:path*",
destination: "/learn/basics/:path*",
permanent: true,
},
{
source: "/customization/:path*",
destination: "/learn/customization/:path*",
permanent: true,
},
{
source: "/debugging-and-testing/:path*",
destination: "/learn/debugging-and-testing/:path*",
permanent: true,
},
{
source: "/deployment/:path*",
destination: "/learn/deployment/:path*",
permanent: true,
},
{
source: "/first-customizations/:path*",
destination: "/learn/first-customizations/:path*",
permanent: true,
},
{
source: "/more-resources/:path*",
destination: "/learn/more-resources/:path*",
permanent: true,
},
{
source: "/storefront-development/:path*",
destination: "/learn/storefront-development/:path*",
permanent: true,
},
{
source: "/more-resources/examples",
destination: "/resources/examples",
source: "/v2/:path*",
destination: "/:path*",
permanent: true,
},
]
Expand Down
2 changes: 1 addition & 1 deletion www/apps/book/providers/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
},
],
checkInternalPattern: new RegExp(
`^${config.baseUrl}/v2/([^(resources)])*`
`^${config.baseUrl}/([^(resources)])*`
),
filterOptions: searchFilters,
}}
Expand Down
4 changes: 2 additions & 2 deletions www/apps/book/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ module.exports = {
"search-no-result-dark": "url('/images/search-no-result.svg')",
"magnifying-glass": "url('/images/magnifying-glass.svg')",
"magnifying-glass-dark": "url('/images/magnifying-glass-dark.svg')",
"bg-stripes": "url('/v2/images/bg-stripes.png')",
"bg-stripes-dark": "url('/v2/images/bg-stripes-dark.png')",
"bg-stripes": "url('/images/bg-stripes.png')",
"bg-stripes-dark": "url('/images/bg-stripes-dark.png')",
},
},
}
2 changes: 1 addition & 1 deletion www/apps/resources/app/examples/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2388,7 +2388,7 @@ export const myWorkflow = createWorkflow(
)
```

Learn more in [this documentation](https://docs.medusajs.com/v2/advanced-development/workflows/add-workflow-hook).
Learn more in [this documentation](!book!/learn/advanced-development/workflows/add-workflow-hook).

### Retry Steps

Expand Down
2 changes: 1 addition & 1 deletion www/apps/resources/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const nextConfig = {

transpilePackages: ["docs-ui"],

basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2/resources",
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/resources",
async redirects() {
return [
{
Expand Down
2 changes: 1 addition & 1 deletion www/apps/resources/providers/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SearchProvider = ({ children }: SearchProviderProps) => {
],
},
],
checkInternalPattern: new RegExp(`^${config.baseUrl}/v2/resources/.*`),
checkInternalPattern: new RegExp(`^${config.baseUrl}/resources/.*`),
filterOptions: searchFilters,
}}
commands={[
Expand Down
4 changes: 2 additions & 2 deletions www/apps/user-guide/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const withMDX = mdx({
},
api: {
url: process.env.NEXT_PUBLIC_API_URL,
path: "v2/api",
path: "api",
},
},
useBaseUrl:
Expand Down Expand Up @@ -82,7 +82,7 @@ const nextConfig = {

transpilePackages: ["docs-ui"],
// TODO uncomment if we decide on baes path
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/v2/user-guide",
basePath: process.env.NEXT_PUBLIC_BASE_PATH || "/user-guide",
}

export default withMDX(nextConfig)
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const MainNavDesktopMenu = () => {
type: "link",
icon: <QuestionMarkCircle />,
title: "Troubleshooting",
link: "https://docs.medusajs.com/v2/resources/troubleshooting",
link: "https://docs.medusajs.com/resources/troubleshooting",
},
]

Expand Down
2 changes: 1 addition & 1 deletion www/packages/docs-ui/src/components/MainNav/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const MainNav = ({ className, itemsClassName }: MainNavProps) => {
<SidebarLeftIcon />
</Button>
)}
<Link href={`${config.baseUrl}/v2`}>
<Link href={`${config.baseUrl}`}>
<BorderedIcon
IconComponent={MedusaIcon}
iconWrapperClassName="my-[14px]"
Expand Down
Loading

0 comments on commit 5608069

Please sign in to comment.