Skip to content

feat: add Blazor project scaffolding options and templates#1719

Open
dkalinovInfra wants to merge 3 commits into
masterfrom
dkalinov/blazor-cli
Open

feat: add Blazor project scaffolding options and templates#1719
dkalinovInfra wants to merge 3 commits into
masterfrom
dkalinov/blazor-cli

Conversation

@dkalinovInfra
Copy link
Copy Markdown
Contributor

Description

Adds first-class Blazor project scaffolding to the CLI. The Blazor framework is now visible in both the ig new command and the Step-By-Step wizard, and projects are generated via the published IgniteUI.Blazor.Templates NuGet template package using the dotnet CLI rather than the Handlebars template pipeline.

Key changes:

  • New scaffold() strategy on ProjectTemplate — when a project template implements the optional scaffold(options: ScaffoldOptions) method, the host calls it instead of the generateConfig → processTemplates → installPackages pipeline. This lets a project delegate generation to an external tool while still participating in AI/agent configuration and git init.
  • DotnetTemplateManager (new, in @igniteui/cli-core) — a thin wrapper around the dotnet CLI that verifies the .NET SDK (8+) is present, installs the IgniteUI.Blazor.Templates package if missing, and runs dotnet new igb-blazor with the chosen hosting model, theme, and variant. All failures are reported and returned as false (no throwing).
  • New "Blazor Web App" project template (blazor/igb/projects/empty) — exposes extra configuration for the Hosting model (Server / Wasm / Auto) and theme Variant (light / dark), and forwards everything to DotnetTemplateManager.scaffold().
  • ig new options — added --hosting (Server|Wasm|Auto) and --variant (light|dark) flags for Blazor projects, name-validation warning for non-identifier project names, and Blazor-specific "Next Steps" output.
  • Wizard support (BasePromptSession) — runs extra-configuration prompts and the scaffold() path for scaffold-based templates, handles git init (since the scaffold service never touches git), and prints dotnet run next-steps / optional run prompt for projects with no cli-config.
  • Misc — Blazor igb themes changed from ["default"] to ["bootstrap", "material", "fluent", "indigo"]; Blazor framework un-hidden; Util.spawnSync now allows dotnet as a known binary; customizeTemplateTask accepts BaseTemplate.

Related Issue

Closes #

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring / code cleanup
  • Build / CI configuration change

Affected Packages

  • igniteui-cli (packages/cli)
  • @igniteui/cli-core (packages/core)
  • @igniteui/angular-templates (packages/igx-templates)
  • @igniteui/angular-schematics (packages/ng-schematics)
  • @igniteui/mcp-server (packages/igniteui-mcp)

Checklist

  • I have tested my changes locally (npm run test)
  • I have built the project successfully (npm run build)
  • I have run the linter (npm run lint)
  • I have added/updated tests as needed
  • My changes do not introduce new warnings or errors

Additional Context

New/updated test coverage:

  • spec/unit/DotnetTemplateManager-spec.ts — SDK detection, template install, and scaffold argument/error handling.
  • spec/unit/PromptSession-spec.ts — wizard scaffold path and next-steps behavior.
  • spec/unit/new-spec.tsig new Blazor options and scaffold invocation.
  • spec/templates/blazor-spec.ts, spec/unit/Util-spec.ts, spec/acceptance/help-spec.ts — template metadata, spawnSync binary allow-list, and updated help output.

Example usage:

ig new MyApp --framework blazor --type igb --hosting Server --theme bootstrap --variant dark
cd MyApp
dotnet run --project MyApp

- Introduced new options for Blazor projects: `hosting` and `variant` in the `new` command.
- Implemented `EmptyIgbProject` template for scaffolding Blazor Web Apps.
- Updated `IgbBlazorProjectLibrary` to support multiple themes: bootstrap, material, fluent, and indigo.
- Enhanced `DotnetTemplateManager` to handle Blazor project creation via `dotnet new igb-blazor`.
- Modified `BasePromptSession` to utilize the new scaffolding method for Blazor projects.
- Added unit tests for the new scaffolding functionality and ensured proper integration with existing commands.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class Blazor project scaffolding support to the Ignite UI CLI by introducing a scaffold()-based generation path (delegating project creation to dotnet new via a new DotnetTemplateManager) and wiring this through both ig new and the Step-By-Step wizard, along with new Blazor templates/options and updated tests.

Changes:

  • Introduces ProjectTemplate.scaffold(options) + ScaffoldOptions and a DotnetTemplateManager wrapper to generate Blazor projects via dotnet new igb-blazor.
  • Adds a new visible “Blazor Web App” (igb) project template and exposes Blazor in CLI help + wizard flows, including Blazor-specific options (hosting/variant) and next-steps output.
  • Expands unit/acceptance/template tests to cover the new scaffold path, Blazor metadata, help output, and dotnet allow-listing.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/unit/Util-spec.ts Adds a compile-time test ensuring dotnet is allowed by Util.spawnSync typing.
spec/unit/PromptSession-spec.ts Adds wizard tests for scaffold path + dotnet next-steps behavior.
spec/unit/new-spec.ts Adds ig new tests verifying scaffold invocation, extraConfig handling, and next-steps output.
spec/unit/DotnetTemplateManager-spec.ts Adds unit coverage for SDK detection, template install, and scaffold argument/error handling.
spec/templates/blazor-spec.ts Ensures Blazor framework visibility, theme list, and empty scaffold template registration.
spec/acceptance/help-spec.ts Updates help output expectations to include Blazor and new flags.
packages/core/util/Util.ts Allows dotnet as a permitted binary for spawnSync and updates doc comment.
packages/core/util/index.ts Re-exports DotnetTemplateManager from the util barrel.
packages/core/util/DotnetTemplateManager.ts Implements dotnet-based scaffolding (SDK check, template install, dotnet new).
packages/core/types/ProjectTemplate.ts Adds ScaffoldOptions and optional ProjectTemplate.scaffold() API.
packages/core/templates/BaseTemplateManager.ts Updates framework-name filtering comment (hidden frameworks behavior).
packages/core/prompt/BasePromptSession.ts Adds scaffold-based project generation path + Blazor “Complete & Run” handling.
packages/cli/templates/blazor/index.ts Un-hides the Blazor framework in template metadata.
packages/cli/templates/blazor/igb/projects/empty/index.ts Adds “Blazor Web App” template that scaffolds via DotnetTemplateManager.
packages/cli/templates/blazor/igb/index.ts Updates Blazor igb theme list to bootstrap/material/fluent/indigo.
packages/cli/lib/commands/types.ts Adds hosting and variant args for the new command typing.
packages/cli/lib/commands/new.ts Adds --hosting/--variant options and routes scaffold templates through scaffold() + dotnet next-steps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/core/prompt/BasePromptSession.ts Outdated
Comment thread packages/core/prompt/BasePromptSession.ts Outdated
dkalinovInfra and others added 2 commits June 3, 2026 10:55
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blazor cli-package igniteui-cli package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants