https://github.com/ijlee2/ember-codemod-add-component-signatures
Codemod to add component signatures
https://github.com/ijlee2/ember-codemod-add-component-signatures
codemod ember-codemod emberjs embroider glint typescript
Last synced: 3 months ago
JSON representation
Codemod to add component signatures
- Host: GitHub
- URL: https://github.com/ijlee2/ember-codemod-add-component-signatures
- Owner: ijlee2
- License: mit
- Created: 2023-06-20T17:10:20.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-12-29T13:49:05.000Z (6 months ago)
- Last Synced: 2026-01-16T05:23:30.597Z (5 months ago)
- Topics: codemod, ember-codemod, emberjs, embroider, glint, typescript
- Language: TypeScript
- Homepage:
- Size: 899 KB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
[](https://github.com/ijlee2/ember-codemod-add-component-signatures/actions/workflows/ci.yml)
# ember-codemod-add-component-signatures
_Codemod to add component signatures_
## What is it?
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.
You can run this codemod to get started.
## Features
- Scaffolds signature for components
- Adds template registry for components (Glint v1)
- Supports `` tag (Glint v2)
Template-only components
Glimmer components
## Usage
Step 1. Quickly migrate.1
```sh
cd
pnpx ember-codemod-add-component-signatures
```
Step 2. Review the package.
- [x] Fill in missing type information.
- [x] Confirm that you can run all scripts in `package.json`.
For more information, please check the [FAQ](#frequently-asked-questions).
1. The codemod assumes that your apps and addons follow the Octane layout (flat or nested). If not, you can run codemods to move away from [classic](https://github.com/ember-codemods/ember-component-template-colocation-migrator) and [pod](https://github.com/ijlee2/ember-codemod-pod-to-octane).
### Arguments
Optional: Limit entity to consider
By default, the codemod considers all files and folders for components, routes, and tests. Pass `--entity` to limit the search to 1 entity and its sub-entities (if any). You may use curly braces to specify multiple entities.
```sh
# `ui/form` only
pnpx ember-codemod-add-component-signatures --entity ui/form
```
Optional: Specify the component structure
By default, an Octane project has the flat component structure. Pass `--component-structure` to indicate otherwise.
```sh
pnpx ember-codemod-add-component-signatures --component-structure nested
```
Optional: Convert *.{js,gjs} files
By default, the codemod ignores component classes written in `*.{js,gjs}`. Pass `--convert-javascript` to allow the codemod to change the file extension to `*.{ts,gts}` and add the component signature.
```sh
pnpx ember-codemod-add-component-signatures --convert-javascript
```
Optional: Create registries
By default, the codemod doesn't add registries to component classes, because these registries are unnecessary for Glint v2 (strict mode templates). Pass `--create-registries` if you use Glint v1 (loose mode templates).
```sh
pnpx ember-codemod-add-component-signatures --create-registries
```
Optional: Specify the project root
Pass `--root` to run the codemod on a project somewhere else (i.e. not in the current directory).
```sh
pnpx ember-codemod-add-component-signatures --root
```
### Limitations
The codemod is designed to cover typical cases. It is not designed to cover one-off cases. (Classic components are not supported.)
To better meet your needs, consider cloning the repo and running the codemod locally.
```sh
cd
# Compile TypeScript
pnpm build
# Run codemod
./dist/bin/ember-codemod-add-component-signatures.js --root
```
## Compatibility
- Node.js v22 or above
## Contributing
See the [Contributing](CONTRIBUTING.md) guide for details.
## License
This project is licensed under the [MIT License](LICENSE.md).