-
Notifications
You must be signed in to change notification settings - Fork 46
Deprecating component properties
-
Update code so that both the new and deprecated properties work (backward compatibility). For example, if you deprecating an
itemAlignment
property in favor ofalign
, the twig might look like this:{% if itemAlignment %} {% if itemAlignment == "start" %} {% set itemAlignment = "left" %} {% endif %} {% set align = itemAlignment %} {% endif %}
-
Update the component's schema.
-
Document the deprecated property. For example:
{ title: 'Bolt Button', itemAlignment: { title: 'DEPRECATED', description: 'Use the align parameter instead.', }, }
-
Mark the schema as invalid if the deprecated property is present. For example:
{ title: 'Bolt Button', not: { required: ['itemAlignment'] }, }
Note that if multiple props are deprecated in a single component, you'll need to use this unintuitive syntax:
{ title: 'Bolt Button', not: { anyOf: [ { required: ['itemAlignment'], }, { required: ['rounded'], }, ], }, }
-
-
Update all usages in PL to remove usages of deprecation. Because of your schema updates, the build should not work until you've found them all.
-
In the PR description, describe the deprecation and steps to update legacy code
- When merging, copy the deprecation description from the PR to the
Deprecations
section of the release notes. - As for all releases, point developers doing the integration to the release notes. Encourage them to update their existing code immediately to remove the deprecation when integrating the new version of Bolt.
- Use the schema to check for usages of the
not required
syntax to go back through and remove deprecations. Remove them from the schema too-- they will now simply just not work. - As you do this, generate a list of previously deprecated features that are now officially removed (this should ultimately match the cumulative result of all 'Deprecated' release notes from the past release).
Note: the workflow is still loose on the Drupal side because we've done so few major releases, but the current plan is that properties won't really worry much about deprecations until it comes time for a major release, and which point they'll go through a list of removed features and make updates on their end.
- Basic A11y Checklist
- Get started with Bolt locally
- Bolt Specific Standards and Conventions
- How to save SVG graphics and SVG icons
- Upgrade to minor release
- Upgrade to 4.x
- Upgrade to 5.x
- Release Workflow
- VS Code Configuration
- Bolt Doc Writing Guide
- Prefixing Custom Attributes
- Standard Props for Passing Content in Twig
- Building Websites with Bolt in Drupal
- From Design Mockup to Code
- Override with Utility Classes