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.

feat: add simple registry

Jakub Sieradzki2837a9a59823
diff --git a/blocks.json b/blocks.json
new file mode 100644
index 000000000..7f9b1dc5c
--- /dev/null
+++ b/blocks.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "https://mercurjs.com/schema.json",
+ "aliases": {
+ "workflows": "@/src/workflows",
+ "api": "@/src/api",
+ "links": "@/src/links",
+ "modules": "@/src/modules",
+ "vendorPages": "@workspace/apps/vendor/src/pages",
+ "adminPages": "@workspace/apps/admin/src/pages",
+ "lib": "@/src/lib"
+ },
+ "registries": {}
+}
diff --git a/packages/cli/src/commands/add.ts b/packages/cli/src/commands/add.ts
index 2ad2d39a2..64fe8c658 100644
--- a/packages/cli/src/commands/add.ts
+++ b/packages/cli/src/commands/add.ts
@@ -35,7 +35,7 @@ export const add = new Command()
.action(async (items, opts) => {
try {
const options = addOptionsSchema.parse({
- items,
+ blocks: items,
cwd: path.resolve(opts.cwd),
...opts,
});
diff --git a/packages/registry/hello-workflow.json b/packages/registry/hello-workflow.json
new file mode 100644
index 000000000..a418648b7
--- /dev/null
+++ b/packages/registry/hello-workflow.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://mercurjs.com/schema/registry-item.json",
+ "name": "hello-workflow",
+ "type": "registry:workflow",
+ "title": "Hello Workflow",
+ "description": "A simple test workflow",
+ "dependencies": [],
+ "files": [
+ {
+ "path": "src/workflows/hello.ts",
+ "content": "export function helloWorkflow() {\n console.log(\"Hello from shared registry!\");\n}\n",
+ "type": "registry:workflow"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/packages/registry/registry.json b/packages/registry/registry.json
new file mode 100644
index 000000000..76d4a42a8
--- /dev/null
+++ b/packages/registry/registry.json
@@ -0,0 +1,19 @@
+{
+ "name": "@mercurjs",
+ "homepage": "https://mercurjs.com",
+ "items": [
+ {
+ "name": "hello-workflow",
+ "type": "registry:workflow",
+ "title": "Hello Workflow",
+ "description": "A simple test workflow",
+ "files": [
+ {
+ "path": "src/workflows/hello.ts",
+ "type": "registry:workflow",
+ "content": ""
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/workflows/hello.ts b/src/workflows/hello.ts
new file mode 100644
index 000000000..0d9622da2
--- /dev/null
+++ b/src/workflows/hello.ts
@@ -0,0 +1,3 @@
+export function helloWorkflow() {
+ console.log("Hello from shared registry!");
+}
diff --git a/templates/basic/blocks.json b/templates/basic/blocks.json
new file mode 100644
index 000000000..7f9b1dc5c
--- /dev/null
+++ b/templates/basic/blocks.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "https://mercurjs.com/schema.json",
+ "aliases": {
+ "workflows": "@/src/workflows",
+ "api": "@/src/api",
+ "links": "@/src/links",
+ "modules": "@/src/modules",
+ "vendorPages": "@workspace/apps/vendor/src/pages",
+ "adminPages": "@workspace/apps/admin/src/pages",
+ "lib": "@/src/lib"
+ },
+ "registries": {}
+}
diff --git a/templates/basic/tsconfig.json b/templates/basic/tsconfig.json
new file mode 100644
index 000000000..3492090b2
--- /dev/null
+++ b/templates/basic/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./*"],
+ "@workspace/*": ["./packages/*"]
+ }
+ },
+ "include": ["src/**/*", "packages/**/*", "apps/**/*"],
+ "exclude": ["node_modules"]
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 000000000..54aae9ab9
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,17 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./*"],
+ "@workspace/*": ["./packages/*"]
+ }
+ },
+ "include": ["src/**/*", "packages/**/*"],
+ "exclude": ["node_modules"]
+}