@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.
- package/dist/lib/db/commands.js +17 -8
- package/dist/lib/db/commands.js.map +2 -2
- package/dist/lib/generators/entity-ids.js +2 -3
- package/dist/lib/generators/entity-ids.js.map +2 -2
- package/dist/lib/generators/module-di.js +4 -6
- package/dist/lib/generators/module-di.js.map +2 -2
- package/dist/lib/generators/module-entities.js +3 -4
- package/dist/lib/generators/module-entities.js.map +2 -2
- package/dist/lib/generators/module-registry.js +92 -118
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/resolver.js +2 -2
- package/dist/lib/resolver.js.map +2 -2
- package/dist/mercato.js +21 -33
- package/dist/mercato.js.map +2 -2
- package/package.json +2 -2
- package/src/lib/db/commands.ts +19 -12
- package/src/lib/generators/entity-ids.ts +2 -4
- package/src/lib/generators/module-di.ts +4 -7
- package/src/lib/generators/module-entities.ts +3 -4
- package/src/lib/generators/module-registry.ts +99 -135
- package/src/lib/resolver.ts +5 -4
- package/src/mercato.ts +21 -40
package/src/lib/resolver.ts
CHANGED
|
@@ -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
|
|
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, '
|
|
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
|
-
//
|
|
155
|
-
const modulesPath = path.join(pkgPath, '
|
|
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
|
-
|
|
323
|
-
|
|
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
|
-
|
|
327
|
-
|
|
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
|
-
|
|
339
|
-
|
|
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
|
-
|
|
400
|
-
|
|
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
|
-
|
|
404
|
-
|
|
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
|
-
|
|
408
|
-
|
|
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
|
-
|
|
412
|
-
|
|
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')
|