docs: change configurations to make v2 the main docs (#9729)
* docs: change configurations to make v2 the main docs * move api routes to top level * remove api prefix * update opengraph images * show v1 link * add redirect to v1
This commit is contained in:
@@ -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=
|
||||
|
||||
@@ -838,7 +838,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"
|
||||
|
||||
@@ -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} />
|
||||
|
||||
@@ -16,7 +16,7 @@ To use Medusa's JS SDK library, install the following packages in your project (
|
||||
npm install @medusajs/js-sdk@latest @medusajs/types@latest
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -270,7 +270,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
|
||||
|
||||
@@ -839,7 +839,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"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import OpenAPIParser from "@readme/openapi-parser"
|
||||
import algoliasearch from "algoliasearch"
|
||||
import type { ExpandedDocument, Operation } from "../../../types/openapi"
|
||||
import type { ExpandedDocument, Operation } from "../../types/openapi"
|
||||
import path from "path"
|
||||
import getSectionId from "../../../utils/get-section-id"
|
||||
import getSectionId from "../../utils/get-section-id"
|
||||
import { NextResponse } from "next/server"
|
||||
import { JSDOM } from "jsdom"
|
||||
import getUrl from "../../../utils/get-url"
|
||||
import getUrl from "../../utils/get-url"
|
||||
import { capitalize } from "docs-ui"
|
||||
|
||||
export async function GET() {
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 161 KiB |
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server"
|
||||
import path from "path"
|
||||
import { existsSync } from "fs"
|
||||
import getSchemaContent from "../../../utils/get-schema-content"
|
||||
import getSchemaContent from "../../utils/get-schema-content"
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const { searchParams } = new URL(request.url)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 161 KiB |
@@ -9,7 +9,7 @@ const DownloadFull = () => {
|
||||
|
||||
return (
|
||||
<Button variant="secondary">
|
||||
<Link href={`/api/download/${area}`} download target="_blank">
|
||||
<Link href={`/download/${area}`} download target="_blank">
|
||||
Download OpenApi Specs Collection
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -70,7 +70,7 @@ const TagSectionComponent = ({ tag }: TagSectionProps) => {
|
||||
}>(
|
||||
loadData && tag["x-associatedSchema"]
|
||||
? basePathUrl(
|
||||
`/api/schema?name=${tag["x-associatedSchema"].$ref}&area=${area}`
|
||||
`/schema?name=${tag["x-associatedSchema"].$ref}&area=${area}`
|
||||
)
|
||||
: null,
|
||||
swrFetcher,
|
||||
@@ -81,9 +81,7 @@ const TagSectionComponent = ({ tag }: TagSectionProps) => {
|
||||
const { data: pathsData } = useSWR<{
|
||||
paths: PathsObject
|
||||
}>(
|
||||
loadData
|
||||
? basePathUrl(`/api/tag?tagName=${slugTagName}&area=${area}`)
|
||||
: null,
|
||||
loadData ? basePathUrl(`/tag?tagName=${slugTagName}&area=${area}`) : null,
|
||||
swrFetcher,
|
||||
{
|
||||
errorRetryInterval: 2000,
|
||||
|
||||
@@ -6,7 +6,7 @@ const URL = `${process.env.NEXT_PUBLIC_BASE_URL}${process.env.NEXT_PUBLIC_BASE_P
|
||||
|
||||
export async function getBaseSpecs(area: Area) {
|
||||
try {
|
||||
const res = await fetch(`${URL}/api/base-specs?area=${area}`, {
|
||||
const res = await fetch(`${URL}/base-specs?area=${area}`, {
|
||||
next: {
|
||||
revalidate: 3000,
|
||||
tags: [area],
|
||||
|
||||
@@ -5,13 +5,22 @@ 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/ }]
|
||||
|
||||
return config
|
||||
},
|
||||
transpilePackages: ["docs-ui"],
|
||||
async redirects() {
|
||||
return [
|
||||
{
|
||||
source: "/api/download/:path",
|
||||
destination: "/download/:path",
|
||||
permanent: true,
|
||||
},
|
||||
]
|
||||
},
|
||||
}
|
||||
|
||||
const withMDX = mdx({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"crons": [{
|
||||
"path": "/v2/api/api/algolia",
|
||||
"path": "/api/algolia",
|
||||
"schedule": "0 0 * * 4"
|
||||
}],
|
||||
"framework": "nextjs",
|
||||
|
||||
Reference in New Issue
Block a user