From 1df6b3f410b8352199ba8dfcb4bef1258cef4c34 Mon Sep 17 00:00:00 2001 From: Chinmay Sonawane Date: Mon, 13 Jul 2026 16:05:41 +0530 Subject: [PATCH] new logistics option in ext init --- src/__tests__/setup_extension.spec.ts | 10 ++++++++++ src/helper/constants.ts | 9 +++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/__tests__/setup_extension.spec.ts b/src/__tests__/setup_extension.spec.ts index 1c4b1ae3..e062070b 100644 --- a/src/__tests__/setup_extension.spec.ts +++ b/src/__tests__/setup_extension.spec.ts @@ -282,6 +282,16 @@ describe('Extension Commands', () => { expect(fs.existsSync('payment-ext')).toBe(true); }); + it('should expose logistics launch type with react template only', () => { + expect(Object.values(CONSTANTS.LAUNCH_TYPES)).toContain('Logistics'); + expect(CONSTANTS.getTemplateChoices('Logistics')).toEqual([ + 'Node + React.js + SQLite', + ]); + expect(CONSTANTS.getTemplateChoices('logistics')).toEqual([ + 'Node + React.js + SQLite', + ]); + }); + it('should select an existing extension', async () => { const inquirerMock = mockFunction(inquirer.prompt); inquirerMock diff --git a/src/helper/constants.ts b/src/helper/constants.ts index 631d7c2c..1bd0a8b4 100644 --- a/src/helper/constants.ts +++ b/src/helper/constants.ts @@ -59,7 +59,7 @@ export const TEMPLATES = { 'node-react': { name: 'Node + React.js + SQLite', repo: 'https://github.com/gofynd/example-extension-javascript-react', - launchTypes: ['Company', 'Application'] + launchTypes: ['Company', 'Application', 'Logistics'] }, 'payment-node-react': { name: 'Node + React.js + SQLite(Payment)', @@ -76,7 +76,8 @@ export const INIT_ACTIONS = { export const LAUNCH_TYPES = { COMPANY: 'Company', APPLICATION: 'Application', - PAYMENT: 'Payment' + PAYMENT: 'Payment', + LOGISTICS: 'Logistics' }; export function getRepoUrlForTemplate(templateName: string) { @@ -98,6 +99,10 @@ export function getTemplateChoices(launchType: string) { return Object.entries(TEMPLATES) .filter(([_, template]) => template.launchTypes.some(t => t.toLowerCase() === type)) .map(([_, template]) => template.name); + } else if (type === LAUNCH_TYPES.LOGISTICS.toLowerCase()) { + return Object.entries(TEMPLATES) + .filter(([_, template]) => template.launchTypes.some(t => t.toLowerCase() === type)) + .map(([_, template]) => template.name); } // Default to COMPANY if not matched return Object.entries(TEMPLATES)