Skip to content

Commit

Permalink
Merge pull request #1147 from NullVoxPopuli/add-migration-codemod
Browse files Browse the repository at this point in the history
Add v6 to v7 codemod
  • Loading branch information
NullVoxPopuli authored Sep 5, 2024
2 parents 7ea156c + 71a39bf commit 3dc9bcf
Show file tree
Hide file tree
Showing 22 changed files with 5,708 additions and 15 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,17 @@ jobs:
- uses: ./.github/actions/download-built-package
- run: pnpm --filter test-app test:ember

codemod_tests:
name: Codemod Tests
timeout-minutes: 5
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
- run: pnpm vitest
working-directory: ./codemod

floating_tests:
name: Floating Deps Test
timeout-minutes: 5
Expand Down
9 changes: 9 additions & 0 deletions MIGRATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@

## 7.0

Run the migrator to automate this upgrade -- there are no breaking changes, no API changes, only changes in where imports occur.

```bash
npx ember-resources-codemod
```

This codemod runs on all js, ts, gjs, and gts files from within the invoked current working directory.



- Class-based resource implementation moved to [ember-modify-based-class-resource](https://github.com/NullVoxPopuli/ember-modify-based-class-resource/)
- Other utilities moved to [https://reactive.nullvoxpopuli.com/](https://reactive.nullvoxpopuli.com/)
Expand Down
24 changes: 24 additions & 0 deletions codemod/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

const { configs } = require('@nullvoxpopuli/eslint-configs');

const config = configs.node();

module.exports = {
...config,
overrides: [
...config.overrides,
{
files: ['**/*'],
rules: {
'n/no-process-exit': 'off',
},
},
{
files: ['**/*.test.ts'],
rules: {
'n/no-unpublished-import': 'off',
},
},
],
};
30 changes: 30 additions & 0 deletions codemod/.prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';

module.exports = {
plugins: ['prettier-plugin-ember-template-tag'],
printWidth: 100,
singleQuote: true,
templateSingleQuote: false,
// this was required to make the VSCode + Prettier work correctly with <template>, see https://github.com/gitKrystan/prettier-plugin-ember-template-tag/issues/38
// we should roll this back once that issue has been fixed!
overrides: [
{
files: '*.hbs',
options: {
singleQuote: false,
},
},
{
files: '*.gjs',
options: {
parser: 'ember-template-tag',
},
},
{
files: '*.gts',
options: {
parser: 'ember-template-tag',
},
},
],
};
9 changes: 9 additions & 0 deletions codemod/bin.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

import { run } from './src/all.js';
import { sep, success } from './src/logging.js';

await run();

sep();
success(`✨ Done! ✨`);
39 changes: 39 additions & 0 deletions codemod/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "ember-resources-codemod",
"version": "0.0.3",
"bin": "./bin.mjs",
"type": "module",
"files": [
"bin.mjs",
"src"
],
"scripts": {
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
"lint:js": "eslint . --cache",
"lint:prettier": "prettier --check '**/*.{js,ts}'",
"lint:prettier:fix": "prettier --write '**/*.{js,ts}'",
"lint:js:fix": "eslint . --fix"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/eslint-parser": "^7.19.1",
"@nullvoxpopuli/eslint-configs": "^3.2.0",
"@tsconfig/node22": "^22.0.0",
"@tsconfig/strictest": "^2.0.5",
"@types/node": "^22.5.4",
"@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"concurrently": "^8.2.2",
"eslint": "^8.35.0",
"prettier": "^3.1.1",
"typescript": "~5.5.0",
"vitest": "^2.0.5"
},
"dependencies": {
"find-up": "^7.0.0",
"globby": "^14.0.0",
"semver": "^7.6.3"
}
}
Loading

0 comments on commit 3dc9bcf

Please sign in to comment.