Skip to content
Codemod to convert curly braces syntax to angle brackets syntax
JavaScript HTML
Branch: master
Clone or download
Pull request Compare This branch is 19 commits behind ember-codemods:master.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin [CHORE] Adding packages.json and npm init Mar 18, 2019
transforms Add eslint (ember-codemods#93) Jul 6, 2019
.eslintignore Add eslint (ember-codemods#93) Jul 6, 2019
.eslintrc.js Add eslint (ember-codemods#93) Jul 6, 2019
.gitignore Turn on codemod mode for glimmer parsing May 17, 2019
.prettierrc.js Add eslint (ember-codemods#93) Jul 6, 2019
.travis.yml bump packages (ember-codemods#71) Jun 25, 2019
LICENSE [CHORE] Remove rajasegar:author references (ember-codemods#92) Jul 6, 2019
astexplorer.json Initial commmit with astexplorer assets Mar 16, 2019
package-lock.json Add eslint (ember-codemods#93) Jul 6, 2019
package.json Add eslint (ember-codemods#93) Jul 6, 2019
source.handlebars [CHORE] Finally made jscodeshift to work Mar 18, 2019


Build Status Coverage Status npm version dependencies Status devDependencies Status

A jscodeshift Codemod to convert curly braces syntax to angle brackets syntax for templates in an Ember.js app

Refer to this RFC for more details on Angle brackets invocation syntax.


WARNING: jscodeshift, and thus this codemod, edits your files in place. It does not make a copy. Make sure your code is checked into a source control repository like Git and that you have no outstanding changes to commit before running this tool.

$ cd my-ember-app-or-addon
$ npx ember-angle-brackets-codemod angle-brackets app/templates


{{site-header user=this.user class=(if this.user.isAdmin "admin")}}

{{#super-select as |s|}}
  {{#each this.availableCountries as |country|}}
    {{#s.option value=country}}{{}}{{/s.option}}

{{ui/button text="Click me"}}


<SiteHeader @user={{this.user}} class={{if this.user.isAdmin "admin"}} />
<SuperSelect @selected={{}} as |s|>
  {{#each this.availableCountries as |country|}}
    <s.option @value={{country}}>

<Ui::Button @text="Click me" />

Advanced Usage

Skipping helpers

To help the codemod disambiguate components and helpers, you can define a list of helpers from your application in a configuration file as follows:


  "helpers": [

The codemod will then ignore the above list of helpers and prevent them from being transformed into the new angle-brackets syntax.

You can also disable the conversion of the built-in components {{link-to}}, {{input}} and {{textarea}} as follows:


  "helpers": [],
  "skipBuiltInComponents": true

You can execute the codemod with custom configuration by specifying a --config command line option as follows:

$ cd my-ember-app-or-addon
$ npx ember-angle-brackets-codemod angle-brackets app/templates --config ./config/anglebrackets-codemod-config.json

To get a list of helpers in your app you can do this in the Developer Console in your browser inside of your app:

var componentLikeHelpers = Object.keys(require.entries)
    .filter(name=>(name.includes('/helpers/')|| name.includes('/helper')))
        let path = name.split('/helpers/');
        return path.pop();


Skipping some files

If there are files that don't convert well, you can skip them by specifying an optional skipFilesThatMatchRegex configuration setting. For example, with the configuration below, all files that contain "foo" or "bar" will be skipped:


  "helpers": [],
  "skipBuiltInComponents": true,
  "skipFilesThatMatchRegex": "foo|bar"

Debugging Workflow

Oftentimes, you want to debug the codemod or the transform to identify issues with the code or to understand how the transforms are working, or to troubleshoot why some tests are failing.

Hence we recommend a debugging work-flow like below to quickly find out what is causing the issue.

1. Place debugger statements

Add debugger statements, in appropriate places in the code. For example:

const params = => {
  if(p.type === "SubExpression") {
    return transformNestedSubExpression(p)

2. Inspect the process with node debug

Here we are going to start the tests selectively in node debug mode. Since the codemod is bootstrapped using codemod-cli which is using jest in turn to run the tests, jest is having an option -t <name-of-spec> to run a particular set of tests instead of running the whole test suite.

We are making use of both these features to start our tests in this particular fashion. For more details on node debug, visit the official Node.js debugging guide, and for jest documentation on tests, here

node --inspect-brk ./node_modules/.bin/codemod-cli -t '<fixture-name>'

For example, if you want to debug the null-subexp.input.hbs fixture or only that particular test case is failing because of an issue.

node --inspect-brk ./node_modules/.bin/codemod-cli -t 'null-subexp'

Once you run the above command, your tests will start running in debug mode and your breakpoints will be triggered appropriately when that particular block of code gets executed. You can run the debugger inside Chrome browser dev-tools. More details on here

AST Explorer playground

  1. Go to the AST Explorer
  2. Paste your curly brace syntax code in the top left corner window (Source)
  3. You will get the converted angle bracket syntax in the bottom right corner window (Transform Output)


Known issues

  • No formatting preserved


You can’t perform that action at this time.