Skip to content

Fix dependency injection and TypeScript comparison in templates#51

Merged
Josephat-S merged 2 commits into
mainfrom
dev
May 25, 2026
Merged

Fix dependency injection and TypeScript comparison in templates#51
Josephat-S merged 2 commits into
mainfrom
dev

Conversation

@Josephat-S
Copy link
Copy Markdown
Contributor

This pull request introduces several improvements across the codebase, mainly focusing on enhancing CI workflow flexibility, improving dependency management during project generation, and ensuring consistent type handling for template sidebar logic.

CI/CD and Automation Improvements:

  • The GitHub Actions CI workflow in .github/workflows/ci.yml is now triggered on both main and dev branches, and switches from npm install to the more reliable npm ci for dependency installation. This ensures faster and more consistent builds.

  • In src/generate.js, a new step has been added to resolve dynamic dependencies based on user choices before installing them, making project scaffolding more robust and customizable.

Template Consistency and Type Handling:

  • Updated the logic for determining sidebar inclusion in multiple template layout files (templates/blog/nextjs-monolith/app/layout.tsx, templates/ecommerce/nextjs-monolith/app/layout.tsx, templates/saas/nextjs-monolith/app/layout.tsx, templates/school/nextjs-monolith/app/layout.tsx, and templates/saas/vite-react/src/components/Layout.tsx) to explicitly cast the template variable to string before comparison. This improves type safety and prevents potential runtime errors. [1] [2] [3] [4] [5]

generate.js
 — Re-added the resolveDependencies(projectPath, config) call between the Handlebars compilation step and npm install. Now the dependency injection actually runs.

All layout templates (ecommerce, blog, saas, school, vite-react) — Changed '{{includeSidebar}}' === 'true' to ('{{includeSidebar}}' as string) === 'true'. When includeSidebar compiles to 'false', TypeScript's strict mode was flagging the comparison as impossible. The as string cast tells TypeScript the value is dynamic.
Fix dependency injection and TypeScript comparison in templates
@Josephat-S Josephat-S requested a review from a team May 25, 2026 14:50
@Josephat-S Josephat-S merged commit c052783 into main May 25, 2026
1 check passed
Josephat-S added a commit that referenced this pull request May 25, 2026
Merge pull request #51 from Ebyte-Lab/dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant