Skip to content

feat: regenerate Angular base project and update dependencies - #1854

Open
Marina-L-Stoyanova wants to merge 15 commits into
masterfrom
mstoyanova/angular-base-project-generation
Open

Marina-L-Stoyanova wants to merge 15 commits into
masterfrom
mstoyanova/angular-base-project-generation

Conversation

@Marina-L-Stoyanova

Copy link
Copy Markdown
Contributor

Description

The Angular base project (packages/igx-templates/igx-ts/projects/_base) was written by hand. Every Angular release meant comparing it with a fresh ng new and copying the changes over manually.

This PR adds scripts/generate-angular-base.mjs. It builds the base project with Angular's own tools:

  1. ng new
  2. ng add angular-eslint
  3. ng add igniteui-angular

It then copies Angular's config files into the template and applies our changes on top: placeholders, budgets, npm scripts, test setup and extra packages.

How to use it

Goal Command
New Angular minor node scripts/generate-angular-base.mjs --angular ~22.3.0
New Angular major node scripts/generate-angular-base.mjs --angular ~23.0.0 --igniteui ~23.0.0
Is the base out of date? (writes nothing, exits 1 if it is) node scripts/generate-angular-base.mjs --check
  • It needs network access and takes a few minutes.
  • A version pin only changes when the new project needs a version outside it.
  • Files we maintain by hand (src/app/*, index.html, styles.scss, README.md, ...) are never overwritten. The script keeps a fingerprint of Angular's version of each one in scripts/generate-angular-base.upstream.json and tells you when Angular changes one, so you can port the change.

Template changes from the first run (Angular 22.2)

  • tsconfig*.json: removed settings that are now defaults (strict, strictTemplates, moduleResolution, outDir). Nothing becomes less strict.
  • angular.json: removed the default outputPath and index. Assets now come from the public/ folder plus src/assets, which fixes the missing favicon in the base project. Arrays are formatted the way Angular writes them.
  • .vscode/tasks.json: Angular's updated patterns. A failed build no longer leaves the serve/test task (and F5 debugging) waiting forever.
  • .gitignore: keeps .vscode/mcp.json.
  • package.json:
    • vitest 4 → 5
    • angular-eslint 22.0 → 22.6, with typescript-eslint 8.71.0
    • added igniteui-i18n-core, which ng add igniteui-angular now installs
    • removed the unused @angular/platform-browser-dynamic
  • side-nav-auth/files/package.json: now built from the base manifest plus its own packages, because it had drifted (it was still on vitest 4). Also fixes angular-auth-oidc-client: ~22.2.0 was never published, so this project could not install. It is now ~22.0.2.
  • Removed the duplicate _base_with_home/files/src/favicon.ico.

Docs

  • AGENTS.md and .agents/README.md point to the generator.
  • The igniteui-cli-template-anatomy skill has a new "Generated Angular Base Project" section.
  • The igniteui-cli-template-version-update skill now reports the generator command when a new igniteui-angular needs a newer Angular.

Related Issue

Closes #1527

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

  • spec/templates/angular-spec passes. The full npm run test was not run.
  • Smoke test (scripts/smoke-test.sh): every Angular project, plus base, side-nav-auth and side-nav-mini-auth, installs and builds.
  • In a generated base project, npm test (vitest 5) and npm run lint pass.
  • Running the generator a second time changes nothing, and --check exits 0.

Copilot AI balanced review requested due to automatic review settings October 21, 2026 12:30
@coveralls

coveralls commented Oct 21, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 94.592% (+0.01%) from 94.582% — mstoyanova/angular-base-project-generation into master

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Dependency resolution and compiler/test-runner upgrades need human validation, and check mode has an unresolved correctness issue.

1 open issue
What changed in this PR

Automates Angular base-template regeneration using Angular schematics, reducing manual maintenance for future releases.

Changes:

  • Adds a generator with check mode and upstream fingerprints.
  • Refreshes Angular configuration and dependencies, including the authentication template.
  • Documents the regeneration workflow.
File Description
scripts/​generate-angular-base.upstream.json Records upstream fingerprints.
scripts/​generate-angular-base.mjs Generates and patches base templates.
packages/​igx-templates/​igx-ts/​projects/​side-nav-auth/​files/​package.json Aligns dependencies and fixes the authentication version.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​tsconfig.spec.json Removes explicit test output directory.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​tsconfig.json Adopts generated compiler configuration.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​tsconfig.app.json Removes explicit application output directory.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​src/​main.ts Reorders bootstrap imports.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​package.json Refreshes base dependencies.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​angular.json Updates asset handling and generated configuration.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​__dot__vscode/​tasks.json Refreshes background task patterns.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​__dot__gitignore Allows tracking VS Code MCP configuration.
AGENTS.md Directs maintenance to generator patches.
.agents/​skills/​igniteui-cli-template-version-update/​SKILL.md Adds generator guidance for Angular upgrades.
.agents/​skills/​igniteui-cli-template-anatomy/​SKILL.md Documents generated-file ownership and workflow.
.agents/​README.md Adds regeneration workflow references.

Review effort: Balanced

Comment thread scripts/generate-angular-base.mjs Outdated
Marina-L-Stoyanova and others added 3 commits October 21, 2026 15:55
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The network-dependent generator and major tooling upgrades need final human validation before approval.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Avoid overwriting compatible angular-eslint pins during normalization

scripts/​generate-angular-base.mjs:125

This normalization overrides the pin preserved above. If the current angular-eslint pin is ~22.6.2 or exactly 22.6.2 and the installed version satisfies it, these lines still rewrite it to ~22.6.0. That admits previously excluded versions and makes --check report drift even though the existing pin is compatible. Only normalize angular-eslint when its existing pin was not retained.

1 resolved since last review

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The generator must explicitly select npm to prevent local Angular package-manager settings from changing generated output and drift-check results.

1 open issue

Review effort: Balanced

Comment thread scripts/generate-angular-base.mjs Outdated
Marina-L-Stoyanova and others added 5 commits October 22, 2026 10:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…ates

- Deleted package.json, tsconfig.app.json, and tsconfig.spec.json from side-nav-auth project.
- Updated index.ts files in side-nav-auth and side-nav-mini-auth to share authentication extras.
- Removed ng-schematics app-projects related files and schema.
- Updated ng-new schematic to streamline project creation and remove unnecessary complexity.
- Removed generate-angular-base script and upstream tracking for Angular base files.
- Updated versionScript to utilize constants for igniteui-angular package versioning.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Schematic dry runs create project files and install packages outside Angular’s workflow safeguards.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread packages/ng-schematics/src/ng-new/index.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Smoke tests can exercise published templates instead of the checkout, and schematic AI skill copying resolves physical sources from the wrong directory.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity AI skills are copied from the parent instead of the new project

packages/​ng-schematics/​src/​ng-new/​index.ts:151

ScopedTree roots virtual reads at the new project, but it does not change the physical paths used to copy AI skills. In packages/core/util/ai-skills.ts, resolveSkillsRoots() detects the installed skills through that tree and returns a relative node_modules/igniteui-angular/skills path. copyAISkillsToProject() then reads that path through FsFileSystem relative to the unchanged parent working directory. When an agent is selected, this copies no package skills if the parent lacks them, or copies the parent's version instead of the new project's. The scaffold has already deleted the initial AI config. Resolve physical skill sources against the new project's directory as well, and add a disk-backed schematic regression test.

1 resolved since last review

Review effort: Balanced

}
}
// also installs the package.json changes above; playwright is the browser for @vitest/browser-playwright
npmInstall(projectPath, ["playwright", ...extras.devDependencies], true);

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Comment on lines +104 to +109
} catch (error) {
// the folder is this run's own (checked above), so a retry starts clean
fs.rmSync(projectPath, { recursive: true, force: true });
Util.error(`Project creation failed: ${error.message}`, "red");
return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The cleanup in this catch isn't guarded. force: true only ignores a missing path, and maxRetries defaults to 0, so on Windows an EBUSY/EPERM (npm still holding esbuild/rollup binaries) throws from rmSync. That error escapes scaffold() instead of Project creation
failed: …, and the folder is left half-deleted.

} catch (error) {
        try {
                fs.rmSync(projectPath, { recursive: true, force: true });
        } catch {
                Util.warn(`Could not remove "${options.name}"; delete it before retrying.`, "yellow");
        }
        Util.error(`Project creation failed: ${error.message}`, "red");
        return false;
}

Also a question, since the spec tests this on purpose ("a retry starts clean"): should a failure in the final npm install steps delete a project that's otherwise complete? On master, a failed install left the project in place so the user could re-run npm install. Now a dev or unpublished igniteui-cli version (~ → ETARGET) or a network error removes everything. Cleaning up only when generateProject fails, and leaving the project with a warning if a later step fails, might be a better balance.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Two differences from what you suggested:

Cleanup covers more than generateProject. The folder is also removed if copying the template files or patching angular.json/package.json/tsconfigs fails, because a half-patched project isn't one the user can finish with npm install. Only an install failure keeps the folder.

scaffold() still returns false when an install fails, so ig new stops before AI config, git init and the next steps, and the ng-new schematic throws before ai-config and its git task. On master the project also got AI config and git, because installPackages only logged the error. If you'd rather match master fully, scaffold() could return true with the warning and let the callers finish setup. Should I change it to that, or is keeping the project with the warning enough?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Keep scaffold() returning false. Returning true would make ig new set packagesInstalled: true (new.ts:207-212) on a project whose node_modules didn't finish installing, so a later ig add would install on top of a broken tree. It would also print "Project Created" and the next steps for a project that doesn't build yet. Matching master fully would need a third result from scaffold() ("created, packages not installed"), which isn't worth it in this PR.

Comment on lines +78 to +81
if (options.skipInstall) {
Util.warn("--skip-install is ignored for Ignite UI for Angular projects: `ng add` installs the packages it adds.",
"yellow");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This warning also prints from the ng-new schematic, where --skip-install isn't ignored: the schematic still skips the final NodePackageInstallTask (ng-new/index.ts:173) and the start task (:187). The schema.json description and the README in this PR describe that correctly, so the warning contradicts them.

Either warn only from ig new (e.g. the caller decides), or reword it so it's true in both flows:

Util.warn("--skip-install does not apply to the initial setup: `ng add` installs the packages the project starts with.", "yellow");

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.

Use angular schematics to build base project

5 participants