docs: prep for v2 documentation (#6710)

This PR includes documentation that preps for v2 docs (but doesn't introduce new docs).

_Note: The number of file changes in the PR is due to find-and-replace within the `references` which is unavoidable. Let me know if I should move it to another PR._

## Changes

- Change Medusa version in base OAS used for v2.
- Fix to docblock generator related to not catching all path parameters.
- Added typedoc plugin that generates ER Diagrams, which will be used specifically for data model references in commerce modules.
- Changed OAS tool to output references in `www/apps/api-reference/specs-v2` directory when the `--v2` option is used.
- Added a version switcher to the API reference to switch between V1 and V2. This switcher is enabled by an environment variable, so it won't be visible/usable at the moment.
- Upgraded docusaurus to v3.0.1
- Added new Vale rules to ensure correct spelling of Medusa Admin and module names.
- Added new components to the `docs-ui` package that will be used in future documentation changes.
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-03-18 07:47:35 +00:00
1 parent 56a6ec0227
commit bb87db8342
2008 files changed
+15716 -10536

No files matched your search

@@ -1,6 +1,6 @@
# Pricing Concepts
In this document, you’ll learn about the main concepts in the Pricing module, and how data is stored and related.
In this document, you’ll learn about the main concepts in the Pricing Module, and how data is stored and related.
## Money Amount
@@ -74,10 +74,10 @@ Each rule of a price list can have more than one value, representing its values
## Use Case Example: Pricing and Product Modules
In a real use case, you would use the pricing module with your custom logic or other Medusa Commerce Modules, such as the Product Module.
In a real use case, you would use the Pricing Module with your custom logic or other Medusa Commerce Modules, such as the Product Module.
When used with the Product Module, a product variant’s prices are stored as money amounts belonging to a price set. A relation is formed between the `ProductVariant` and the `PriceSet` when the modules are linked.
![A diagram showcasing an example of how resources from the Pricing and Product module are linked. The PriceSet is linked to the ProductVariant of the Product module.](https://res.cloudinary.com/dza7lstvk/image/upload/v1700574189/Medusa%20Docs/Diagrams/pricing-product_jcsjt0.jpg)
![A diagram showcasing an example of how resources from the Pricing and Product module are linked. The PriceSet is linked to the ProductVariant of the Pricing Module.](https://res.cloudinary.com/dza7lstvk/image/upload/v1700574189/Medusa%20Docs/Diagrams/pricing-product_jcsjt0.jpg)
So, when you want to add prices for a product variant, you create a price set and add the prices as money amounts to it. You can then benefit from adding rules to prices or using the `calculatePrices` method to retrieve the price of a product variant within a specified context.
@@ -4,7 +4,7 @@ import TabItem from '@theme/TabItem';
# Examples of Pricing Module
In this document, you’ll find common examples of how you can use the Pricing module in your application.
In this document, you’ll find common examples of how you can use the Pricing Module in your application.
## Create a Price Set
@@ -5,11 +5,11 @@ import TabItem from '@theme/TabItem';
# Install Pricing Module in Medusa
In this document, you'll learn how to install the Pricing module using NPM in the Medusa backend.
In this document, you'll learn how to install the Pricing Module using NPM in the Medusa backend.
## Step 1: Install Module
To install the Pricing module, run the following command in the root directory of the Medusa backend:
To install the Pricing Module, run the following command in the root directory of the Medusa backend:
```bash npm2yarn
npm install @medusajs/pricing
@@ -19,7 +19,7 @@ npm install @medusajs/pricing
## Step 2: Add Module to Configurations
In `medusa-config.js`, add the pricing module to the exported object under the `modules` property:
In `medusa-config.js`, add the Pricing Module to the exported object under the `modules` property:
```js title=medusa-config.js
module.exports = {
@@ -153,6 +153,6 @@ For example:
## Start Development
You can refer to the [Example Usages documentation page](./examples.mdx) for examples of using the Pricing module.
You can refer to the [Example Usages documentation page](./examples.mdx) for examples of using the Pricing Module.
You can also refer to the [Module Interface Reference](../../references/pricing/interfaces/pricing.IPricingModuleService.mdx) for a detailed reference on all available methods.
@@ -1,10 +1,10 @@
# Install in Node.js-Based Application
In this document, you’ll learn how to setup and use the Pricing module in a Node.js based application.
In this document, you’ll learn how to setup and use the Pricing Module in a Node.js based application.
## Prerequisites
Before installing the Pricing module in your application, make sure you have the following prerequisites:
Before installing the Pricing Module in your application, make sure you have the following prerequisites:
- Node.js v16 or greater
- PostgreSQL database. You can use an existing Medusa database, or set up a new PostgreSQL database.
@@ -13,7 +13,7 @@ Before installing the Pricing module in your application, make sure you have the
## Install Package
In your Node.js-based applications, such as a Next.js application, you can install the Pricing module with the following command:
In your Node.js-based applications, such as a Next.js application, you can install the Pricing Module with the following command:
```bash npm2yarn
npm install @medusajs/pricing
@@ -161,7 +161,7 @@ npm run price:seed
## Next.js Application: Adjust Configurations
The Pricing module uses dependencies that aren’t Webpack optimized. Since Next.js uses Webpack for compilation, you need to add the Pricing module as an external dependency.
The Pricing Module uses dependencies that aren’t Webpack optimized. Since Next.js uses Webpack for compilation, you need to add the Pricing Module as an external dependency.
To do that, add the `serverComponentsExternalPackages` option in `next.config.js`:
@@ -183,6 +183,6 @@ module.exports = nextConfig
## Start Development
You can refer to the [Example Usages documentation page](./examples.mdx) for examples of using the Pricing module.
You can refer to the [Example Usages documentation page](./examples.mdx) for examples of using the Pricing Module.
You can also refer to the [Module Interface Reference](../../references/pricing/interfaces/pricing.IPricingModuleService.mdx) for a detailed reference on all available methods.
@@ -3,13 +3,13 @@ import Icons from '@theme/Icon'
# Pricing Module Overview
The Pricing module is the `@medusajs/pricing` NPM package that provides advanced pricing features in your Medusa and Node.js applications. It can be used to add prices to any resource, such as products or shipping options.
The Pricing Module is the `@medusajs/pricing` NPM package that provides advanced pricing features in your Medusa and Node.js applications. It can be used to add prices to any resource, such as products or shipping options.
## Features
### Price Management
With the Product module, you can store the prices of a resource and manage them through the main interface method. Prices are grouped in a price set, allowing you to add more than one price for a resource based on different conditions, such as currency code.
With the Pricing Module, you can store the prices of a resource and manage them through the main interface method. Prices are grouped in a price set, allowing you to add more than one price for a resource based on different conditions, such as currency code.
```ts
const priceSet = await pricingService.create({
@@ -102,7 +102,7 @@ const price = await pricingService.calculatePrices(
The Pricing Module can be used in many use cases, including:
- Medusa Backend: The Medusa backend uses the pricing module to implement some features. However, it's guarded by the [experimental feature flag](../index.md#enabling-experimental-features). If you want to use the pricing module in your backend's customizations, follow [this installation guide](./install-medusa.mdx).
- Medusa Backend: The Medusa backend uses the Pricing Module to implement some features. However, it's guarded by the [experimental feature flag](../index.md#enabling-experimental-features). If you want to use the Pricing Module in your backend's customizations, follow [this installation guide](./install-medusa.mdx).
- Serverless Application: Use the Pricing Module in a serverless application, such as a Next.js application, without having to manage a fully-fledged ecommerce system. You can use it by [installing it in your Node.js project as an NPM package](./install-nodejs.md).
- Node.js Application: Use the Pricing Module in any Node.js application. Follow [this guide](./install-nodejs.md) to learn how to install it.
@@ -116,7 +116,7 @@ The Pricing Module can be used in many use cases, including:
label: 'Pricing Concepts',
customProps: {
icon: Icons['academic-cap-solid'],
description: 'Learn about the main concepts in the Pricing module.'
description: 'Learn about the main concepts in the Pricing Module.'
}
}}
/>
@@ -3,7 +3,7 @@ import TabItem from "@theme/TabItem"
# Prices Calculation
In this document, you'll learn how prices are calculated under the hood when you use the `calculatePrices` method of the Pricing module interface.
In this document, you'll learn how prices are calculated under the hood when you use the `calculatePrices` method of the Pricing Module interface.
## Overview
@@ -3,7 +3,7 @@ import TabItem from '@theme/TabItem';
# Examples of Product Module
In this document, you’ll find common examples of how you can use the Product module in your application.
In this document, you’ll find common examples of how you can use the Product Module in your application.
## Create Product
@@ -5,11 +5,11 @@ import TabItem from '@theme/TabItem';
# Install Product Module in Medusa
In this document, you'll learn how to install the Product module using NPM in the Medusa backend.
In this document, you'll learn how to install the Product Module using NPM in the Medusa backend.
## Step 1: Install Module
To install the Product module, run the following command in the root directory of the Medusa backend:
To install the Product Module, run the following command in the root directory of the Medusa backend:
```bash npm2yarn
npm install @medusajs/product
@@ -19,7 +19,7 @@ npm install @medusajs/product
## Step 2: Add Module to Configurations
In `medusa-config.js`, add the product module to the exported object under the `modules` property:
In `medusa-config.js`, add the Product Module to the exported object under the `modules` property:
```js title=medusa-config.js
module.exports = {
@@ -148,6 +148,6 @@ For example:
## Start Development
You can refer to the [Example Usages documentation page](./examples.mdx) for examples of using the Product module.
You can refer to the [Example Usages documentation page](./examples.mdx) for examples of using the Product Module.
You can also refer to the [Module Interface Reference](../../references/product/interfaces/product.IProductModuleService.mdx) for a detailed reference on all available methods.
@@ -1,10 +1,10 @@
# Install in Node.js-Based Application
In this document, you’ll learn how to setup and use the Product module in a Node.js based application.
In this document, you’ll learn how to setup and use the Product Module in a Node.js based application.
## Prerequisites
Before installing the Product module in your application, make sure you have the following prerequisites:
Before installing the Product Module in your application, make sure you have the following prerequisites:
- Node.js v16 or greater
- PostgreSQL database. You can use an existing Medusa database, or set up a new PostgreSQL database.
@@ -13,7 +13,7 @@ Before installing the Product module in your application, make sure you have the
## Install Package
In your Node.js-based applications, such as a Next.js application, you can install the Product module with the following command:
In your Node.js-based applications, such as a Next.js application, you can install the Product Module with the following command:
```bash npm2yarn
npm install @medusajs/product
@@ -172,7 +172,7 @@ npm run product:seed
## Next.js Application: Adjust Configurations
The Product module uses dependencies that aren’t Webpack optimized. Since Next.js uses Webpack for compilation, you need to add the Product module as an external dependency.
the Product Module uses dependencies that aren’t Webpack optimized. Since Next.js uses Webpack for compilation, you need to add the Product Module as an external dependency.
To do that, add the `serverComponentsExternalPackages` option in `next.config.js`:
@@ -193,6 +193,6 @@ module.exports = nextConfig
## Start Development
You can refer to the [Example Usages documentation page](./examples.mdx) for examples of using the Product module.
You can refer to the [Example Usages documentation page](./examples.mdx) for examples of using the Product Module.
You can also refer to the [Module Interface Reference](../../references/product/interfaces/product.IProductModuleService.mdx) for a detailed reference on all available methods.
@@ -3,13 +3,13 @@ import Icons from '@theme/Icon'
# Product Module Overview
The Product module is the `@medusajs/product` NPM package that provides product-related features in your Medusa and Node.js applications. It can be used to store products with variants, organize them into categories and collections, and more.
the Product Module is the `@medusajs/product` NPM package that provides product-related features in your Medusa and Node.js applications. It can be used to store products with variants, organize them into categories and collections, and more.
## Features
### Products Management
With the Product module, you can store products and manage them through the main interface methods. Products can have custom options, such as color or size, and each variant in the product sets the value for these options.
With the Product Module, you can store products and manage them through the main interface methods. Products can have custom options, such as color or size, and each variant in the product sets the value for these options.
```ts
const products = await productService.create([
@@ -36,7 +36,7 @@ const products = await productService.create([
### Product Organizations
The Product module provides different entities that can be used to organize products, including categories, collections, tags, and more.
the Product Module provides different entities that can be used to organize products, including categories, collections, tags, and more.
```ts
const category = await productService.createCategory({
@@ -61,7 +61,7 @@ const products = await productService.update([
The Product Module can be used in many use cases, including:
- Medusa Backend: The Medusa backend uses the product module to implement some product features. However, it's guarded by the [experimental feature flag](../index.md#enabling-experimental-features). If you want to use the product module in your backend's customizations, follow [this installation guide](./install-medusa.mdx).
- Medusa Backend: The Medusa backend uses the Product Module to implement some product features. However, it's guarded by the [experimental feature flag](../index.md#enabling-experimental-features). If you want to use the Product Module in your backend's customizations, follow [this installation guide](./install-medusa.mdx).
- Serverless Application: Use the Product Module in a serverless application, such as a Next.js application, without having to manage a fully-fledged ecommerce system. You can use it by [installing it in your Node.js project as an NPM package](./install-nodejs.md).
- Node.js Application: Use the Product Module in any Node.js application. Follow [this guide](./install-nodejs.md) to learn how to install it.