Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

1.0 KB
Raw Blame
import type { Command } from 'commander'
import { rakeCommand } from '../backend.js'
import { detectProject } from '../context.js'
import { warnDeprecated } from '../deprecation.js'
import { dockerComposeExecOrRun } from '../docker.js'

// Deprecated: Spree tasks belong to `spree task`, everything else to `spree exec`.
export function registerRakeCommand(program: Command): void {
  program
    .command('rake', { hidden: true })
    .description('Deprecated: use `spree task …` or `spree exec bin/rake …`')
    .argument('<args...>', 'task name and arguments')
    .allowUnknownOption(true)
    .passThroughOptions(true)
    .action(async (args: string[]) => {
      const [task, ...rest] = args
      warnDeprecated(
        'spree rake',
        task.startsWith('spree:')
          ? `spree task ${[task.slice('spree:'.length), ...rest].join(' ')}`
          : `spree exec bin/rake ${args.join(' ')}`,
      )
      const ctx = detectProject()
      await dockerComposeExecOrRun(rakeCommand(args), ctx.projectDir)
    })
}