
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
ember-codemod-template-tag
Advanced tools
Codemod to convert Glimmer components to the <template> tag authoring format in .gjs and .gts
Codemod to convert Glimmer components to the <template>
tag authoring format in .gjs
and .gts
.
NOTE This codemod is far from feature complete. Currently it only handles converting
*-test.js
files which use thehbs
helper. PRs welcome!
hbs
template helper to the <template>
taghbs
importCards::CardHeader
will be used as CardHeader
)concat
, array
, fn
, get
, hash
)Given a file foo-test.js
:
npx ember-codemod-template-tag --app-name example-app
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'example-app/tests/helpers/component-test';
module('Integration | Component | foo', function (hooks) {
setupRenderingTest(hooks);
test('bar', async function (assert) {
await render(hbs`<Foo @x={{array 1 2 3}} />`);
});
});
The codemod will rewrite this to:
import { array } from '@ember/helper';
import Foo from 'example-app/components/foo';
import { render } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupRenderingTest } from 'example-app/tests/helpers/component-test';
module('Integration | Component | foo', function (hooks) {
setupRenderingTest(hooks);
test('bar', async function (assert) {
await render(<template><Foo @x={{array 1 2 3}}/></template>);
});
});
WARNING As with most codemods, changes are made in place, meaning it will overwrite existing files. Make sure to run this codemod on a codebase that has been checked into version control to avoid losing progress.
You must pass the app name as an argument to the codemod. This value is used to provide import statements:
npx ember-codemod-template-tag --app-name <your-app-name>
Pass --root
to run the codemod somewhere else (i.e. not in the current directory).
npx ember-codemod-template-tag --root <path/to/your/project>
The codemod is designed to cover typical cases. It is not designed to cover one-off cases.
To better meet your needs, consider cloning the repo and running the codemod locally.
cd <path/to/cloned/repo>
# Compile TypeScript
pnpm build
# Run codemod
./dist/bin/ember-codemod-template-tag.js --root <path/to/your/project>
See the Contributing guide for details.
This project is licensed under the MIT License.
FAQs
Codemod to convert Glimmer components to the <template> tag authoring format in .gjs and .gts
The npm package ember-codemod-template-tag receives a total of 0 weekly downloads. As such, ember-codemod-template-tag popularity was classified as not popular.
We found that ember-codemod-template-tag demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.