Skip to content

Commit 0a71f10

Browse files
committed
fix: update package argument description and improve error handling for workspace root in dev command
1 parent 2dc1da0 commit 0a71f10

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

  • packages/cli/src/commands

packages/cli/src/commands/dev.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import path from 'path';
77

88
export const devCommand = new Command('dev')
99
.description('Start development mode for a package')
10-
.argument('[package]', 'Package name (without @objectstack/ prefix)', 'all')
10+
.argument('[package]', 'Package name or filter pattern', 'all')
1111
.option('-w, --watch', 'Enable watch mode (default)', true)
1212
.option('-v, --verbose', 'Verbose output')
1313
.action(async (packageName, options) => {
@@ -38,9 +38,21 @@ export const devCommand = new Command('dev')
3838
// Monorepo Orchestration Mode
3939
try {
4040
const cwd = process.cwd();
41-
const filter = packageName === 'all' ? '' : `--filter @objectstack/${packageName}`;
4241

43-
console.log(`📦 Package: ${chalk.blue(packageName === 'all' ? 'All packages' : `@objectstack/${packageName}`)}`);
42+
// Only attempt monorepo orchestration if we are in a workspace root
43+
const workspaceConfigPath = path.resolve(cwd, 'pnpm-workspace.yaml');
44+
const isWorkspaceRoot = fs.existsSync(workspaceConfigPath);
45+
46+
if (packageName === 'all' && !isWorkspaceRoot) {
47+
console.error(chalk.red(`\n❌ Configuration file (objectstack.config.ts) not found in ${cwd}`));
48+
console.error(chalk.yellow(` To start development mode, run this command in a directory with objectstack.config.ts`));
49+
console.error(chalk.yellow(` OR run from the monorepo root to start all packages.`));
50+
process.exit(1);
51+
}
52+
53+
const filter = packageName === 'all' ? '' : `--filter ${packageName}`;
54+
55+
console.log(`📦 Package: ${chalk.blue(packageName === 'all' ? 'All packages' : packageName)}`);
4456
console.log(`🔄 Watch mode: ${chalk.green('enabled')}`);
4557
console.log('');
4658

0 commit comments

Comments
 (0)