Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

docs: add configuration and usage instructions for the test module in registry.json

vholik04d62bccae73
diff --git a/packages/registry/r/block-1.json b/packages/registry/r/block-1.json
index 96331fabf..3c01e065b 100644
--- a/packages/registry/r/block-1.json
+++ b/packages/registry/r/block-1.json
@@ -4,13 +4,14 @@
"description": "A block with a test module, product-test link, and API route.",
"dependencies": [],
"registryDependencies": [],
+ "docs": "## Configuration\n\nAdd the test module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/test',\n options: {\n apiKey: process.env.TEST_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nTEST_API_KEY=your-api-key\n```\n\n## Usage\n\nThe test module provides a service that can be injected into your API routes:\n\n```ts\nimport { MedusaRequest, MedusaResponse } from '@medusajs/framework';\nimport TestModuleService from '../../../modules/test/service';\n\nexport async function GET(req: MedusaRequest, res: MedusaResponse) {\n const testService = req.scope.resolve<TestModuleService>('testModuleService');\n const result = await testService.doSomething();\n res.json(result);\n}\n```\n\n## Links\n\nThis block includes a `product-test` link that connects products to test entities.",
"categories": [
"test"
],
"files": [
{
"path": "block-1/modules/test/index.ts",
- "content": "import { Module } from \"@medusajs/framework/utils\"\nimport TestModuleService from \"./service\"\n\nexport const TEST_MODULE = \"test\"\n\nexport default Module(TEST_MODULE, {\n service: TestModuleService,\n})\n",
+ "content": "import { Module } from \"@medusajs/framework/utils\"\nimport TestModuleService from \"./service\"\n\nexport const TEST_MODULE = \"test\"\n\nexport default Module(TEST_MODULE, {\n service: TestModuleService,\n})\n\n\n",
"type": "registry:module"
},
{
diff --git a/packages/registry/r/registry.json b/packages/registry/r/registry.json
index 2c167fdf6..8b8f054ee 100644
--- a/packages/registry/r/registry.json
+++ b/packages/registry/r/registry.json
@@ -8,6 +8,7 @@
"description": "A block with a test module, product-test link, and API route.",
"dependencies": [],
"registryDependencies": [],
+ "docs": "## Configuration\n\nAdd the test module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/test',\n options: {\n apiKey: process.env.TEST_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nTEST_API_KEY=your-api-key\n```\n\n## Usage\n\nThe test module provides a service that can be injected into your API routes:\n\n```ts\nimport { MedusaRequest, MedusaResponse } from '@medusajs/framework';\nimport TestModuleService from '../../../modules/test/service';\n\nexport async function GET(req: MedusaRequest, res: MedusaResponse) {\n const testService = req.scope.resolve<TestModuleService>('testModuleService');\n const result = await testService.doSomething();\n res.json(result);\n}\n```\n\n## Links\n\nThis block includes a `product-test` link that connects products to test entities.",
"files": [
{
"path": "block-1/modules/test/index.ts",
diff --git a/packages/registry/registry.json b/packages/registry/registry.json
index 2c167fdf6..8b8f054ee 100644
--- a/packages/registry/registry.json
+++ b/packages/registry/registry.json
@@ -8,6 +8,7 @@
"description": "A block with a test module, product-test link, and API route.",
"dependencies": [],
"registryDependencies": [],
+ "docs": "## Configuration\n\nAdd the test module to your `medusa-config.ts`:\n\n```ts\nmodules: [\n {\n resolve: './modules/test',\n options: {\n apiKey: process.env.TEST_API_KEY,\n },\n },\n]\n```\n\n## Environment Variables\n\nAdd the following to your `.env` file:\n\n```\nTEST_API_KEY=your-api-key\n```\n\n## Usage\n\nThe test module provides a service that can be injected into your API routes:\n\n```ts\nimport { MedusaRequest, MedusaResponse } from '@medusajs/framework';\nimport TestModuleService from '../../../modules/test/service';\n\nexport async function GET(req: MedusaRequest, res: MedusaResponse) {\n const testService = req.scope.resolve<TestModuleService>('testModuleService');\n const result = await testService.doSomething();\n res.json(result);\n}\n```\n\n## Links\n\nThis block includes a `product-test` link that connects products to test entities.",
"files": [
{
"path": "block-1/modules/test/index.ts",
diff --git a/packages/registry/src/block-1/modules/test/index.ts b/packages/registry/src/block-1/modules/test/index.ts
index 0e5285336..1ca696756 100644
--- a/packages/registry/src/block-1/modules/test/index.ts
+++ b/packages/registry/src/block-1/modules/test/index.ts
@@ -6,3 +6,5 @@ export const TEST_MODULE = "test"
export default Module(TEST_MODULE, {
service: TestModuleService,
})
+
+