Open MercatoDocsSearch docsAPI reference

CLI

mercato eject

Take ownership of a core module's source when your application needs to maintain its own version. Ejecting changes where future edits and updates must be reconciled.

yarn mercato eject copies a module's source code from its installed package (node_modules) into your app's src/modules/ directory and switches its origin in modules.ts to from: '@app'. After ejecting, the module behaves as a local module that you can freely modify.

The command is bootstrap-free – it reads files and copies them without requiring DI or ORM initialization. It is especially useful in standalone apps where you want to customize core behavior beyond simple overrides.

Usage

# List all ejectable modules
yarn mercato eject --list

# Eject a specific module
yarn mercato eject <moduleId>

Aliases: -l for --list.

yarn mercato module eject <moduleId> is an alias for this command, provided for consistency with the module command namespace. Both are identical in behavior.

Options

OptionDescription
--list, -lList all modules that can be ejected. Modules already marked from: '@app' are excluded.
<moduleId>The module identifier to eject (e.g., currencies, catalog, customers).

Ejectable Modules

Only modules with ejectable: true in their metadata can be ejected. The following core modules currently support ejection:

ModuleDescription
catalogProducts, categories, variants, pricing
currenciesMulti-currency support, exchange rates
customersPeople, companies, deals, activities
perspectivesSidebar perspectives and view management
plannerPlanning and scheduling tools
resourcesResources and resource types
salesOrders, quotes, invoices, shipments, payments
staffStaff management
workflowsWorkflow automation engine

What the Command Does

  1. Validates that the module exists in src/modules.ts and is not already local (from: '@app').
  2. Confirms the module is marked ejectable: true in its package metadata.
  3. Copies the entire module directory from the package into src/modules/<moduleId>/, skipping __tests__, __mocks__, and node_modules directories.
  4. Updates modules.ts to change the module's from value to '@app', so the framework loads it from your local source instead of the package.

Post-Eject Steps

After ejecting, run the generators and start development:

# 1. Regenerate module registry, entities, DI
yarn mercato generate all

# 2. Customize the module source
#    Edit files in src/modules/<moduleId>/

# 3. Start the dev server
yarn dev

Examples

List modules available for ejection:

yarn mercato eject --list

Output:

Ejectable modules:

  currencies (from: @open-mercato/core) — Multi-currency management
  catalog (from: @open-mercato/core)
  customers (from: @open-mercato/core)
  ...

Usage: yarn mercato eject <moduleId>

Eject the currencies module:

yarn mercato eject currencies

Output:

Ejecting module "currencies"...

✅ Module "currencies" ejected successfully!

Next steps:
  1. Run generators:  yarn mercato generate all
  2. Customize:       edit src/modules/currencies/
  3. Start dev:       yarn dev

Troubleshooting

Previous: yarn dev:ephemeral · Next: mercato entities decrypt-database