Skip to content

Commit

Permalink
Merge branch 'develop' into feat/seed_product_collections
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlamaa committed Nov 9, 2023
2 parents 1251ce0 + 4f91263 commit fcc1c9b
Show file tree
Hide file tree
Showing 758 changed files with 12,548 additions and 1,897 deletions.
13 changes: 13 additions & 0 deletions .changeset/dull-grapes-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@medusajs/client-types": patch
"medusa-react": patch
"@medusajs/medusa-js": patch
"@medusajs/medusa": patch
"@medusajs/types": patch
---

fix(@medusajs/client-types): Fix types and TSDocs
fix(medusa-react): Fix response type of Publishable API Key's list sales channels.
fix(@medusajs/medusa-js): Fix incorrect parameter and response types.
fix(@medusajs/medusa): Fix incorrect types and add TSDocs
fix(@medusajs/types): Fix incorrect types and add TSDocs
10 changes: 10 additions & 0 deletions .changeset/honest-panthers-lay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@medusajs/inventory": patch
"@medusajs/modules-sdk": patch
"@medusajs/orchestration": patch
"@medusajs/product": patch
"@medusajs/utils": patch
"@medusajs/workflows": patch
---

chore: Add missing version bumps
2 changes: 1 addition & 1 deletion .changeset/tough-cups-breathe.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
"@medusajs/cache-redis": major
"@medusajs/cache-redis": minor
"@medusajs/cache-inmemory": patch
---

Expand Down
6 changes: 6 additions & 0 deletions .changeset/witty-tools-matter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@medusajs/admin-ui": patch
"@medusajs/admin": patch
---

fix(admin-ui): Admin UI: Invalid Request Header
4 changes: 4 additions & 0 deletions .github/workflows/generate-references.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ jobs:
- name: Build Packages
run: yarn build

- name: Install Docs dependencies
working-directory: www
run: yarn install

- name: Install Workspace dependencies
run: yarn install
working-directory: docs-util
Expand Down
2 changes: 1 addition & 1 deletion docs-util/packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"typedoc": "0.25.1",
"typedoc-config": "*",
"typedoc-monorepo-link-types": "^0.0.2",
"typedoc-plugin-custom": "*",
"typedoc-plugin-frontmatter": "*",
"typedoc-plugin-markdown": "3.16.0",
"typedoc-plugin-markdown-medusa": "*",
"typedoc-plugin-merge-modules": "5.1.0",
"typedoc-plugin-missing-exports": "^2.1.0",
"typedoc-plugin-modules": "*",
"typedoc-plugin-reference-excluder": "1.1.3",
"typedoc-plugin-rename-defaults": "^0.6.6",
"typescript": "^5.2.2"
Expand Down
14 changes: 14 additions & 0 deletions docs-util/packages/typedoc-config/_base.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require("path")

const pathPrefix = path.join(__dirname, "..", "..", "..")

/** @type {import('typedoc').TypeDocOptions} */
module.exports = {
// extends: [typedocConfig],
plugin: ["typedoc-plugin-markdown-medusa"],
readme: "none",
eslintPathName: path.join(
pathPrefix,
"www/packages/eslint-config-docs/content.js"
),
pluginsResolvePath: path.join(pathPrefix, "www"),
// Uncomment this when debugging
// showConfig: true,
}
9 changes: 4 additions & 5 deletions docs-util/packages/typedoc-config/_modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,9 @@ module.exports = ({
...globalTypedocOptions,
entryPoints: [path.join(pathPrefix, entryPointPath)],
out: [path.join(pathPrefix, outPath)],
tsconfig: path.join(
pathPrefix,
tsconfigPath || "packages/types/tsconfig.json"
),
tsconfig: tsconfigPath.length
? path.join(pathPrefix, tsconfigPath)
: path.join(__dirname, "extended-tsconfig", "types.json"),
name: `${moduleName} Reference`,
indexTitle: `${moduleName} Reference`,
entryDocument: "index.md",
Expand All @@ -82,7 +81,7 @@ module.exports = ({
hideBreadcrumbs: true,
plugin: [
...globalTypedocOptions.plugin,
"typedoc-plugin-modules",
"typedoc-plugin-custom",
"typedoc-plugin-rename-defaults",
"typedoc-plugin-frontmatter",
],
Expand Down
2 changes: 1 addition & 1 deletion docs-util/packages/typedoc-config/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
...globalTypedocOptions,
entryPoints: [path.join(pathPrefix, "packages/medusa/src/models/index.ts")],
out: [path.join(pathPrefix, "www/apps/docs/content/references/entities")],
tsconfig: path.join(pathPrefix, "packages/medusa/tsconfig.json"),
tsconfig: path.join(__dirname, "extended-tsconfig", "medusa.json"),
name: "Entities Reference",
indexTitle: "Entities Reference",
entryDocument: "_index.mdx",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": [
"../../../../packages/medusa-js/tsconfig.json"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": [
"../../../../packages/medusa/tsconfig.json"
]
}
22 changes: 22 additions & 0 deletions docs-util/packages/typedoc-config/extended-tsconfig/tsdoc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"extends": ["typedoc/tsdoc.json"],
"tagDefinitions": [
{
"tagName": "@featureFlag",
"syntaxKind": "block"
},
{
"tagName": "@expandable",
"syntaxKind": "modifier"
},
{
"tagName": "@schema",
"syntaxKind": "block"
},
{
"tagName": "@apiIgnore",
"syntaxKind": "modifier"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": [
"../../../../packages/types/tsconfig.json"
]
}
54 changes: 34 additions & 20 deletions docs-util/packages/typedoc-config/js-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,62 @@ const globalTypedocOptions = require("./_base")

const pathPrefix = path.join(__dirname, "..", "..", "..")

const defaultFormattingOptions = {
showCommentsAsHeader: true,
sections: {
member_sources_definedIn: false,
reflection_hierarchy: false,
member_signature_typeParameters: false,
member_signature_sources: false,
member_signature_title: false,
member_signature_returns: false,
},
parameterStyle: "component",
parameterComponent: "ParameterTypes",
mdxImports: [
`import ParameterTypes from "@site/src/components/ParameterTypes"`,
],
reflectionGroups: {
Constructors: false,
},
frontmatterData: {
displayed_sidebar: "jsClientSidebar",
},
}

/** @type {import('typedoc').TypeDocOptions} */
module.exports = {
...globalTypedocOptions,
entryPoints: [path.join(pathPrefix, "packages/medusa-js/src/resources")],
entryPointStrategy: "expand",
out: [path.join(pathPrefix, "www/apps/docs/content/references/js-client")],
tsconfig: path.join(pathPrefix, "packages/medusa-js/tsconfig.json"),
tsconfig: path.join(__dirname, "extended-tsconfig", "js-client.json"),
name: "JS Client Reference",
indexTitle: "JS Client Reference",
entryDocument: "_index.mdx",
hideInPageTOC: true,
hideBreadcrumbs: true,
plugin: [
...globalTypedocOptions.plugin,
"typedoc-plugin-reference-excluder",
"typedoc-plugin-frontmatter",
"typedoc-plugin-rename-defaults",
"typedoc-plugin-modules",
"typedoc-plugin-custom",
],
exclude: [
path.join(pathPrefix, "packages/medusa-js/src/resources/base.ts"),
path.join(pathPrefix, "node_modules/**"),
path.join(pathPrefix, "packages/**/node_modules"),
],
excludeConstructors: true,
frontmatterData: {
displayed_sidebar: "jsClientSidebar",
},
internalModule: "internal",
formatting: {
"*": {
showCommentsAsHeader: true,
sections: {
member_sources_definedIn: false,
reflection_hierarchy: false,
"*": defaultFormattingOptions,
"^classes/": {
...defaultFormattingOptions,
frontmatterData: {
...defaultFormattingOptions.frontmatterData,
slug: "/references/js-client/{{alias}}",
},
parameterStyle: "component",
parameterComponent: "ParameterTypes",
mdxImports: [
`import ParameterTypes from "@site/src/components/ParameterTypes"`,
],
},
},
objectLiteralTypeDeclarationStyle: "component",
mdxOutput: true,
maxLevel: 4,
ignoreApi: true,
}
3 changes: 3 additions & 0 deletions docs-util/packages/typedoc-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"publishConfig": {
"access": "public"
},
"peerDependencies": {
"typedoc": "0.25.x"
},
"main": "_base.js",
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion docs-util/packages/typedoc-config/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
...globalTypedocOptions,
entryPoints: [path.join(pathPrefix, "packages/medusa/src/services/index.ts")],
out: [path.join(pathPrefix, "www/apps/docs/content/references/services")],
tsconfig: path.join(pathPrefix, "packages/medusa/tsconfig.json"),
tsconfig: path.join(__dirname, "extended-tsconfig", "medusa.json"),
name: "Services Reference",
indexTitle: "Services Reference",
entryDocument: "index.md",
Expand Down
44 changes: 44 additions & 0 deletions docs-util/packages/typedoc-plugin-custom/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# typedoc-plugin-custom

A Typedoc plugin that combines utility plugins for documenting references.

## Configurations

### Resolve Reference Configurations

The [`resolve-reference-plugin`](./src/resolve-references-plugin.ts) imitates the [`typedoc-plugin-missing-exports`](https://www.npmjs.com/package/typedoc-plugin-missing-exports) plugin. So, it accepts the same options as the [`typedoc-plugin-missing-exports`](https://www.npmjs.com/package/typedoc-plugin-missing-exports) plugin.

### Frontmatter

`frontmatterData` is an object of key-value pairs. If none provided, no frontmatter variables will be added to the Markdown files.

An example of passing it in a JavaScript configuration file:

```js
frontmatterData: {
displayed_sidebar: "jsClientSidebar",
},
```

### API Ignore

The `ignoreApi` option is a boolean that indicates whether reflections with the `@apiIgnore` tag should be ignored. If enabled, reflections having this tag are removed from the generated documentation. If disabled (which is the default), the `@apiIgnore` tag is removed from the reflection to ensure it's not shown in the generated documentation.

### ESLint

If the `eslintPathName` option is set, code snippets provided in `@example` tag are linted based on the documentation's ESLint rules.

The following options are useful for linting:

- `eslintPathName`: The path to the ESLint configuration file.
- `pluginsResolvePath`: The path to resolve plugins used in the ESLint configuration files.

---

## Build the Plugin

Before using any command that makes use of this plugin, make sure to run the `build` command:

```bash
yarn build
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "typedoc-plugin-modules",
"name": "typedoc-plugin-custom",
"private": true,
"version": "0.0.0",
"license": "MIT",
Expand Down Expand Up @@ -32,7 +32,10 @@
"typedoc"
],
"dependencies": {
"eslint": "^8.53.0",
"glob": "^10.3.10",
"typedoc-plugin-markdown": "^3.16.0"
"typedoc-plugin-markdown": "^3.16.0",
"utils": "*",
"yaml": "^2.3.3"
}
}
30 changes: 30 additions & 0 deletions docs-util/packages/typedoc-plugin-custom/src/api-ignore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
Application,
Context,
Converter,
ParameterType,
ReflectionKind,
} from "typedoc"

export function load(app: Application) {
app.options.addDeclaration({
name: "ignoreApi",
help: "Whether to ignore items with the `@apiIgnore` tag.",
type: ParameterType.Boolean, // The default
defaultValue: false,
})

app.converter.on(Converter.EVENT_RESOLVE_BEGIN, (context: Context) => {
for (const reflection of context.project.getReflectionsByKind(
ReflectionKind.All
)) {
if (reflection.comment?.hasModifier("@apiIgnore")) {
if (app.options.getValue("ignoreApi")) {
context.project.removeReflection(reflection)
} else {
reflection.comment.removeModifier(`@apiIgnore`)
}
}
}
})
}
Loading

0 comments on commit fcc1c9b

Please sign in to comment.