Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote better deprecation communication and compatibility #3261

Merged
merged 5 commits into from Dec 18, 2019

Conversation

thisisdano
Copy link
Member

@thisisdano thisisdano commented Dec 12, 2019

We're handling deprecations more gracefully. Occasionally the design system will deprecate variables or functionality. Now we'll display a deprecation message in the terminal when compiling USWDS Sass to better communicate these changes. We're also improving backward compatibility by supporting deprecated variables, functions, and mixins throughout the major version cycle. This way, we can continue to improve how our code is structured while minimizing the effects of this restructuring on your projects.

This is how the deprecation warning prints in the terminal:

--------------------------------------------------------------------
✉ USWDS Notifications
--------------------------------------------------------------------
2.4.0: If your component settings aren't working as expected, make
sure you're importing the components settings in your Sass entry
point (often styles.scss) with `@import "uswds-theme-components"`.
A bug in 2.0 omitted that import.
--------------------------------------------------------------------
2.2.0: We changed the names of some settings.
$theme-navigation-width → $theme-header-min-width
$theme-megamenu-logo-text-width → $theme-header-logo-text-width
--------------------------------------------------------------------
2.0.2: We changed the names of some settings and mixins.
$theme-title-font-size → $theme-display-font-size
@include title → @include display
@include typeset-title → @include typeset-display
--------------------------------------------------------------------
These are notifications from the USWDS team, not necessarily a
problem with your code.

Disable notifications using $theme-show-notifications: false
--------------------------------------------------------------------

Success criteria

  • Deprecated or changed variables, mixins, and functions continue to work throughout the major version
  • Accurate warning shows on compile, with the changed functionality and its replacement
  • Warning may be disabled

Fixes #3254

@thisisdano thisisdano requested a review from a team December 12, 2019 22:38
@thisisdano thisisdano added Affects: Compiling Related to compiling Sass or JavaScript improves: continuity Affects: Documentation Relates to documentation. Should this be in uswds-site? Type: Enhancement An improvement to existing code labels Dec 12, 2019
@thisisdano thisisdano added this to Review in USWDS Sprint Board via automation Dec 12, 2019
@thisisdano thisisdano added this to the Release 2.4.0 milestone Dec 12, 2019
@mejiaj
Copy link
Contributor

mejiaj commented Dec 16, 2019

@thisisdano on a watch task this changelog update message would run every SCSS update right?

Do you have any thoughts on possibly moving the changelog message as a gulp task and maybe we can take advantage of:

const log = require('fancy-log');
const c = require('ansi-colors');

@thisisdano
Copy link
Member Author

It would yeah — I don't think I know how to make run only once. I do worry that it's too "heavy", but I also think that's important to get a notification in the build process in addition to release notes, etc. Perhaps there is a better way?

For me, the downside to a gulp-based solution is it's too tied to uswds-gulp — if we can build it into the Sass itself, it should work regardless of how a user compiles.

The upside it it looks less like an error and could maybe have more sophisticated logic. Even so, I'm inclined to keep it in Sass.

@thisisdano
Copy link
Member Author

Perhaps this needs more time to bake and we should wait for a later release

@thisisdano
Copy link
Member Author

On second thought, I think this is better to get in right now. Then we can work to improve it.
@mejiaj Anything you consider a blocking issue here?

@thisisdano thisisdano self-assigned this Dec 18, 2019
@mejiaj
Copy link
Contributor

mejiaj commented Dec 18, 2019

No sir, seems good to go. I'll see if I can prototype something on my end and see how/if we can improve. But as of now, you're right. It's good info for users.

@mejiaj mejiaj merged commit f5d63e7 into develop Dec 18, 2019
USWDS Sprint Board automation moved this from Review to Done Dec 18, 2019
@mejiaj mejiaj deleted the dw-deprecated branch December 18, 2019 18:38
@thisisdano thisisdano mentioned this pull request Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Affects: Compiling Related to compiling Sass or JavaScript Affects: Documentation Relates to documentation. Should this be in uswds-site? Type: Enhancement An improvement to existing code
Projects
Development

Successfully merging this pull request may close these issues.

Add deprecated vars and alias them to their replacements
2 participants