Releases: ijlee2/ember-codemod-v1-to-v2
Introduced TypeScript
I added types to improve documentation and learn how we can write codemods in TypeScript.
A bug may be possible when running npx [email protected]. I'll update the release notes after testing the release on my local machine.
Separated validation concerns
@codemod-utils/[email protected] allows us to opt in to validating the name and version.
Updated dependencies and latestVersions
0.6.2 Tagged 0.6.2
Updated latestVersions and babel.config.json
A couple of changes to the blueprint files. In effect, I downstreamed the changes in @embroider/[email protected].
- Updated
latestVersions - Updated
__addonLocation__/babel.config.jsonby removing deprecated syntax
You can update your addon's babel.config.json as shown below:
/* Before: babel.config.json (TS projects) */
{
"presets": [["@babel/preset-typescript"]],
"plugins": [
"@embroider/addon-dev/template-colocation-plugin",
["@babel/plugin-transform-typescript", { "allowDeclareFields": true }],
["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties"
]
}/* After: babel.config.json (TS projects) */
{
"presets": [["@babel/preset-typescript"]],
"plugins": [
"@embroider/addon-dev/template-colocation-plugin",
["@babel/plugin-transform-typescript", { "allowDeclareFields": true }],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
"@babel/plugin-proposal-class-properties"
]
}Downstreamed changes from @embroider/addon-blueprint
Features
- Set
allowDeclareFieldsfor TS projects totrueby default1
1. See #32 to learn how to keep your v2 addon up-to-date.
Refactored utilities
Some of the utilities have been replaced with those from @codemod-utils. This should help reduce the maintenance cost.
Downstreamed changes from @embroider/addon-blueprint
Bug fixes
- Added
@babel/runtimeto the addon'spackage.json1
1. See #29 to learn how to keep your v2 addon up-to-date.
Updated blueprints for the workspace root
In addition to updating the dependencies, I simplified the codemod by not allowing the blueprints to add prettier to the workspace root (not necessary).
Removed useRelativePaths. Refactored code.
Based on feedback from the Ember community as well as myself, I decided to remove the useRelativePaths step. The removal has a few benefits:
- There's less code to maintain.
- The end-developer's code is preserved better.
- The end-developer can have an easier time getting the scripts for the addon and test-app packages to run.
If you did want to have relative paths, I recommend doing so in a separate pull request (i.e. separately from migrating to v2 format). ✨
Accounted for public assets
Thanks to @pragatheeswarans and @phndiaye.
Features
- Migrated assets in the
publicfolder1 - Replicated the changes made in embroider-build/addon-blueprint#1062
Bug fixes
- For the test-app package, packages are moved from dependencies to devDependencies only when the package exists. A bug (a
RangeErrorthrown incorrectly) would have surfaced when the v1 addon hastypescriptbut notember-cli-typescript.
1. See #23 to learn how to keep your v2 addon up-to-date.
2. See #22 to learn how to keep your v2 addon up-to-date.