Upgrade to Pro — share decks privately, control downloads, hide ads and more …

EmberConf '20 - Octane Octopus: The Multi-Faceted Migration

EmberConf '20 - Octane Octopus: The Multi-Faceted Migration

When it comes to migrations, adopting Ember Octane seems more daunting than most due to its breadth of functionality. However, that’s something to celebrate rather than fear! The independent nature of Octane’s feature set allows us to take an incremental approach to migrating away from classic Ember while mitigating the risk of making many changes at once. We’ll explore recommended paths for preparing your codebase, enabling Octane features, and refactoring existing code to the new patterns, all while continuing to develop your application!

Jordan Hawker

March 12, 2020
Tweet

More Decks by Jordan Hawker

Other Decks in Technology

Transcript

  1. LinkedIn Talent Solutions (LTS) Our products work together to deliver

    unique insights from the LinkedIn community to help build winning teams. • Talent Insights, Job Postings, Candidate Sourcing, Company Branding, & More • Built with Ember! • 3 Applications • Nearly 50 Internal Addons • Dozens more company-wide & community addons
  2. Octane: Moving You Forward Without Holding You Back What Is

    Octane? Octane is an Edition of Ember that represents a set of new features meant to fundamentally modernize and improve the way we write Ember applications. Why Migrate To Octane? Octane adopts modern JavaScript features and brings in new patterns to streamline components, state management and more. Interoperability with classic Ember allows developers to build new Octane code while they’re still migrating. We’re all crossing the bridge together!
  3. Octane Features You’ll learn more about these this week… •

    Angle Bracket Syntax • Native Classes • Named Arguments • ES5 Getters • Modifiers • Glimmer Components • Tracked Properties
  4. Migration Goals What do we want to accomplish? • Unlock

    new features quickly • Reduce manual refactoring cost • Minimize overhead of learning new patterns • Accomplish migration with limited resources • No Logical Changes • Stay Productive!
  5. When are Octane features available? Many features have been introduced

    over time throughout the Ember 3.x series. Most features are polyfilled and stable back to 3.8, and all features are available in 3.15. Addon authors can even update to Octane while supporting older versions!
  6. Our Initial Plan Where we started six months ago 1.

    Upgrade to Ember 3.8 2. Enable Features & Polyfills 3. Codemod Supported Features 4. Upgrade to Ember 3.16 5. Convert Components to Glimmer 6. Convert Computed Properties to Tracked Properties
  7. Enable Octane Features Opt-in to these when you’re ready, then

    start using them! • Disable Implicit Application Wrapper • Enable Template-Only Glimmer Components • Enable Async Observers • Install @glimmer/component • Install @glimmer/tracking Note: ember-cli-update can do this!
  8. Remove Classic Patterns From Your Code Remember, your team is

    still being productive! @classic Decorators Workflow • These are added by the Native Class codemod to ease the migration • This decorator allows classic class methods like get/set and enforces the use of init over constructor for superclasses • Progressively convert EmberObject-based classes to Native Classes Remove Classic Ember Patterns • Observers • Ember event listeners such as this.on(‘init’) • Mixins ”Template-Only” Components • Enabling template-only glimmer components runs a codemod that creates a backing class for classic template-only components • Remove this backing class • Remove state mutations from helpers like mut • Remove any 2-way binding
  9. The Final Steps Bring your old code up to your

    new standards Preliminary Component Refactors • Migrate classic components to empty tagname • Wrap component in a root element • Migrate classNames, classNameBindings, and attributeBindings • Migrate methods like click to {{on ‘click’}} • Move DOM manipulation to modifiers • Migrate action to on / fn modifiers Finish Glimmer Conversion • Convert classic components to Glimmer • Convert lifecycle hooks • Convert computed properties & .set to tracked properties • Convert computed properties in non- components to tracked properties Success! You now have a lighter, more ergonomic component interface.
  10. Resources Information for tackling your Octane Migration • #topic-octane-migration on

    the Ember Community Discord • Octane Guides • Ember Atlas Recommended Octane Migration • Classic vs Octane Cheat Sheet • Coming Soon in Ember Octane • Ember-Codemods on GitHub
  11. Key Callouts • Upgrade to Ember 3.16 • Octaneify Your

    Code • Use Octane While You Migrate • Logically, The Same Ember App!