-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add update_core_deprecations script #23
Conversation
7810886
to
b074e25
Compare
|
||
traverse(ast, { | ||
CallExpression(path) { | ||
if (t.isIdentifier(path.node.callee, { name: "deprecated" })) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the key point where the traverse
visitor function finds the function call for deprecated
in the current file's AST.
Can we still add manual deprecation IDs? (e.g. for deprecation IDs which are dynamically generated, and will not be picked up by this script) I wonder if we need to split stuff into two files: one for the auto-detected deprecations from this script, and the other file can have manually-added ones? |
For this, we can use the old way of declaring such IDs explicitly in @davidtaylorhq do you have any existing examples for dynamically generated deprecation IDs? |
Only one I can think of at the moment is the deprecated plugin outlet arg (https://github.com/discourse/discourse/blob/23aa88d2038260481900478a3dcea0f283182984/app/assets/javascripts/discourse/app/components/header/contents.gjs#L103C17-L112C13) |
This will update the deprecation ids for core in our reference yml file upon running:
where $DISCOURSE is the file path to your core discourse repository.
It also writes the paths of files where we call
deprecated
but no IDs are scraped from that same file intofiles_to_debug.txt
.Testing
Generated PR (no files to debug):
tyb-talks#8
Generated PR (with files to debug):
tyb-talks#9
Considerations
deprecated
calls within the same file, and not across different files (which would be the case if we exported functions that wrap arounddeprecated
that are used in other files). This is sufficient for now.files_to_debug.txt
file is not ideal but was required to ensure that even if no IDs needed to be updated, we still raise a PR whenever there are files to debug since thecreate-pull-request
action relies on repo diffs to trigger.js-yaml
is used instead ofyaml
primarily because of thenoArrayIndent
option which maintains the same indentation of YAML content as the rubyyaml
package.content-tag
first (Extract preprocessor and babel plugin into their own packages ember-cli/ember-template-imports#143 (comment) clued me in on this).