@open-mercato/cli 0.9.1-develop.7567.1.b5e80ff620 → 0.9.1-develop.7572.1.e9bdaac5f1
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/agentic/guides/module-facts.json +152 -152
- package/dist/agentic/guides/module-facts.v2.json +152 -152
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/index.md +1 -1
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/index.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/index.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/index.md +1 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/index.md +1 -1
- package/dist/agentic/guides/modules/search/index.md +1 -1
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/mercato.js +4 -2
- package/dist/mercato.js.map +2 -2
- package/package.json +7 -7
- package/src/__tests__/mercato.test.ts +104 -0
- package/src/mercato.ts +4 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/cli",
|
|
3
|
-
"version": "0.9.1-develop.
|
|
3
|
+
"version": "0.9.1-develop.7572.1.e9bdaac5f1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"@mikro-orm/decorators": "^7.1.14",
|
|
61
61
|
"@mikro-orm/migrations": "^7.1.14",
|
|
62
62
|
"@mikro-orm/postgresql": "^7.1.14",
|
|
63
|
-
"@open-mercato/events": "0.9.1-develop.
|
|
64
|
-
"@open-mercato/queue": "0.9.1-develop.
|
|
65
|
-
"@open-mercato/shared": "0.9.1-develop.
|
|
66
|
-
"@open-mercato/telemetry": "0.9.1-develop.
|
|
63
|
+
"@open-mercato/events": "0.9.1-develop.7572.1.e9bdaac5f1",
|
|
64
|
+
"@open-mercato/queue": "0.9.1-develop.7572.1.e9bdaac5f1",
|
|
65
|
+
"@open-mercato/shared": "0.9.1-develop.7572.1.e9bdaac5f1",
|
|
66
|
+
"@open-mercato/telemetry": "0.9.1-develop.7572.1.e9bdaac5f1",
|
|
67
67
|
"cross-spawn": "^7.0.6",
|
|
68
68
|
"pg": "8.23.0",
|
|
69
69
|
"semver": "^7.8.5",
|
|
@@ -74,10 +74,10 @@
|
|
|
74
74
|
"typescript-js": "npm:typescript@6.0.3"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@open-mercato/shared": "0.9.1-develop.
|
|
77
|
+
"@open-mercato/shared": "0.9.1-develop.7572.1.e9bdaac5f1"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@open-mercato/shared": "0.9.1-develop.
|
|
80
|
+
"@open-mercato/shared": "0.9.1-develop.7572.1.e9bdaac5f1",
|
|
81
81
|
"@types/jest": "^30.0.0",
|
|
82
82
|
"jest": "^30.4.2",
|
|
83
83
|
"ts-jest": "^29.4.12"
|
|
@@ -573,6 +573,110 @@ describe('db command failure output', () => {
|
|
|
573
573
|
})
|
|
574
574
|
})
|
|
575
575
|
|
|
576
|
+
describe('module command exit signal propagation', () => {
|
|
577
|
+
let consoleErrorSpy: jest.SpyInstance
|
|
578
|
+
let consoleLogSpy: jest.SpyInstance
|
|
579
|
+
|
|
580
|
+
beforeEach(() => {
|
|
581
|
+
jest.restoreAllMocks()
|
|
582
|
+
consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation()
|
|
583
|
+
consoleLogSpy = jest.spyOn(console, 'log').mockImplementation()
|
|
584
|
+
})
|
|
585
|
+
|
|
586
|
+
afterEach(() => {
|
|
587
|
+
consoleErrorSpy.mockRestore()
|
|
588
|
+
consoleLogSpy.mockRestore()
|
|
589
|
+
process.exitCode = undefined
|
|
590
|
+
})
|
|
591
|
+
|
|
592
|
+
it('propagates a non-zero process.exitCode set by a command that does not throw', async () => {
|
|
593
|
+
registerCliModules([
|
|
594
|
+
{
|
|
595
|
+
id: 'reporting',
|
|
596
|
+
cli: [{
|
|
597
|
+
command: 'export',
|
|
598
|
+
run: jest.fn().mockImplementation(async () => {
|
|
599
|
+
process.exitCode = 1
|
|
600
|
+
}),
|
|
601
|
+
}],
|
|
602
|
+
} as any,
|
|
603
|
+
])
|
|
604
|
+
|
|
605
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
606
|
+
|
|
607
|
+
expect(exitCode).toBe(1)
|
|
608
|
+
})
|
|
609
|
+
|
|
610
|
+
it('preserves the exact exit code a command signals rather than collapsing it to 1', async () => {
|
|
611
|
+
registerCliModules([
|
|
612
|
+
{
|
|
613
|
+
id: 'reporting',
|
|
614
|
+
cli: [{
|
|
615
|
+
command: 'export',
|
|
616
|
+
run: jest.fn().mockImplementation(async () => {
|
|
617
|
+
process.exitCode = 42
|
|
618
|
+
}),
|
|
619
|
+
}],
|
|
620
|
+
} as any,
|
|
621
|
+
])
|
|
622
|
+
|
|
623
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
624
|
+
|
|
625
|
+
expect(exitCode).toBe(42)
|
|
626
|
+
})
|
|
627
|
+
|
|
628
|
+
it('returns 0 for a command that completes without signalling a failure', async () => {
|
|
629
|
+
registerCliModules([
|
|
630
|
+
{
|
|
631
|
+
id: 'reporting',
|
|
632
|
+
cli: [{ command: 'export', run: jest.fn().mockResolvedValue(undefined) }],
|
|
633
|
+
} as any,
|
|
634
|
+
])
|
|
635
|
+
|
|
636
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
637
|
+
|
|
638
|
+
expect(exitCode).toBe(0)
|
|
639
|
+
})
|
|
640
|
+
|
|
641
|
+
it('ignores a non-zero process.exitCode inherited from before the command ran', async () => {
|
|
642
|
+
process.exitCode = 7
|
|
643
|
+
|
|
644
|
+
registerCliModules([
|
|
645
|
+
{
|
|
646
|
+
id: 'reporting',
|
|
647
|
+
cli: [{ command: 'export', run: jest.fn().mockResolvedValue(undefined) }],
|
|
648
|
+
} as any,
|
|
649
|
+
])
|
|
650
|
+
|
|
651
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
652
|
+
|
|
653
|
+
expect(exitCode).toBe(0)
|
|
654
|
+
expect(process.exitCode).toBe(7)
|
|
655
|
+
})
|
|
656
|
+
|
|
657
|
+
it('still reports 1 when a command throws, regardless of process.exitCode', async () => {
|
|
658
|
+
process.exitCode = 7
|
|
659
|
+
|
|
660
|
+
registerCliModules([
|
|
661
|
+
{
|
|
662
|
+
id: 'reporting',
|
|
663
|
+
cli: [{
|
|
664
|
+
command: 'export',
|
|
665
|
+
run: jest.fn().mockImplementation(async () => {
|
|
666
|
+
process.exitCode = 3
|
|
667
|
+
throw new Error('export failed')
|
|
668
|
+
}),
|
|
669
|
+
}],
|
|
670
|
+
} as any,
|
|
671
|
+
])
|
|
672
|
+
|
|
673
|
+
const exitCode = await run(['node', 'mercato', 'reporting', 'export'])
|
|
674
|
+
|
|
675
|
+
expect(exitCode).toBe(1)
|
|
676
|
+
expect(process.exitCode).toBe(7)
|
|
677
|
+
})
|
|
678
|
+
})
|
|
679
|
+
|
|
576
680
|
describe('init command failure output', () => {
|
|
577
681
|
const originalDatabaseUrl = process.env.DATABASE_URL
|
|
578
682
|
|
package/src/mercato.ts
CHANGED
|
@@ -2790,12 +2790,14 @@ export async function run(argv = process.argv) {
|
|
|
2790
2790
|
: rest
|
|
2791
2791
|
console.log(`🚀 Running ${modName}:${cmdName} ${loggedArgs.join(' ')}`)
|
|
2792
2792
|
try {
|
|
2793
|
-
await
|
|
2793
|
+
const commandExitCode = await runWithCapturedExitCode(async () => {
|
|
2794
|
+
await cmd.run(rest)
|
|
2795
|
+
})
|
|
2794
2796
|
if (modName !== 'deploy' || cmdName !== 'railway') {
|
|
2795
2797
|
const ms = Date.now() - started
|
|
2796
2798
|
console.log(`⏱️ Done in ${ms}ms`)
|
|
2797
2799
|
}
|
|
2798
|
-
return
|
|
2800
|
+
return commandExitCode
|
|
2799
2801
|
} catch (e: any) {
|
|
2800
2802
|
console.error(`💥 Failed: ${formatCliFailureMessage(modName, cmdName, e)}`)
|
|
2801
2803
|
return 1
|