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

Covered @codemod-utils and ember-codemod-args-to-signature #1293

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 32 additions & 15 deletions content/the-ember-times-issue-206.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: The Ember Times - Issue No. 206
authors:
- anne-greeth-schot-vanherwijnen
- isaac-lee
- the-crowd # replace with real authors from the author folder (add yourself if you're not there)
date: 2023-08-04T00:00:00.000Z
tags:
Expand All @@ -12,6 +13,8 @@ tags:
👋 Emberistas! 🐹

EmberConf 2023 🎙️, EmberFest 2023 🇪🇸,
a modern way to write codemods,
a codemod to help introduce Glint,
<SOME-INTRO-HERE-TO-KEEP-THEM-SUBSCRIBERS-READING>

---
Expand Down Expand Up @@ -40,27 +43,41 @@ After a great EmberConf, next up is [EmberFest](https://emberfest.eu) on the 21s

---

## [🐹 4. Section title in sentence case](section-url)
## [🤖 A modern way to write codemods](https://github.com/ijlee2/codemod-utils)

<change section title emoji>
<consider adding some bold to your paragraph>
<add the contributor in the post in format "FirstName LastName (@githubUserName)" linked to their GitHub account>
<please include link to external article/repo/etc in paragraph / body text, not just header title above>
A few EmberConf talks brought up the need for more codemods. Isaac Lee ([@ijlee2](https://github.com/ijlee2)) has been working on [`@codemod-utils`](https://github.com/ijlee2/codemod-utils), a set of tools and conventions for writing codemods, and a CLI (command-line interface) to help you get started:

<add your name to author list, top and bottom>
<add short title to "SOME-INTRO-HERE">
```sh
npx @codemod-utils/cli --name <your-codemod-name>
```

<!-- alex ignore simple -->
`@codemod-utils` encourages taking small and simple steps, as they are key to writing codemods that can be maintained and extended. Isaac, in the talk "[In 1 Year](https://crunchingnumbers.live/2023/07/20/in-1-year)," explained:

> My hope is, we can lower the [entry] barrier enough that, if a person can write a function in Node.js, then they can start writing a codemod.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yaaas


To learn how to write a codemod, check out [the main tutorial](https://github.com/ijlee2/codemod-utils#tutorials) and [the codemods written with `@codemod-utils`](https://github.com/ijlee2/codemod-utils#codemods-written-with-codemod-utils).

---

## [🐹 5. Section title in sentence case](section-url)
## [✨ Codemod to help introduce Glint](https://github.com/ijlee2/ember-codemod-args-to-signature)

<change section title emoji>
<consider adding some bold to your paragraph>
<add the contributor in the post in format "FirstName LastName (@githubUserName)" linked to their GitHub account>
<please include link to external article/repo/etc in paragraph / body text, not just header title above>
To introduce Glint, you will need to write the [signature](https://typed-ember.gitbook.io/glint/environments/ember/component-signatures) and [template registry](https://typed-ember.gitbook.io/glint/environments/ember/template-registry) for each component. This can be an error-prone, onerous task for large projects.

<add your name to author list, top and bottom>
<add short title to "SOME-INTRO-HERE">
You can automate the required change by running [`ember-codemod-args-to-signature`](https://github.com/ijlee2/ember-codemod-args-to-signature).

```sh
# Apps
ember-codemod-args-to-signature --src app/components

# V1 addons
ember-codemod-args-to-signature --src addon/components

# V2 addons
ember-codemod-args-to-signature --src src/components
```

The codemod will partially fill out signatures and template registries. It will also fix related code, so that your project is consistent in syntax and follows Ember's naming conventions. If you've previously taken the effort to add `Args` to your components (the former way of defining the signature), the codemod will use what you already know to create `Signature`.

---

Expand Down Expand Up @@ -126,4 +143,4 @@ That's another wrap! ✨

Be kind,

Anne-Greeth Schot-van Herwijnen, the crowd and the Learning Team
Anne-Greeth Schot-van Herwijnen, Isaac Lee, the crowd and the Learning Team
Loading