@open-mercato/cli 0.4.2-canary-eb5f87d5f9 โ†’ 0.4.2-canary-5035717565

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,9 +28,10 @@ export interface PackageResolver {
28
28
 
29
29
  function pkgDirFor(rootDir: string, from?: string, isMonorepo = true): string {
30
30
  if (!isMonorepo) {
31
- // Production mode: look in node_modules dist (compiled JS)
31
+ // Production mode: look in node_modules
32
+ // Packages include source TypeScript files in src/modules
32
33
  const pkgName = from || '@open-mercato/core'
33
- return path.join(rootDir, 'node_modules', pkgName, 'dist', 'modules')
34
+ return path.join(rootDir, 'node_modules', pkgName, 'src', 'modules')
34
35
  }
35
36
 
36
37
  // Monorepo mode
@@ -151,8 +152,8 @@ function discoverPackagesInNodeModules(rootDir: string): PackageInfo[] {
151
152
 
152
153
  try {
153
154
  const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'))
154
- // Production mode: use compiled JS files from dist/modules
155
- const modulesPath = path.join(pkgPath, 'dist', 'modules')
155
+ // Packages include source TypeScript files in src/modules
156
+ const modulesPath = path.join(pkgPath, 'src', 'modules')
156
157
 
157
158
  if (fs.existsSync(modulesPath)) {
158
159
  packages.push({
package/src/mercato.ts CHANGED
@@ -63,25 +63,6 @@ async function runModuleCommand(
63
63
  await cmd.run(args)
64
64
  }
65
65
 
66
- // Helper to run a module command, skipping silently if module is not enabled
67
- async function tryRunModuleCommand(
68
- allModules: Module[],
69
- moduleName: string,
70
- commandName: string,
71
- args: string[] = []
72
- ): Promise<boolean> {
73
- const mod = allModules.find((m) => m.id === moduleName)
74
- if (!mod || !mod.cli || mod.cli.length === 0) {
75
- return false
76
- }
77
- const cmd = mod.cli.find((c) => c.command === commandName)
78
- if (!cmd) {
79
- return false
80
- }
81
- await cmd.run(args)
82
- return true
83
- }
84
-
85
66
  // Build all CLI modules (registered + built-in)
86
67
  async function buildAllModules(): Promise<Module[]> {
87
68
  const modules = getCliModules()
@@ -319,13 +300,13 @@ export async function run(argv = process.argv) {
319
300
  await runModuleCommand(allModules, 'customers', 'seed-dictionaries', ['--tenant', tenantId, '--org', orgId])
320
301
  console.log('๐Ÿ“š โœ… Customer dictionaries seeded\n')
321
302
 
322
- if (await tryRunModuleCommand(allModules, 'staff', 'seed-address-types', ['--tenant', tenantId, '--org', orgId])) {
323
- console.log('๐Ÿ  โœ… Staff address types seeded\n')
324
- }
303
+ console.log('๐Ÿ  Seeding staff address types...')
304
+ await runModuleCommand(allModules, 'staff', 'seed-address-types', ['--tenant', tenantId, '--org', orgId])
305
+ console.log('๐Ÿ  โœ… Staff address types seeded\n')
325
306
 
326
- if (await tryRunModuleCommand(allModules, 'resources', 'seed-address-types', ['--tenant', tenantId, '--org', orgId])) {
327
- console.log('๐Ÿ  โœ… Resources address types seeded\n')
328
- }
307
+ console.log('๐Ÿ  Seeding resources address types...')
308
+ await runModuleCommand(allModules, 'resources', 'seed-address-types', ['--tenant', tenantId, '--org', orgId])
309
+ console.log('๐Ÿ  โœ… Resources address types seeded\n')
329
310
 
330
311
  console.log('๐Ÿ“š Seeding currencies...')
331
312
  await runModuleCommand(allModules, 'currencies', 'seed', ['--tenant', tenantId, '--org', orgId])
@@ -335,9 +316,9 @@ export async function run(argv = process.argv) {
335
316
  await runModuleCommand(allModules, 'catalog', 'seed-units', ['--tenant', tenantId, '--org', orgId])
336
317
  console.log('๐Ÿ“ โœ… Catalog units seeded\n')
337
318
 
338
- if (await tryRunModuleCommand(allModules, 'planner', 'seed-unavailability-reasons', ['--tenant', tenantId, '--org', orgId])) {
339
- console.log('๐Ÿ—“๏ธ โœ… Unavailability reasons seeded\n')
340
- }
319
+ console.log('๐Ÿ—“๏ธ Seeding unavailability reasons...')
320
+ await runModuleCommand(allModules, 'planner', 'seed-unavailability-reasons', ['--tenant', tenantId, '--org', orgId])
321
+ console.log('๐Ÿ—“๏ธ โœ… Unavailability reasons seeded\n')
341
322
 
342
323
  const parsedEncryption = parseBooleanToken(process.env.TENANT_DATA_ENCRYPTION ?? 'yes')
343
324
  const encryptionEnabled = parsedEncryption === null ? true : parsedEncryption
@@ -396,21 +377,21 @@ export async function run(argv = process.argv) {
396
377
  await runModuleCommand(allModules, 'sales', 'seed-examples', ['--tenant', tenantId, '--org', orgId])
397
378
  console.log('๐Ÿงพ โœ… Sales examples seeded\n')
398
379
 
399
- if (await tryRunModuleCommand(allModules, 'staff', 'seed-examples', ['--tenant', tenantId, '--org', orgId])) {
400
- console.log('๐Ÿ‘ฅ โœ… Staff examples seeded\n')
401
- }
380
+ console.log('๐Ÿ‘ฅ Seeding staff examples...')
381
+ await runModuleCommand(allModules, 'staff', 'seed-examples', ['--tenant', tenantId, '--org', orgId])
382
+ console.log('๐Ÿ‘ฅ โœ… Staff examples seeded\n')
402
383
 
403
- if (await tryRunModuleCommand(allModules, 'resources', 'seed-capacity-units', ['--tenant', tenantId, '--org', orgId])) {
404
- console.log('๐Ÿ“ฆ โœ… Resource capacity units seeded\n')
405
- }
384
+ console.log('๐Ÿ“ฆ Seeding resource capacity units...')
385
+ await runModuleCommand(allModules, 'resources', 'seed-capacity-units', ['--tenant', tenantId, '--org', orgId])
386
+ console.log('๐Ÿ“ฆ โœ… Resource capacity units seeded\n')
406
387
 
407
- if (await tryRunModuleCommand(allModules, 'resources', 'seed-examples', ['--tenant', tenantId, '--org', orgId])) {
408
- console.log('๐Ÿงฐ โœ… Resource examples seeded\n')
409
- }
388
+ console.log('๐Ÿงฐ Seeding resource examples...')
389
+ await runModuleCommand(allModules, 'resources', 'seed-examples', ['--tenant', tenantId, '--org', orgId])
390
+ console.log('๐Ÿงฐ โœ… Resource examples seeded\n')
410
391
 
411
- if (await tryRunModuleCommand(allModules, 'planner', 'seed-availability-rulesets', ['--tenant', tenantId, '--org', orgId])) {
412
- console.log('๐Ÿ—“๏ธ โœ… Planner availability rulesets seeded\n')
413
- }
392
+ console.log('๐Ÿ—“๏ธ Seeding planner availability rulesets...')
393
+ await runModuleCommand(allModules, 'planner', 'seed-availability-rulesets', ['--tenant', tenantId, '--org', orgId])
394
+ console.log('๐Ÿ—“๏ธ โœ… Planner availability rulesets seeded\n')
414
395
 
415
396
  // Optional: seed example todos if the example module is enabled
416
397
  const exampleModule = allModules.find((m) => m.id === 'example')