Skip to content

Commit 6dfc951

Browse files
Copilotkdinev
andcommitted
Make 21.0.0 migration optional with user prompt and update CHANGELOG
- Added schema.json to define migration options - Updated migration to accept migrateImports option (defaults to true) - Migration now prompts user whether to migrate imports - Library remains backwards compatible via main entry point re-exports - Added comprehensive 21.0.0 section to CHANGELOG.md documenting: * Multiple entry points support * Breaking changes (component relocations, type renames) * Migration instructions (manual and via ng update) * Benefits (tree-shaking, code splitting, smaller bundles) - Users can opt-out during update and migrate later if desired Co-authored-by: kdinev <[email protected]>
1 parent 3d2c900 commit 6dfc951

File tree

4 files changed

+108
-39
lines changed

4 files changed

+108
-39
lines changed

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,47 @@
33
All notable changes for each version of this project will be documented in this file.
44

55

6+
## 21.0.0
7+
8+
### Breaking Changes
9+
10+
#### Multiple Entry Points Support
11+
12+
The library now supports multiple entry points for better tree-shaking and code splitting. While the main entry point (`igniteui-angular`) remains fully backwards compatible by re-exporting all granular entry points, we recommend migrating to the new entry points for optimal bundle sizes.
13+
14+
**Entry Points:**
15+
- `igniteui-angular/core` - Core utilities, services, and base types
16+
- `igniteui-angular/directives` - Common directives
17+
- Component-specific entry points: `igniteui-angular/grids`, `igniteui-angular/input-group`, `igniteui-angular/drop-down`, etc.
18+
19+
**Migration:**
20+
The `ng update` migration will prompt you to optionally migrate your imports to the new entry points. If you choose not to migrate, you can continue using the main entry point with full backwards compatibility.
21+
22+
To migrate manually later:
23+
```bash
24+
ng update igniteui-angular --migrate-only --from=20.1.0 --to=21.0.0 --migrate-imports
25+
```
26+
27+
**Component Relocations:**
28+
- Input directives (`IgxHintDirective`, `IgxInputDirective`, `IgxLabelDirective`, `IgxPrefixDirective`, `IgxSuffixDirective`) → `igniteui-angular/input-group`
29+
- `IgxAutocompleteDirective``igniteui-angular/drop-down`
30+
- `IgxRadioGroupDirective``igniteui-angular/radio`
31+
- Grid action components → `igniteui-angular/grids`
32+
33+
**Type Renames (to avoid conflicts):**
34+
- `Direction``IgxCarouselDirection` (in carousel)
35+
- `Size``ElementDimensions` (in overlay service)
36+
- `IChangeCheckboxEventArgs``IChangeRadioEventArgs` (in radio)
37+
38+
**Benefits:**
39+
- Better tree-shaking - unused components won't be bundled
40+
- Code splitting - each component can be lazy-loaded separately
41+
- Smaller bundle sizes - import only what you need
42+
- Improved build performance
43+
44+
See the [Angular Package Format documentation](https://angular.io/guide/angular-package-format#entrypoints-and-code-splitting) for more details on entry points.
45+
46+
647
## 20.1.0
748

849
### New Features

projects/igniteui-angular/migrations/migration-collection.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@
252252
"migration-50": {
253253
"version": "21.0.0",
254254
"description": "Updates Ignite UI for Angular from v20.1.0 to v21.0.0 - migrates to multiple entry points",
255-
"factory": "./update-21_0_0"
255+
"factory": "./update-21_0_0",
256+
"schema": "./update-21_0_0/schema.json"
256257
}
257258
}
258259
}

projects/igniteui-angular/migrations/update-21_0_0/index.ts

Lines changed: 51 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -575,50 +575,63 @@ function migrateFile(filePath: string, content: string): string {
575575
return result;
576576
}
577577

578-
export default (): Rule => async (host: Tree, context: SchematicContext) => {
579-
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
580-
context.logger.info('Migrating imports to new entry points...');
578+
interface MigrationOptions {
579+
migrateImports?: boolean;
580+
}
581581

582-
const visit: FileVisitor = (filePath) => {
583-
// Only process TypeScript files
584-
if (!filePath.endsWith('.ts')) {
585-
return;
586-
}
582+
export default (options: MigrationOptions = {}): Rule => async (host: Tree, context: SchematicContext) => {
583+
context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`);
584+
585+
const shouldMigrateImports = options.migrateImports !== false; // Default to true if not specified
586+
587+
if (shouldMigrateImports) {
588+
context.logger.info('Migrating imports to new entry points...');
587589

588-
// Skip node_modules and dist
589-
if (filePath.includes('node_modules') || filePath.includes('dist')) {
590-
return;
591-
}
590+
const visit: FileVisitor = (filePath) => {
591+
// Only process TypeScript files
592+
if (!filePath.endsWith('.ts')) {
593+
return;
594+
}
592595

593-
const content = host.read(filePath);
594-
if (!content) {
595-
return;
596-
}
596+
// Skip node_modules and dist
597+
if (filePath.includes('node_modules') || filePath.includes('dist')) {
598+
return;
599+
}
597600

598-
const originalContent = content.toString();
601+
const content = host.read(filePath);
602+
if (!content) {
603+
return;
604+
}
599605

600-
// Check if file has igniteui-angular imports
601-
if (!originalContent.includes("from 'igniteui-angular'") && !originalContent.includes('from "igniteui-angular"')) {
602-
return;
603-
}
606+
const originalContent = content.toString();
604607

605-
const migratedContent = migrateFile(filePath, originalContent);
608+
// Check if file has igniteui-angular imports
609+
if (!originalContent.includes("from 'igniteui-angular'") && !originalContent.includes('from "igniteui-angular"')) {
610+
return;
611+
}
606612

607-
if (migratedContent !== originalContent) {
608-
host.overwrite(filePath, migratedContent);
609-
context.logger.info(` ✓ Migrated ${filePath}`);
610-
}
611-
};
613+
const migratedContent = migrateFile(filePath, originalContent);
612614

613-
host.visit(visit);
614-
615-
context.logger.info('Migration complete!');
616-
context.logger.info('Breaking changes:');
617-
context.logger.info(' - Input directives moved to igniteui-angular/input-group');
618-
context.logger.info(' - IgxAutocompleteDirective moved to igniteui-angular/drop-down');
619-
context.logger.info(' - IgxRadioGroupDirective moved to igniteui-angular/radio');
620-
context.logger.info('Type renames:');
621-
context.logger.info(' - Direction → IgxCarouselDirection');
622-
context.logger.info(' - Size → ElementDimensions');
623-
context.logger.info(' - IChangeCheckboxEventArgs → IChangeRadioEventArgs');
615+
if (migratedContent !== originalContent) {
616+
host.overwrite(filePath, migratedContent);
617+
context.logger.info(` ✓ Migrated ${filePath}`);
618+
}
619+
};
620+
621+
host.visit(visit);
622+
623+
context.logger.info('Migration complete!');
624+
context.logger.info('Breaking changes:');
625+
context.logger.info(' - Input directives moved to igniteui-angular/input-group');
626+
context.logger.info(' - IgxAutocompleteDirective moved to igniteui-angular/drop-down');
627+
context.logger.info(' - IgxRadioGroupDirective moved to igniteui-angular/radio');
628+
context.logger.info('Type renames:');
629+
context.logger.info(' - Direction → IgxCarouselDirection');
630+
context.logger.info(' - Size → ElementDimensions');
631+
context.logger.info(' - IChangeCheckboxEventArgs → IChangeRadioEventArgs');
632+
} else {
633+
context.logger.info('Skipping import migration. You can continue using the main entry point.');
634+
context.logger.info('Note: The library now supports granular entry points for better tree-shaking.');
635+
context.logger.info('To migrate later, run: ng update igniteui-angular --migrate-only --from=20.1.0 --to=21.0.0');
636+
}
624637
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "http://json-schema.org/schema",
3+
"id": "igniteui-angular-migration-21",
4+
"title": "Update to version 21.0.0",
5+
"type": "object",
6+
"properties": {
7+
"migrateImports": {
8+
"type": "boolean",
9+
"description": "Migrate imports to use granular entry points (e.g., 'igniteui-angular/grids' instead of 'igniteui-angular'). The library remains backwards compatible - you can continue using the main entry point.",
10+
"default": true,
11+
"x-prompt": "Would you like to migrate your imports to use the new granular entry points for better tree-shaking? (The library remains backwards compatible if you choose 'No')"
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)