Skip to main content
Version: 3.x

CLI

Learn how to efficiently use Front-Commerce's CLI commands. The guide covers key commands for development, testing, translation, and project management to streamline your Front-Commerce project.

How to use​

These commands should be launched from your project's root directory. This can be done by:

pnpm run <command>

Script Reference​

dev​

Starts the development server using Node.js with tsx (ESM mode) and runs server.mjs.

dev:debug​

Starts the development server in debug mode (--inspect enabled).

build​

Builds the project using Remix and Vite with tsx for ESM compatibility.

start​

Runs the server in production mode with cross-env ensuring NODE_ENV=production.

translate​

Runs Front-Commerce’s translation tool on all JavaScript/TypeScript files in the app directory for the English locale. More info bellow.

front-commerce​

A shortcut to execute Front-Commerce CLI commands.

typecheck​

Runs TypeScript’s compiler (tsc) to check types without emitting files.

worker​

Starts a Front-Commerce worker process. More info bellow.

test​

Runs tests with vitest, using tsx for ESM support.

styleguide​

Starts Storybook on port 6006 without automatically opening the browser.

buildstyleguide​

Builds Storybook into ./build/styleguide, enabling Node.js inspector for debugging.

Front-commerce CLI​

Front-Commerce includes its own CLI. To make it even more convenient, we have added some of these commands as scripts in package.json(translate, postinstall and worker). However, the CLI offers more features.

migrate​

The migrate command helps you upgrade your project to a new version of Front-Commerce by running predefined codemods.

Usage​

pnpm run front-commerce migrate <glob/path/to/your/project> [options]

Options​

  • --help, -h → Displays the help message.
  • --dry, -d → Runs the migration without making any actual changes (dry run).
  • --verbose → Provides more detailed output about the migration process.
  • --transform, -t <codemod> → Runs a specific codemod instead of selecting one interactively.

translate​

The translate command extracts translations from your application's source files and compiles them for a specified locale.

Usage​

pnpm run front-commerce translate <path> --locale <locale>

Options​

  • --help, -h → Displays the help message.
  • --locale <locale> → Specifies the output locale for the extracted translations.

Exemple​

front-commerce translate ./app/**/*.{js,jsx,ts,tsx} --locale en

This command extracts all translatable strings from the ./app directory and compiles them for the English (en) locale.

worker​

The worker command starts a worker process that listens for and processes server events in Front-Commerce using Redis Streams. It manages integrations, processes pending events, and handles real-time event streams.

Usage​

pnpm run front-commerce worker

This command boots up the Front-Commerce server event worker, connecting to Redis, processing any pending messages, and continuously listening for new events to dispatch to the appropriate integrations.