index.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. "use strict";
  2. /**
  3. * @license
  4. * Copyright Google LLC All Rights Reserved.
  5. *
  6. * Use of this source code is governed by an MIT-style license that can be
  7. * found in the LICENSE file at https://angular.io/license
  8. */
  9. Object.defineProperty(exports, "__esModule", { value: true });
  10. const schematics_1 = require("@angular/cdk/schematics");
  11. const chalk_1 = require("chalk");
  12. const upgrade_data_1 = require("./upgrade-data");
  13. const misc_class_inheritance_rule_1 = require("./upgrade-rules/misc-checks/misc-class-inheritance-rule");
  14. const misc_class_names_rule_1 = require("./upgrade-rules/misc-checks/misc-class-names-rule");
  15. const misc_imports_rule_1 = require("./upgrade-rules/misc-checks/misc-imports-rule");
  16. const misc_property_names_rule_1 = require("./upgrade-rules/misc-checks/misc-property-names-rule");
  17. const misc_template_rule_1 = require("./upgrade-rules/misc-checks/misc-template-rule");
  18. const ripple_speed_factor_rule_1 = require("./upgrade-rules/misc-ripples-v7/ripple-speed-factor-rule");
  19. const secondary_entry_points_rule_1 = require("./upgrade-rules/package-imports-v8/secondary-entry-points-rule");
  20. const materialMigrationRules = [
  21. misc_class_inheritance_rule_1.MiscClassInheritanceRule,
  22. misc_class_names_rule_1.MiscClassNamesRule,
  23. misc_imports_rule_1.MiscImportsRule,
  24. misc_property_names_rule_1.MiscPropertyNamesRule,
  25. misc_template_rule_1.MiscTemplateRule,
  26. ripple_speed_factor_rule_1.RippleSpeedFactorRule,
  27. secondary_entry_points_rule_1.SecondaryEntryPointsRule,
  28. ];
  29. /** Entry point for the migration schematics with target of Angular Material v6 */
  30. function updateToV6() {
  31. return schematics_1.createUpgradeRule(schematics_1.TargetVersion.V6, materialMigrationRules, upgrade_data_1.materialUpgradeData, onMigrationComplete);
  32. }
  33. exports.updateToV6 = updateToV6;
  34. /** Entry point for the migration schematics with target of Angular Material v7 */
  35. function updateToV7() {
  36. return schematics_1.createUpgradeRule(schematics_1.TargetVersion.V7, materialMigrationRules, upgrade_data_1.materialUpgradeData, onMigrationComplete);
  37. }
  38. exports.updateToV7 = updateToV7;
  39. /** Entry point for the migration schematics with target of Angular Material v8 */
  40. function updateToV8() {
  41. return schematics_1.createUpgradeRule(schematics_1.TargetVersion.V8, materialMigrationRules, upgrade_data_1.materialUpgradeData, onMigrationComplete);
  42. }
  43. exports.updateToV8 = updateToV8;
  44. /** Function that will be called when the migration completed. */
  45. function onMigrationComplete(targetVersion, hasFailures) {
  46. console.log();
  47. console.log(chalk_1.green(` ✓ Updated Angular Material to ${targetVersion}`));
  48. console.log();
  49. if (hasFailures) {
  50. console.log(chalk_1.yellow(' ⚠ Some issues were detected but could not be fixed automatically. Please check the ' +
  51. 'output above and fix these issues manually.'));
  52. }
  53. }
  54. //# sourceMappingURL=index.js.map