Skip to content

Commit 4e4a9ba

Browse files
authored
Merge pull request #418 from ember-codemods/typescript
Typescript
2 parents e5c1fed + aa3af29 commit 4e4a9ba

26 files changed

+1516
-1464
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ jobs:
4444
node-version: '16.x'
4545
- name: Install
4646
run: pnpm install
47+
- run: pnpm build
4748
- name: Test
4849
env:
4950
EMBER_VERSION: ${{ matrix.ember_version }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ node_modules
33
tmp
44
*.log
55
test/**/yarn.lock
6+
test/**/*.js
7+
test/**/*.js.map
8+
transforms/**/*.js
9+
transforms/**/*.js.map
10+
helpers/**/*.js
11+
helpers/**/*.js.map
12+
!**/__testfixtures__/**/*

helpers/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** Type predicate. Checks if the given value is a `Record<string, unknown>`. */
2+
export function isRecord<R extends Record<string, unknown>>(
3+
value: unknown
4+
): value is R {
5+
return value !== null && typeof value === 'object';
6+
}

package.json

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,56 @@
1818
"bin": {
1919
"ember-no-implicit-this-codemod": "./bin/cli.js"
2020
},
21+
"files": [
22+
"/bin",
23+
"/helpers/**/*.js",
24+
"/transforms/no-implicit-this/index.js",
25+
"/transforms/no-implicit-this/helpers/**/*.js"
26+
],
2127
"scripts": {
28+
"build": "tsc",
29+
"clean": "tsc --build --clean",
2230
"codemod": "jscodeshift -t ./transforms/no-implicit-this/index.js --extensions js,ts,hbs --run-in-band",
2331
"coveralls": "cat ./coverage/lcov.info | node node_modules/.bin/coveralls",
2432
"debug:codemod": "node --inspect-brk node_modules/jscodeshift/bin/jscodeshift.js -t ./transforms/no-implicit-this/index.js --run-in-band --extensions js,ts,hbs ",
2533
"debug:codemod:not-working": "node --inspect-brk ./bin/cli",
2634
"debug:telemetry": "node --inspect-brk ./bin/telemetry.js",
2735
"lint:js": "eslint .",
36+
"lint:ts": "tsc --noEmit",
37+
"prepublishOnly": "yarn build",
38+
"release": "release-it",
2839
"test": "jest",
40+
"pretest:integration": "yarn build",
2941
"test:integration": "ts-node ./test/run-test.ts",
3042
"update-docs": "codemod-cli update-docs"
3143
},
3244
"jest": {
45+
"preset": "ts-jest",
3346
"testEnvironment": "node",
3447
"testMatch": [
35-
"<rootDir>/transforms/**/test.js"
48+
"<rootDir>/transforms/**/test.{js,ts}"
3649
]
3750
},
3851
"dependencies": {
39-
"codemod-cli": "^2.1.0",
52+
"@babel/parser": "^7.23.6",
53+
"codemod-cli": "^3.2.0",
4054
"debug": "^4.1.1",
4155
"ember-codemods-telemetry-helpers": "^3.0.0",
42-
"ember-template-recast": "^3.3.2"
56+
"ember-template-recast": "^6.1.4",
57+
"zod": "^3.22.4"
4358
},
4459
"devDependencies": {
60+
"@tsconfig/node16": "^1.0.4",
61+
"@tsconfig/strictest": "^2.0.1",
62+
"@types/babel__core": "^7.20.5",
4563
"@types/chalk": "^2.2.0",
4664
"@types/common-tags": "^1.8.0",
65+
"@types/debug": "^4.1.8",
66+
"@types/jscodeshift": "^0.11.6",
4767
"@types/node": "^20.11.5",
48-
"@typescript-eslint/eslint-plugin": "^2.34.0",
49-
"@typescript-eslint/parser": "^2.34.0",
68+
"@typescript-eslint/eslint-plugin": "^5.59.7",
69+
"@typescript-eslint/parser": "^5.59.7",
70+
"ast-types": "^0.14.2",
5071
"babel-plugin-htmlbars-inline-precompile": "^3.0.1",
5172
"chalk": "^4.1.1",
5273
"common-tags": "^1.8.0",
@@ -55,11 +76,12 @@
5576
"eslint-config-prettier": "^6.15.0",
5677
"eslint-plugin-prettier": "^3.4.0",
5778
"execa": "^3.4.0",
58-
"jest": "^26.6.3",
79+
"jest": "^29.1.0",
5980
"prettier": "^1.19.1",
6081
"release-plan": "^0.6.0",
61-
"ts-node": "^8.10.2",
62-
"typescript": "~3.9.7"
82+
"ts-jest": "^29.1.0",
83+
"ts-node": "^10.9.1",
84+
"typescript": "~5.0.4"
6385
},
6486
"engines": {
6587
"node": "16.* || 18.* || >= 20"

0 commit comments

Comments
 (0)