dhis2_configure_build_system
Configure build system settings for DHIS2 applications, including entry points, PWA features, proxy setup, and custom authorities.
Instructions
Set up build system configuration for DHIS2 app (d2.config.js, webpack, etc.)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appName | Yes | Name of the application | |
| entryPoints | No | ||
| customAuthorities | No | Custom authorities required by the app | |
| pwa | No | ||
| publicPath | No | Public path for assets (for CDN deployment) | |
| proxy | No |
Implementation Reference
- src/webapp-generators.ts:197-245 (handler)The core handler function that executes the tool logic, generating comprehensive DHIS2 build system configuration including d2.config.js, build commands, proxy setup, PWA configuration, and environment variables.export function generateBuildSystemConfig(args: any): string { const { appName, entryPoints, customAuthorities, pwa, publicPath, proxy } = args; const d2Config = { type: 'app', name: appName, title: appName.split('-').map((word: string) => word.charAt(0).toUpperCase() + word.slice(1)).join(' '), ...(entryPoints && { entryPoints }), ...(customAuthorities && { authorities: customAuthorities }), ...(pwa && { pwa }), ...(publicPath && { publicPath }) }; return `# DHIS2 Build System Configuration ## d2.config.js \`\`\`javascript const config = ${JSON.stringify(d2Config, null, 2)}; module.exports = config; \`\`\` ## Build Commands \`\`\`bash # Development server yarn start # Production build yarn build # Deploy to DHIS2 instance yarn deploy # Build and analyze bundle yarn build --analyze \`\`\` ${proxy ? generateProxyConfig(proxy) : ''} ${pwa ? generatePWABuildConfig() : ''} ## Environment Configuration \`\`\`bash # .env.local REACT_APP_DHIS2_BASE_URL=https://your-dhis2-instance.com REACT_APP_DHIS2_API_VERSION=40 \`\`\` `; }
- src/index.ts:985-995 (handler)The main server request handler dispatch case that processes calls to the 'dhis2_configure_build_system' tool and invokes the generateBuildSystemConfig function with user arguments.case 'dhis2_configure_build_system': const buildSystemArgs = args as any; const buildConfig = generateBuildSystemConfig(buildSystemArgs); return { content: [ { type: 'text', text: buildConfig, }, ], };
- src/permission-system.ts:135-135 (registration)Permission registration mapping the tool to the 'canConfigureApps' user permission in the TOOL_PERMISSIONS Map.['dhis2_configure_build_system', 'canConfigureApps'],