# Automatically updating themes and plugins to .gjs file format

**URL:** https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051
**Category:** Development
**Tags:** dev-news
**Created:** [May 29, 2025, 10:56am UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051 "2025-05-29T10:56:25Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [May 29, 2025, 10:56am UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/1 "2025-05-29T10:56:25Z")

</div>

In the latest version of Discourse’s standard linting config, we’ve enabled the `require-strict-mode` ember-template-lint rule. This will raise a linting error for any `.hbs` files.

To resolve the warnings, you should convert all your component, route, and connector templates to `.gjs` files. To make this easy, we’ve built the [`discourse-gjs-codemod`](https://github.com/discourse/discourse-gjs-codemod), which builds on top of Ember’s [`@embroider/template-tag-codemod`](https://github.com/embroider-build/embroider/tree/main/packages/template-tag-codemod).

To use the codemod, first ensure that your linting dependencies are up-to-date by copying the latest `package.json` from [the plugin skeleton](https://github.com/discourse/discourse-plugin-skeleton/blob/main/package.json) or [the theme skeleton](https://github.com/discourse/discourse-theme-skeleton/blob/main/package.json). Then, run eslint and prettier:

```plaintext
pnpm i
pnpm eslint --fix .
pnpm prettier --write "**/*.{gjs,js,hbs,scss}"

```

If any issues could not be autofixed, resolve them manually now. Don’t run ember-template-lint yet - that’s expected to fail.

Now run the codemod using this command:

```plaintext
pnpm dlx https://github.com/discourse/discourse-gjs-codemod

```

If there are any issues which cannot be automatically resolved, information will be printed to the terminal. Once you’ve resolved the problem, run the codemod again.

For more information about the `.gjs` file format, check out the official guide:

> **[Template Tag Format - Components - Ember Guides](https://guides.emberjs.com/release/components/template-tag-format/)**
>
> The template tag format is a powerful, new way to write components in Ember. It's a single-file format that combines the component's JavaScript and Glimmer template code. The tag is used to keep a clear separation between the template language...

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 29, 2025, 7:11pm UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/2 "2025-05-29T19:11:03Z")

</div>

> [@david](#):
>
> ```plaintext
> pnpm dlx https://github.com/discourse/discourse-gjs-codemod
> 
> ```

It wants a password?

```plaintext
 *) pfaffman@noreno:~/src/pfaffman/discourse-pfaffmanager$ pnpm dlx https://github.com/discourse/discourse-gjs-codemod
Username for 'https://github.com': pfaffman
Password for 'https://pfaffman@github.com':
/home/pfaffman/.cache/pnpm/dlx/txqdpi2aznswmhsvgh3pgqp3te/1971d72469d-323788:
 ERROR Command failed with exit code 128: git ls-remote git+ssh://git@github.com/discourse/discourse-gjs-codemod.git HEAD
ERROR: Repository not found.
fatal: Could not read from remote repository.

```

[https://github.com/discourse/discourse-gjs-codemods](https://github.com/discourse/discourse-gjs-codemods) doesn’t work. Maybe it’s still private?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [May 29, 2025, 7:37pm UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/3 "2025-05-29T19:37:40Z")

</div>

:facepalm:

You’re right, it was private. It’s unlocked now:

[http://github.com/discourse/discourse-gjs-codemod](http://github.com/discourse/discourse-gjs-codemod)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 29, 2025, 7:38pm UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/4 "2025-05-29T19:38:57Z")

</div>

That made a very big difference! A bunch of stuff happened.

> [@david](#):
>
> You’re right, it was private.

So glad I’m not the only one that happens to. 🤣

If you want to delete these three messages, no one will know. 🙂

I can move them to a new topic, but not delete them. . .

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 29, 2025, 7:55pm UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/5 "2025-05-29T19:55:47Z")

</div>

What about this?

```plaintext
                                                                                                                                                           [107/859]
 WARN Issues with peer dependencies found
.
├─┬ ember-auto-import 2.10.0
│ ├─┬ babel-loader 8.4.1
│ │ └── ✕ missing peer webpack@>=2
│ ├─┬ css-loader 5.2.7
│ │ └── ✕ missing peer webpack@"^4.27.0 || ^5.0.0"
│ ├─┬ style-loader 2.0.0
│ │ └── ✕ missing peer webpack@"^4.0.0 || ^5.0.0"
│ └─┬ mini-css-extract-plugin 2.9.2
│ └── ✕ missing peer webpack@^5.0.0
└─┬ ember-source 5.12.0
  ├── ✕ missing peer @glimmer/component@^1.1.2
  └─┬ ember-auto-import 2.10.0
    └── ✕ missing peer webpack@^5.0.0
Peer dependencies that should be installed:
  @glimmer/component@^1.1.2 webpack@">=5.0.0 <6.0.0-0"

```

…

```plaintext

Done in 1.6s using pnpm v9.15.9
file:///home/pfaffman/.cache/pnpm/dlx/txqdpi2aznswmhsvgh3pgqp3te/1971d8d4970-32e7a4/node_modules/.pnpm/execa@9.6.0/node_modules/execa/lib/return/final-error.js:6
        return new ErrorClass(message, options);
               ^

ExecaError: Command failed with exit code 255: '/home/pfaffman/.cache/pnpm/dlx/txqdpi2aznswmhsvgh3pgqp3te/1971d8d4970-32e7a4/node_modules/.pnpm/@embroider+template-
tag-codemod@1.2.1-unstable.ce3535d_@glimmer+component@2.0.0_handlebars@4._arnanpbg4hbtumvl4wyacggoiu/node_modules/@embroider/template-tag-codemod/dist/src/cli.js' '
--relativeLocalPaths=false' '--nativeRouteTemplates=false' '--nativeLexicalThis=false' '--templateInsertion=end' --addNameToTemplateOnly '--customResolver=/home/pfa
ffman/.cache/pnpm/dlx/txqdpi2aznswmhsvgh3pgqp3te/1971d8d4970-32e7a4/node_modules/.pnpm/discourse-gjs-codemod@https+++codeload.github.com+discourse+discourse-gjs-cod
emod+tar.gz+a4bc_2dxbzd2itovnk6l7sa4geot32y/node_modules/discourse-gjs-codemod/custom-resolver.js' '--renamingRules=/home/pfaffman/.cache/pnpm/dlx/txqdpi2aznswmhsvg
h3pgqp3te/1971d8d4970-32e7a4/node_modules/.pnpm/discourse-gjs-codemod@https+++codeload.github.com+discourse+discourse-gjs-codemod+tar.gz+a4bc_2dxbzd2itovnk6l7sa4geo
t32y/node_modules/discourse-gjs-codemod/rules.js' '--renderTests=test/ **/*.js' '--routeTemplates=** /templates/ **/*.hbs' '--components=** /components/**/*.hbs'

```

But it looks like it converted all but a couple of the templates, and though I don’t yet understand why, I’m not surprised, as they have some wacky stuff in them and I was in the process of re-writing them anyway.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [May 30, 2025, 9:38am UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/6 "2025-05-30T09:38:31Z")

</div>

I think the peerdependency message is probably just a warning which can be ignored for the purposes of the codemod.

Not sure about the other error. Is there anything more useful further up in the log? Is this a public theme/plugin you could share?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [May 30, 2025, 10:18am UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/7 "2025-05-30T10:18:10Z")

</div>

Yeah. I think the errors are all spuriois. Only a couple things didn’t get converted. I’m not sure why, but like I said, I was planning on rewriting those anyway.

I think it was a dozen or more that it did manage to rewrite, so it’s an absolute miracle!

I will try it on some other stuff that is public soon.

Thanks!

---

<div class="post-metadata">

### Author: ![gilles](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gilles/32/549022_2.png) [@gilles](https://meta.discourse.org/u/gilles)
#### Post date: [March 23, 2026, 7:32pm UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/9 "2026-03-23T19:32:35Z")

</div>

A small question regarding the update of .gps formats. Should I do it from discourse development or directly on discourse?

I am using self-hosted discourse docker and I tried the command but it doesn’t work

```bash
pnpm i
pnpm eslint --fix .
pnpm prettier --write “\*\*/\*.{gjs,js,hbs,scss}”

```

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 23, 2026, 7:40pm UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/10 "2026-03-23T19:40:47Z")

</div>

It should be done in a [local discourse development environment](https://meta.discourse.org/t/set-up-a-local-discourse-development-environment/182882).

---

<div class="post-metadata">

### Author: ![jericson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jericson/32/116215_2.png) [@jericson](https://meta.discourse.org/u/jericson)
#### Post date: [May 2, 2026, 7:42pm UTC](https://meta.discourse.org/t/automatically-updating-themes-and-plugins-to-gjs-file-format/368051/11 "2026-05-02T19:42:35Z")

</div>

Depending on how long ago you created a plugin from the skeleton, you might also need to grab [eslint.config.mjs](https://github.com/discourse/discourse-plugin-skeleton/blob/main/eslint.config.mjs).
