-
Notifications
You must be signed in to change notification settings - Fork 389
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 Javascript #5182
base: main
Are you sure you want to change the base?
Add Javascript #5182
Conversation
017b402
to
c42cfe9
Compare
@@ -0,0 +1,5 @@ | |||
export type ExecutionContext = Map<string | symbol, any> & { __brand: "ExecutionContext" } |
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.
👍🏼 big fan of opaque types
21715ff
to
5e191cb
Compare
* @param recipeName A unique name for the recipe consisting of a dot separated sequence of category | ||
* names in which the recipe should appear followed by a name. For example, | ||
* "org.openrewrite.typescript.find-methods-by-pattern". | ||
*/ | ||
export function Registered(recipeName: string) { |
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.
I like this
I could imagine a @Recipe
decorator that accepts an object with recipe meta data and standardized across all languages supporting the decorator pattern to have the authorship experience converge slightly. Would also reduce the code in the recipe down to just method implementations (javascript is already pretty slim but for other languages may reduce some boilerplate)
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.
examples:
typescript
@Recipe({
id: 'org.testkitchen.BigAwesome',
name: 'Big awesome',
description: 'A recipe ensuring big awesome things'
})
class BigAwesome extends Recipe {}
java
@Recipe(
id = "org.testkitchen.BigAwesome",
name = "Big awesome",
description = "A recipe ensuring big awesome things"
)
public class BigAwesome extends Recipe {}
python
@recipe(
id="org.testkitchen.BigAwesome",
name="Big awesome",
description="A recipe ensuring big awesome things"
)
class BigAwesome(Recipe):
c#
[Recipe(
Id = "org.testkitchen.BigAwesome",
Name = "Big awesome",
Description = "A recipe ensuring big awesome things"
)]
public class BigAwesome : Recipe {}
What's changed?
Bringing Javascript into the core repository. A lot is changing to make openrewrite/rewrite-javascript more idiomatic to JS/TS along the way.
What's your motivation?
Native recipe development of Javascript recipes!