From 8c993ff3c0b760940e87cbe9e0771810967a228a Mon Sep 17 00:00:00 2001 From: Isaac Lee <16869656+ijlee2@users.noreply.github.com> Date: Wed, 28 Aug 2024 10:00:36 +0200 Subject: [PATCH] Standardized codemod (#53) * chore: Updated dependencies and scripts * chore: Added lockfile * chore: Updated import statements * refactor: Renamed variable * chore: Updated script --------- Co-authored-by: ijlee2 --- .npmignore | 4 +- codemod-test-fixture.sh | 44 ----- codemod-test-fixtures.sh | 40 ---- package.json | 14 +- pnpm-lock.yaml | 181 ++++++++++-------- .../ember-cli/template-only-component.ts | 8 +- src/steps/create-registries.ts | 4 +- .../create-registries/create-registry.ts | 6 +- .../create-registries/rename-component.ts | 2 +- .../pass-component-name-to-base-component.ts | 10 +- .../rename-component/update-references.ts | 8 +- src/steps/create-signatures.ts | 4 +- .../create-signatures/create-signature.ts | 2 +- .../pass-signature-to-base-component.ts | 26 +-- .../create-signature/update-constructor.ts | 4 +- .../create-signature/update-reference.ts | 8 +- src/steps/create-template-only-components.ts | 4 +- src/steps/update-signatures.ts | 4 +- .../update-signatures/update-signature.ts | 4 +- update-test-fixtures.sh | 65 +++++++ 20 files changed, 221 insertions(+), 221 deletions(-) delete mode 100755 codemod-test-fixture.sh delete mode 100755 codemod-test-fixtures.sh create mode 100755 update-test-fixtures.sh diff --git a/.npmignore b/.npmignore index fc33b3b..44cf7f7 100644 --- a/.npmignore +++ b/.npmignore @@ -18,8 +18,6 @@ /.prettierignore /.prettierrc.cjs /build.sh -/codemod-test-fixture.sh -/codemod-test-fixtures.sh /CONTRIBUTING.md -/create-test-fixture.sh +/update-test-fixtures.sh /tests/ diff --git a/codemod-test-fixture.sh b/codemod-test-fixture.sh deleted file mode 100755 index a78a4ae..0000000 --- a/codemod-test-fixture.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env sh - -#---------- -# -# A. Purpose -# -# Fix the expected output of a test fixture after updating the source code. -# -# B. Usage -# -# For named arguments, do not include `=` between the flag and the value. -# Positional arguments are to appear at the end. -# -# ./codemod-test-fixture.sh [OPTIONAL-FLAGS] -# -#--------- - -# Get named arguments for the binary -while getopts ":N:" flag -do - case $flag in - N) NAMED_ARGUMENTS=$OPTARG;; - esac -done - -# Get fixture name -FIXTURE=${@:$OPTIND:1} - -if [ ! $FIXTURE ] -then - echo "ERROR: Please specify the fixture name.\n" - exit 1 -elif [ ! -d "tests/fixtures/$FIXTURE/input" ] -then - echo "ERROR: Input folder \`tests/fixtures/$FIXTURE/input\` does not exist.\n" - exit 1 -fi - -rm -r "tests/fixtures/$FIXTURE/output" -cp -r "tests/fixtures/$FIXTURE/input" "tests/fixtures/$FIXTURE/output" - -./dist/bin/ember-codemod-args-to-signature.js $NAMED_ARGUMENTS --root="tests/fixtures/$FIXTURE/output" - -echo "SUCCESS: Updated the output of $FIXTURE.\n" diff --git a/codemod-test-fixtures.sh b/codemod-test-fixtures.sh deleted file mode 100755 index 6883d53..0000000 --- a/codemod-test-fixtures.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env sh - -#---------- -# -# A. Purpose -# -# Fix all test fixtures after updating the source code. -# -# B. Usage -# -# ./codemod-test-fixtures.sh -# -#--------- - -# Compile TypeScript -pnpm build - -./codemod-test-fixture.sh \ - -N "--src app/components" \ - classic-components - -./codemod-test-fixture.sh \ - -N "--src app/components" \ - ember-container-query - -./codemod-test-fixture.sh \ - -N "--src addon/components" \ - ember-container-query-addon - -./codemod-test-fixture.sh \ - -N "--src src/components" \ - ember-container-query-glint - -./codemod-test-fixture.sh \ - -N "--component-structure nested --src app/components" \ - ember-container-query-nested - -./codemod-test-fixture.sh \ - -N "--src app/components" \ - ember-container-query-no-args diff --git a/package.json b/package.json index 7e54d57..20c90f0 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ ], "scripts": { "build": "./build.sh --production", - "lint": "concurrently \"npm:lint:*(!fix)\" --names \"lint:\"", - "lint:fix": "concurrently \"npm:lint:*:fix\" --names \"fix:\"", + "lint": "concurrently 'pnpm:lint:*(!fix)' --names 'lint:'", + "lint:fix": "concurrently 'pnpm:lint:*:fix' --names 'fix:'", "lint:js": "eslint . --cache", "lint:js:fix": "eslint . --fix", "lint:types": "tsc --noEmit", @@ -42,7 +42,7 @@ "@codemod-utils/ast-javascript": "^1.2.8", "@codemod-utils/ast-template": "^1.1.4", "@codemod-utils/blueprints": "^1.1.5", - "@codemod-utils/ember-cli-string": "^1.1.4", + "@codemod-utils/ember": "^2.0.0", "@codemod-utils/files": "^2.0.4", "yargs": "^17.7.2" }, @@ -52,14 +52,14 @@ "@sondr3/minitest": "^0.1.2", "@tsconfig/node18": "^18.2.4", "@tsconfig/strictest": "^2.0.5", - "@types/node": "^18.19.44", + "@types/node": "^18.19.47", "@types/yargs": "^17.0.33", - "@typescript-eslint/eslint-plugin": "^8.1.0", - "@typescript-eslint/parser": "^8.1.0", + "@typescript-eslint/eslint-plugin": "^8.3.0", + "@typescript-eslint/parser": "^8.3.0", "concurrently": "^8.2.2", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", - "eslint-import-resolver-typescript": "^3.6.1", + "eslint-import-resolver-typescript": "^3.6.3", "eslint-plugin-import": "^2.29.1", "eslint-plugin-n": "^17.10.2", "eslint-plugin-prettier": "^5.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a7e8f2..acf56ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,9 +20,9 @@ importers: '@codemod-utils/blueprints': specifier: ^1.1.5 version: 1.1.5 - '@codemod-utils/ember-cli-string': - specifier: ^1.1.4 - version: 1.1.4 + '@codemod-utils/ember': + specifier: ^2.0.0 + version: 2.0.0 '@codemod-utils/files': specifier: ^2.0.4 version: 2.0.4 @@ -46,17 +46,17 @@ importers: specifier: ^2.0.5 version: 2.0.5 '@types/node': - specifier: ^18.19.44 - version: 18.19.44 + specifier: ^18.19.47 + version: 18.19.47 '@types/yargs': specifier: ^17.0.33 version: 17.0.33 '@typescript-eslint/eslint-plugin': - specifier: ^8.1.0 - version: 8.1.0(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4) + specifier: ^8.3.0 + version: 8.3.0(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4) '@typescript-eslint/parser': - specifier: ^8.1.0 - version: 8.1.0(eslint@8.57.0)(typescript@5.5.4) + specifier: ^8.3.0 + version: 8.3.0(eslint@8.57.0)(typescript@5.5.4) concurrently: specifier: ^8.2.2 version: 8.2.2 @@ -67,11 +67,11 @@ importers: specifier: ^9.1.0 version: 9.1.0(eslint@8.57.0) eslint-import-resolver-typescript: - specifier: ^3.6.1 - version: 3.6.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0) + specifier: ^3.6.3 + version: 3.6.3(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0) eslint-plugin-import: specifier: ^2.29.1 - version: 2.29.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) + version: 2.29.1(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) eslint-plugin-n: specifier: ^17.10.2 version: 17.10.2(eslint@8.57.0) @@ -83,7 +83,7 @@ importers: version: 12.1.1(eslint@8.57.0) eslint-plugin-typescript-sort-keys: specifier: ^3.2.0 - version: 3.2.0(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4) + version: 3.2.0(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4) lerna-changelog: specifier: ^2.2.0 version: 2.2.0 @@ -187,8 +187,8 @@ packages: resolution: {integrity: sha512-xNEGw1xp4VjyhwcLiHAnuUhIp3430m0BHl+nfCRXCkWlbCLjIKWsnkywPavK5pUYyp4TnAwVSrNrzHtELQOp7A==} engines: {node: 18.* || >= 20} - '@codemod-utils/ember-cli-string@1.1.4': - resolution: {integrity: sha512-o9xeJJbwn2Sdl/be5E05cFfk6szNL+EWMZvL9JeskSrdaTHgWJxE4/chQ6HvrWudryHXHxAKfXQLRh3Bva5ajA==} + '@codemod-utils/ember@2.0.0': + resolution: {integrity: sha512-p6AeyhxKHoDmvXkS05+8hEU9AJt7cSioVoMSYIjwX6oDRmKfWHiYLaM/AcuKBP/aw2aMi6KyL1sbaCpOJGYL3A==} engines: {node: 18.* || >= 20} '@codemod-utils/files@2.0.4': @@ -293,6 +293,10 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@nolyfill/is-core-module@1.0.39': + resolution: {integrity: sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==} + engines: {node: '>=12.4.0'} + '@npmcli/fs@1.1.1': resolution: {integrity: sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==} @@ -342,8 +346,8 @@ packages: '@types/minimatch@5.1.2': resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==} - '@types/node@18.19.44': - resolution: {integrity: sha512-ZsbGerYg72WMXUIE9fYxtvfzLEuq6q8mKERdWFnqTmOvudMxnz+CBNRoOwJ2kNpFOncrKjT1hZwxjlFgQ9qvQA==} + '@types/node@18.19.47': + resolution: {integrity: sha512-1f7dB3BL/bpd9tnDJrrHb66Y+cVrhxSOTGorRNdHwYTUlTay3HuTDPKo9a/4vX9pMQkhYBcAbL4jQdNlhCFP9A==} '@types/rimraf@3.0.2': resolution: {integrity: sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ==} @@ -357,8 +361,8 @@ packages: '@types/yargs@17.0.33': resolution: {integrity: sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==} - '@typescript-eslint/eslint-plugin@8.1.0': - resolution: {integrity: sha512-LlNBaHFCEBPHyD4pZXb35mzjGkuGKXU5eeCA1SxvHfiRES0E82dOounfVpL4DCqYvJEKab0bZIA0gCRpdLKkCw==} + '@typescript-eslint/eslint-plugin@8.3.0': + resolution: {integrity: sha512-FLAIn63G5KH+adZosDYiutqkOkYEx0nvcwNNfJAf+c7Ae/H35qWwTYvPZUKFj5AS+WfHG/WJJfWnDnyNUlp8UA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: '@typescript-eslint/parser': ^8.0.0 || ^8.0.0-alpha.0 @@ -374,8 +378,8 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - '@typescript-eslint/parser@8.1.0': - resolution: {integrity: sha512-U7iTAtGgJk6DPX9wIWPPOlt1gO57097G06gIcl0N0EEnNw8RGD62c+2/DiP/zL7KrkqnnqF7gtFGR7YgzPllTA==} + '@typescript-eslint/parser@8.3.0': + resolution: {integrity: sha512-h53RhVyLu6AtpUzVCYLPhZGL5jzTD9fZL+SYf/+hYOx2bDkyQXztXSc4tbvKYHzfMXExMLiL9CWqJmVz6+78IQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -388,12 +392,12 @@ packages: resolution: {integrity: sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - '@typescript-eslint/scope-manager@8.1.0': - resolution: {integrity: sha512-DsuOZQji687sQUjm4N6c9xABJa7fjvfIdjqpSIIVOgaENf2jFXiM9hIBZOL3hb6DHK9Nvd2d7zZnoMLf9e0OtQ==} + '@typescript-eslint/scope-manager@8.3.0': + resolution: {integrity: sha512-mz2X8WcN2nVu5Hodku+IR8GgCOl4C0G/Z1ruaWN4dgec64kDBabuXyPAr+/RgJtumv8EEkqIzf3X2U5DUKB2eg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@typescript-eslint/type-utils@8.1.0': - resolution: {integrity: sha512-oLYvTxljVvsMnldfl6jIKxTaU7ok7km0KDrwOt1RHYu6nxlhN3TIx8k5Q52L6wR33nOwDgM7VwW1fT1qMNfFIA==} + '@typescript-eslint/type-utils@8.3.0': + resolution: {integrity: sha512-wrV6qh//nLbfXZQoj32EXKmwHf4b7L+xXLrP3FZ0GOUU72gSvLjeWUl5J5Ue5IwRxIV1TfF73j/eaBapxx99Lg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -405,8 +409,8 @@ packages: resolution: {integrity: sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - '@typescript-eslint/types@8.1.0': - resolution: {integrity: sha512-q2/Bxa0gMOu/2/AKALI0tCKbG2zppccnRIRCW6BaaTlRVaPKft4oVYPp7WOPpcnsgbr0qROAVCVKCvIQ0tbWog==} + '@typescript-eslint/types@8.3.0': + resolution: {integrity: sha512-y6sSEeK+facMaAyixM36dQ5NVXTnKWunfD1Ft4xraYqxP0lC0POJmIaL/mw72CUMqjY9qfyVfXafMeaUj0noWw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@typescript-eslint/typescript-estree@5.62.0': @@ -418,8 +422,8 @@ packages: typescript: optional: true - '@typescript-eslint/typescript-estree@8.1.0': - resolution: {integrity: sha512-NTHhmufocEkMiAord/g++gWKb0Fr34e9AExBRdqgWdVBaKoei2dIyYKD9Q0jBnvfbEA5zaf8plUFMUH6kQ0vGg==} + '@typescript-eslint/typescript-estree@8.3.0': + resolution: {integrity: sha512-Mq7FTHl0R36EmWlCJWojIC1qn/ZWo2YiWYc1XVtasJ7FIgjo0MVv9rZWXEE7IK2CGrtwe1dVOxWwqXUdNgfRCA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: typescript: '*' @@ -433,8 +437,8 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - '@typescript-eslint/utils@8.1.0': - resolution: {integrity: sha512-ypRueFNKTIFwqPeJBfeIpxZ895PQhNyH4YID6js0UoBImWYoSjBsahUn9KMiJXh94uOjVBgHD9AmkyPsPnFwJA==} + '@typescript-eslint/utils@8.3.0': + resolution: {integrity: sha512-F77WwqxIi/qGkIGOGXNBLV7nykwfjLsdauRB/DOFPdv6LTF3BHHkBpq81/b5iMPSF055oO2BiivDJV4ChvNtXA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} peerDependencies: eslint: ^8.57.0 || ^9.0.0 @@ -443,8 +447,8 @@ packages: resolution: {integrity: sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} - '@typescript-eslint/visitor-keys@8.1.0': - resolution: {integrity: sha512-ba0lNI19awqZ5ZNKh6wCModMwoZs457StTebQ0q1NP58zSi2F6MOZRXwfKZy+jB78JNJ/WH8GSh2IQNzXX8Nag==} + '@typescript-eslint/visitor-keys@8.3.0': + resolution: {integrity: sha512-RmZwrTbQ9QveF15m/Cl28n0LXD6ea2CjkhH5rQ55ewz3H24w+AMCJHPVYaZ8/0HoG8Z3cLLFFycRXxeO2tz9FA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} '@ungap/structured-clone@1.2.0': @@ -812,12 +816,18 @@ packages: eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} - eslint-import-resolver-typescript@3.6.1: - resolution: {integrity: sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg==} + eslint-import-resolver-typescript@3.6.3: + resolution: {integrity: sha512-ud9aw4szY9cCT1EWWdGv1L1XR6hh2PaRWif0j2QjQ0pgTY/69iw+W0Z4qZv5wHahOl8isEr+k/JnyAqNQkLkIA==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: eslint: '*' eslint-plugin-import: '*' + eslint-plugin-import-x: '*' + peerDependenciesMeta: + eslint-plugin-import: + optional: true + eslint-plugin-import-x: + optional: true eslint-module-utils@2.8.1: resolution: {integrity: sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==} @@ -1184,6 +1194,9 @@ packages: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} + is-bun-module@1.1.0: + resolution: {integrity: sha512-4mTAVPlrXpaN3jtF0lsnPCMGnq4+qZjVIKq0HCpfcqf8OC1SM5oATCIAPM5V5FN05qp2NNnFndphmdZS9CV3hA==} + is-callable@1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} engines: {node: '>= 0.4'} @@ -2116,7 +2129,7 @@ snapshots: dependencies: lodash: 4.17.21 - '@codemod-utils/ember-cli-string@1.1.4': {} + '@codemod-utils/ember@2.0.0': {} '@codemod-utils/files@2.0.4': dependencies: @@ -2241,6 +2254,8 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 + '@nolyfill/is-core-module@1.0.39': {} + '@npmcli/fs@1.1.1': dependencies: '@gar/promisify': 1.1.3 @@ -2268,12 +2283,12 @@ snapshots: '@types/fs-extra@9.0.13': dependencies: - '@types/node': 18.19.44 + '@types/node': 18.19.47 '@types/glob@8.1.0': dependencies: '@types/minimatch': 5.1.2 - '@types/node': 18.19.44 + '@types/node': 18.19.47 '@types/json-schema@7.0.15': {} @@ -2281,14 +2296,14 @@ snapshots: '@types/minimatch@5.1.2': {} - '@types/node@18.19.44': + '@types/node@18.19.47': dependencies: undici-types: 5.26.5 '@types/rimraf@3.0.2': dependencies: '@types/glob': 8.1.0 - '@types/node': 18.19.44 + '@types/node': 18.19.47 '@types/semver@7.5.8': {} @@ -2298,14 +2313,14 @@ snapshots: dependencies: '@types/yargs-parser': 21.0.3 - '@typescript-eslint/eslint-plugin@8.1.0(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/eslint-plugin@8.3.0(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@eslint-community/regexpp': 4.11.0 - '@typescript-eslint/parser': 8.1.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/scope-manager': 8.1.0 - '@typescript-eslint/type-utils': 8.1.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/utils': 8.1.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.1.0 + '@typescript-eslint/parser': 8.3.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.3.0 + '@typescript-eslint/type-utils': 8.3.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/utils': 8.3.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.3.0 eslint: 8.57.0 graphemer: 1.4.0 ignore: 5.3.2 @@ -2324,12 +2339,12 @@ snapshots: - supports-color - typescript - '@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4)': dependencies: - '@typescript-eslint/scope-manager': 8.1.0 - '@typescript-eslint/types': 8.1.0 - '@typescript-eslint/typescript-estree': 8.1.0(typescript@5.5.4) - '@typescript-eslint/visitor-keys': 8.1.0 + '@typescript-eslint/scope-manager': 8.3.0 + '@typescript-eslint/types': 8.3.0 + '@typescript-eslint/typescript-estree': 8.3.0(typescript@5.5.4) + '@typescript-eslint/visitor-keys': 8.3.0 debug: 4.3.6 eslint: 8.57.0 optionalDependencies: @@ -2342,15 +2357,15 @@ snapshots: '@typescript-eslint/types': 5.62.0 '@typescript-eslint/visitor-keys': 5.62.0 - '@typescript-eslint/scope-manager@8.1.0': + '@typescript-eslint/scope-manager@8.3.0': dependencies: - '@typescript-eslint/types': 8.1.0 - '@typescript-eslint/visitor-keys': 8.1.0 + '@typescript-eslint/types': 8.3.0 + '@typescript-eslint/visitor-keys': 8.3.0 - '@typescript-eslint/type-utils@8.1.0(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/type-utils@8.3.0(eslint@8.57.0)(typescript@5.5.4)': dependencies: - '@typescript-eslint/typescript-estree': 8.1.0(typescript@5.5.4) - '@typescript-eslint/utils': 8.1.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/typescript-estree': 8.3.0(typescript@5.5.4) + '@typescript-eslint/utils': 8.3.0(eslint@8.57.0)(typescript@5.5.4) debug: 4.3.6 ts-api-utils: 1.3.0(typescript@5.5.4) optionalDependencies: @@ -2361,7 +2376,7 @@ snapshots: '@typescript-eslint/types@5.62.0': {} - '@typescript-eslint/types@8.1.0': {} + '@typescript-eslint/types@8.3.0': {} '@typescript-eslint/typescript-estree@5.62.0(typescript@5.5.4)': dependencies: @@ -2377,12 +2392,12 @@ snapshots: transitivePeerDependencies: - supports-color - '@typescript-eslint/typescript-estree@8.1.0(typescript@5.5.4)': + '@typescript-eslint/typescript-estree@8.3.0(typescript@5.5.4)': dependencies: - '@typescript-eslint/types': 8.1.0 - '@typescript-eslint/visitor-keys': 8.1.0 + '@typescript-eslint/types': 8.3.0 + '@typescript-eslint/visitor-keys': 8.3.0 debug: 4.3.6 - globby: 11.1.0 + fast-glob: 3.3.2 is-glob: 4.0.3 minimatch: 9.0.5 semver: 7.6.3 @@ -2407,12 +2422,12 @@ snapshots: - supports-color - typescript - '@typescript-eslint/utils@8.1.0(eslint@8.57.0)(typescript@5.5.4)': + '@typescript-eslint/utils@8.3.0(eslint@8.57.0)(typescript@5.5.4)': dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) - '@typescript-eslint/scope-manager': 8.1.0 - '@typescript-eslint/types': 8.1.0 - '@typescript-eslint/typescript-estree': 8.1.0(typescript@5.5.4) + '@typescript-eslint/scope-manager': 8.3.0 + '@typescript-eslint/types': 8.3.0 + '@typescript-eslint/typescript-estree': 8.3.0(typescript@5.5.4) eslint: 8.57.0 transitivePeerDependencies: - supports-color @@ -2423,9 +2438,9 @@ snapshots: '@typescript-eslint/types': 5.62.0 eslint-visitor-keys: 3.4.3 - '@typescript-eslint/visitor-keys@8.1.0': + '@typescript-eslint/visitor-keys@8.3.0': dependencies: - '@typescript-eslint/types': 8.1.0 + '@typescript-eslint/types': 8.3.0 eslint-visitor-keys: 3.4.3 '@ungap/structured-clone@1.2.0': {} @@ -2897,31 +2912,33 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0): + eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0): dependencies: + '@nolyfill/is-core-module': 1.0.39 debug: 4.3.6 enhanced-resolve: 5.17.1 eslint: 8.57.0 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) - eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) fast-glob: 3.3.2 get-tsconfig: 4.7.6 - is-core-module: 2.15.0 + is-bun-module: 1.1.0 is-glob: 4.0.3 + optionalDependencies: + eslint-plugin-import: 2.29.1(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0) transitivePeerDependencies: - '@typescript-eslint/parser' - eslint-import-resolver-node - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.8.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0): + eslint-module-utils@2.8.1(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.1.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.3.0(eslint@8.57.0)(typescript@5.5.4) eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0) + eslint-import-resolver-typescript: 3.6.3(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0) transitivePeerDependencies: - supports-color @@ -2932,7 +2949,7 @@ snapshots: eslint: 8.57.0 eslint-compat-utils: 0.5.1(eslint@8.57.0) - eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.1)(eslint@8.57.0): + eslint-plugin-import@2.29.1(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-typescript@3.6.3)(eslint@8.57.0): dependencies: array-includes: 3.1.8 array.prototype.findlastindex: 1.2.5 @@ -2942,7 +2959,7 @@ snapshots: doctrine: 2.1.0 eslint: 8.57.0 eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.1(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) + eslint-module-utils: 2.8.1(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint-plugin-import@2.29.1)(eslint@8.57.0))(eslint@8.57.0) hasown: 2.0.2 is-core-module: 2.15.0 is-glob: 4.0.3 @@ -2953,7 +2970,7 @@ snapshots: semver: 6.3.1 tsconfig-paths: 4.2.0 optionalDependencies: - '@typescript-eslint/parser': 8.1.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.3.0(eslint@8.57.0)(typescript@5.5.4) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -2984,10 +3001,10 @@ snapshots: dependencies: eslint: 8.57.0 - eslint-plugin-typescript-sort-keys@3.2.0(@typescript-eslint/parser@8.1.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4): + eslint-plugin-typescript-sort-keys@3.2.0(@typescript-eslint/parser@8.3.0(eslint@8.57.0)(typescript@5.5.4))(eslint@8.57.0)(typescript@5.5.4): dependencies: '@typescript-eslint/experimental-utils': 5.62.0(eslint@8.57.0)(typescript@5.5.4) - '@typescript-eslint/parser': 8.1.0(eslint@8.57.0)(typescript@5.5.4) + '@typescript-eslint/parser': 8.3.0(eslint@8.57.0)(typescript@5.5.4) eslint: 8.57.0 json-schema: 0.4.0 natural-compare-lite: 1.4.0 @@ -3349,6 +3366,10 @@ snapshots: call-bind: 1.0.7 has-tostringtag: 1.0.2 + is-bun-module@1.1.0: + dependencies: + semver: 7.6.3 + is-callable@1.2.7: {} is-core-module@2.15.0: diff --git a/src/blueprints/ember-cli/template-only-component.ts b/src/blueprints/ember-cli/template-only-component.ts index 42f38a7..3aa00cb 100644 --- a/src/blueprints/ember-cli/template-only-component.ts +++ b/src/blueprints/ember-cli/template-only-component.ts @@ -1,8 +1,8 @@ import templateOnlyComponent from '@ember/component/template-only'; -interface <%= entity.classifiedName %>Signature {} +interface <%= entity.pascalizedName %>Signature {} -const <%= entity.classifiedName %>Component = - templateOnlyComponent<<%= entity.classifiedName %>Signature>(); +const <%= entity.pascalizedName %>Component = + templateOnlyComponent<<%= entity.pascalizedName %>Signature>(); -export default <%= entity.classifiedName %>Component; +export default <%= entity.pascalizedName %>Component; diff --git a/src/steps/create-registries.ts b/src/steps/create-registries.ts index 2bdfeac..9d3b459 100644 --- a/src/steps/create-registries.ts +++ b/src/steps/create-registries.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs'; import { join } from 'node:path'; -import { classify, doubleColonize } from '@codemod-utils/ember-cli-string'; +import { doubleColonize, pascalize } from '@codemod-utils/ember'; import { createFiles, type FileContent, @@ -26,9 +26,9 @@ export function createRegistries(context: Context, options: Options): void { const data = { entity: { - classifiedName: classify(entityName), doubleColonizedName: doubleColonize(entityName), name: entityName, + pascalizedName: pascalize(entityName), }, }; diff --git a/src/steps/create-registries/create-registry.ts b/src/steps/create-registries/create-registry.ts index 882c989..42db618 100644 --- a/src/steps/create-registries/create-registry.ts +++ b/src/steps/create-registries/create-registry.ts @@ -2,9 +2,9 @@ import { AST } from '@codemod-utils/ast-javascript'; type Data = { entity: { - classifiedName: string; doubleColonizedName: string; name: string; + pascalizedName: string; }; }; @@ -21,7 +21,7 @@ export function createRegistry(file: string, data: Data): string { AST.builders.stringLiteral(data.entity.doubleColonizedName), AST.builders.tsTypeAnnotation( AST.builders.tsTypeQuery( - AST.builders.identifier(`${data.entity.classifiedName}Component`), + AST.builders.identifier(`${data.entity.pascalizedName}Component`), ), ), ), @@ -29,7 +29,7 @@ export function createRegistry(file: string, data: Data): string { AST.builders.stringLiteral(data.entity.name), AST.builders.tsTypeAnnotation( AST.builders.tsTypeQuery( - AST.builders.identifier(`${data.entity.classifiedName}Component`), + AST.builders.identifier(`${data.entity.pascalizedName}Component`), ), ), ), diff --git a/src/steps/create-registries/rename-component.ts b/src/steps/create-registries/rename-component.ts index 29ad6fc..7142ba3 100644 --- a/src/steps/create-registries/rename-component.ts +++ b/src/steps/create-registries/rename-component.ts @@ -6,7 +6,7 @@ import { type Data = { entity: { - classifiedName: string; + pascalizedName: string; }; }; diff --git a/src/steps/create-registries/rename-component/pass-component-name-to-base-component.ts b/src/steps/create-registries/rename-component/pass-component-name-to-base-component.ts index 463cc62..22b930c 100644 --- a/src/steps/create-registries/rename-component/pass-component-name-to-base-component.ts +++ b/src/steps/create-registries/rename-component/pass-component-name-to-base-component.ts @@ -4,7 +4,7 @@ type Options = { baseComponentName: string; data: { entity: { - classifiedName: string; + pascalizedName: string; }; }; }; @@ -33,14 +33,14 @@ export function passComponentNameToBaseComponent( if (!path.node.id) { path.node.id = AST.builders.identifier( - `${data.entity.classifiedName}Component`, + `${data.entity.pascalizedName}Component`, ); return false; } componentName = path.node.id.name as string; - path.node.id.name = `${data.entity.classifiedName}Component`; + path.node.id.name = `${data.entity.pascalizedName}Component`; return false; }, @@ -63,7 +63,7 @@ export function passComponentNameToBaseComponent( } componentName = declaration.id.name; - declaration.id.name = `${data.entity.classifiedName}Component`; + declaration.id.name = `${data.entity.pascalizedName}Component`; return false; } @@ -79,7 +79,7 @@ export function passComponentNameToBaseComponent( } componentName = declaration.id.name; - declaration.id.name = `${data.entity.classifiedName}Component`; + declaration.id.name = `${data.entity.pascalizedName}Component`; return false; } diff --git a/src/steps/create-registries/rename-component/update-references.ts b/src/steps/create-registries/rename-component/update-references.ts index b4c4fa8..39673cf 100644 --- a/src/steps/create-registries/rename-component/update-references.ts +++ b/src/steps/create-registries/rename-component/update-references.ts @@ -5,7 +5,7 @@ type Options = { componentName: string; data: { entity: { - classifiedName: string; + pascalizedName: string; }; }; }; @@ -29,7 +29,7 @@ export function updateReferences(file: string, options: Options): string { const nodesToAdd = [ AST.builders.noop(), AST.builders.exportDefaultDeclaration( - AST.builders.identifier(`${data.entity.classifiedName}Component`), + AST.builders.identifier(`${data.entity.pascalizedName}Component`), ), ]; @@ -37,7 +37,7 @@ export function updateReferences(file: string, options: Options): string { return AST.builders.variableDeclaration('const', [ AST.builders.variableDeclarator( - AST.builders.identifier(`${data.entity.classifiedName}Component`), + AST.builders.identifier(`${data.entity.pascalizedName}Component`), path.node.declaration, ), ]); @@ -48,7 +48,7 @@ export function updateReferences(file: string, options: Options): string { return false; } - path.node.declaration.name = `${data.entity.classifiedName}Component`; + path.node.declaration.name = `${data.entity.pascalizedName}Component`; return false; } diff --git a/src/steps/create-signatures.ts b/src/steps/create-signatures.ts index 9283619..b6bdccd 100644 --- a/src/steps/create-signatures.ts +++ b/src/steps/create-signatures.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs'; import { join } from 'node:path'; -import { classify } from '@codemod-utils/ember-cli-string'; +import { pascalize } from '@codemod-utils/ember'; import { createFiles, type FileContent, @@ -22,7 +22,7 @@ export function createSignatures(context: Context, options: Options): void { const data = { entity: { - classifiedName: classify(entityName), + pascalizedName: pascalize(entityName), }, }; diff --git a/src/steps/create-signatures/create-signature.ts b/src/steps/create-signatures/create-signature.ts index 820c488..4878c5b 100644 --- a/src/steps/create-signatures/create-signature.ts +++ b/src/steps/create-signatures/create-signature.ts @@ -7,7 +7,7 @@ import { type Data = { entity: { - classifiedName: string; + pascalizedName: string; }; }; diff --git a/src/steps/create-signatures/create-signature/pass-signature-to-base-component.ts b/src/steps/create-signatures/create-signature/pass-signature-to-base-component.ts index c1bdf0b..15e8915 100644 --- a/src/steps/create-signatures/create-signature/pass-signature-to-base-component.ts +++ b/src/steps/create-signatures/create-signature/pass-signature-to-base-component.ts @@ -11,7 +11,7 @@ type Options = { baseComponentName: string; data: { entity: { - classifiedName: string; + pascalizedName: string; }; }; }; @@ -46,7 +46,7 @@ export function passSignatureToBaseComponent( switch (path.parentPath.node.type) { case 'ExportDefaultDeclaration': { - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.parentPath.name; path.parentPath.parentPath.value.splice( @@ -62,7 +62,7 @@ export function passSignatureToBaseComponent( } case 'VariableDeclarator': { - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.parentPath.parentPath.parentPath.name; path.parentPath.parentPath.parentPath.parentPath.value.splice( @@ -92,7 +92,7 @@ export function passSignatureToBaseComponent( switch (path.parentPath.node.type) { case 'ExportDefaultDeclaration': { - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.parentPath.name; path.parentPath.parentPath.value.splice( @@ -108,7 +108,7 @@ export function passSignatureToBaseComponent( } case 'VariableDeclarator': { - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.parentPath.parentPath.parentPath.name; path.parentPath.parentPath.parentPath.parentPath.value.splice( @@ -129,7 +129,7 @@ export function passSignatureToBaseComponent( // When the interface is defined "outside" case 'TSTypeReference': { - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; interfaceName = typeParameter.typeName.name; typeParameter.typeName.name = identifier; @@ -158,7 +158,7 @@ export function passSignatureToBaseComponent( switch (path.parentPath.node.type) { case 'ExportDefaultDeclaration': { - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.parentPath.name; path.parentPath.parentPath.value.splice( @@ -173,7 +173,7 @@ export function passSignatureToBaseComponent( } case 'Program': { - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.name; path.parentPath.value.splice( @@ -200,7 +200,7 @@ export function passSignatureToBaseComponent( ? typeParameter.members : builderConvertArgsToSignature(typeParameter.members); - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.parentPath.name; path.parentPath.parentPath.value.splice( @@ -220,7 +220,7 @@ export function passSignatureToBaseComponent( break; } - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; interfaceName = typeParameter.typeName.name; typeParameter.typeName.name = identifier; @@ -248,7 +248,7 @@ export function passSignatureToBaseComponent( switch (path.parentPath.node.type) { case 'VariableDeclarator': { - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.parentPath.parentPath.parentPath.name; path.parentPath.parentPath.parentPath.parentPath.value.splice( @@ -275,7 +275,7 @@ export function passSignatureToBaseComponent( ? typeParameter.members : builderConvertArgsToSignature(typeParameter.members); - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const index = path.parentPath.parentPath.parentPath.name; path.parentPath.parentPath.parentPath.parentPath.value.splice( @@ -295,7 +295,7 @@ export function passSignatureToBaseComponent( break; } - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; interfaceName = typeParameter.typeName.name; typeParameter.typeName.name = identifier; diff --git a/src/steps/create-signatures/create-signature/update-constructor.ts b/src/steps/create-signatures/create-signature/update-constructor.ts index ee4a945..f2c4c4e 100644 --- a/src/steps/create-signatures/create-signature/update-constructor.ts +++ b/src/steps/create-signatures/create-signature/update-constructor.ts @@ -3,7 +3,7 @@ import { AST } from '@codemod-utils/ast-javascript'; type Options = { data: { entity: { - classifiedName: string; + pascalizedName: string; }; }; }; @@ -28,7 +28,7 @@ export function updateConstructor(file: string, options: Options): string { args.typeAnnotation = AST.builders.tsTypeAnnotation( AST.builders.tsIndexedAccessType( AST.builders.tsTypeReference( - AST.builders.identifier(`${data.entity.classifiedName}Signature`), + AST.builders.identifier(`${data.entity.pascalizedName}Signature`), ), AST.builders.tsLiteralType(AST.builders.stringLiteral('Args')), ), diff --git a/src/steps/create-signatures/create-signature/update-reference.ts b/src/steps/create-signatures/create-signature/update-reference.ts index 9293880..30a5100 100644 --- a/src/steps/create-signatures/create-signature/update-reference.ts +++ b/src/steps/create-signatures/create-signature/update-reference.ts @@ -9,7 +9,7 @@ import { isSignature } from './is-signature.js'; type Options = { data: { entity: { - classifiedName: string; + pascalizedName: string; }; }; interfaceName: string; @@ -33,7 +33,7 @@ export function updateReferences(file: string, options: Options): string { ? path.node.body.body : builderConvertArgsToSignature(path.node.body.body); - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; return builderCreateSignature(identifier, members); }, @@ -51,7 +51,7 @@ export function updateReferences(file: string, options: Options): string { ? path.node.typeAnnotation.members : builderConvertArgsToSignature(path.node.typeAnnotation.members); - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; return builderCreateSignature(identifier, members); }, @@ -65,7 +65,7 @@ export function updateReferences(file: string, options: Options): string { return false; } - path.node.typeName.name = `${data.entity.classifiedName}Signature['Args']`; + path.node.typeName.name = `${data.entity.pascalizedName}Signature['Args']`; return false; }, diff --git a/src/steps/create-template-only-components.ts b/src/steps/create-template-only-components.ts index c312176..95177d4 100644 --- a/src/steps/create-template-only-components.ts +++ b/src/steps/create-template-only-components.ts @@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs'; import { join } from 'node:path'; import { processTemplate } from '@codemod-utils/blueprints'; -import { classify } from '@codemod-utils/ember-cli-string'; +import { pascalize } from '@codemod-utils/ember'; import { createFiles, type FileContent, @@ -35,7 +35,7 @@ export function createTemplateOnlyComponents( const data = { entity: { - classifiedName: classify(entityName), + pascalizedName: pascalize(entityName), }, }; diff --git a/src/steps/update-signatures.ts b/src/steps/update-signatures.ts index 747b903..0a2fe2b 100644 --- a/src/steps/update-signatures.ts +++ b/src/steps/update-signatures.ts @@ -1,7 +1,7 @@ import { readFileSync } from 'node:fs'; import { join } from 'node:path'; -import { classify } from '@codemod-utils/ember-cli-string'; +import { pascalize } from '@codemod-utils/ember'; import { createFiles, type FileContent, @@ -22,7 +22,7 @@ export function updateSignatures(context: Context, options: Options): void { const data = { entity: { - classifiedName: classify(entityName), + pascalizedName: pascalize(entityName), }, signature, }; diff --git a/src/steps/update-signatures/update-signature.ts b/src/steps/update-signatures/update-signature.ts index e2b73f1..5ea221a 100644 --- a/src/steps/update-signatures/update-signature.ts +++ b/src/steps/update-signatures/update-signature.ts @@ -9,7 +9,7 @@ import { type Data = { entity: { - classifiedName: string; + pascalizedName: string; }; signature: Signature; }; @@ -28,7 +28,7 @@ function getBodyNode(node: unknown, key: 'Args' | 'Blocks' | 'Element') { export function updateSignature(file: string, data: Data): string { const traverse = AST.traverse(true); - const identifier = `${data.entity.classifiedName}Signature`; + const identifier = `${data.entity.pascalizedName}Signature`; const ast = traverse(file, { visitTSInterfaceDeclaration(path) { diff --git a/update-test-fixtures.sh b/update-test-fixtures.sh new file mode 100755 index 0000000..17a97e3 --- /dev/null +++ b/update-test-fixtures.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env sh + +#---------- +# +# A. Purpose +# +# Fix all test fixtures after updating the source code. +# +# B. Usage +# +# ./codemod-test-fixtures.sh +# +#--------- + +# Compile TypeScript +pnpm build + +# Update fixtures +rm -r "tests/fixtures/classic-components/output" +cp -r "tests/fixtures/classic-components/input" "tests/fixtures/classic-components/output" + +./dist/bin/ember-codemod-args-to-signature.js \ + --root "tests/fixtures/classic-components/output" \ + --src "app/components" + +# Update fixtures +rm -r "tests/fixtures/ember-container-query/output" +cp -r "tests/fixtures/ember-container-query/input" "tests/fixtures/ember-container-query/output" + +./dist/bin/ember-codemod-args-to-signature.js \ + --root "tests/fixtures/ember-container-query/output" \ + --src "app/components" + +# Update fixtures +rm -r "tests/fixtures/ember-container-query-addon/output" +cp -r "tests/fixtures/ember-container-query-addon/input" "tests/fixtures/ember-container-query-addon/output" + +./dist/bin/ember-codemod-args-to-signature.js \ + --root "tests/fixtures/ember-container-query-addon/output" \ + --src "addon/components" + +# Update fixtures +rm -r "tests/fixtures/ember-container-query-glint/output" +cp -r "tests/fixtures/ember-container-query-glint/input" "tests/fixtures/ember-container-query-glint/output" + +./dist/bin/ember-codemod-args-to-signature.js \ + --root "tests/fixtures/ember-container-query-glint/output" \ + --src "src/components" + +# Update fixtures +rm -r "tests/fixtures/ember-container-query-nested/output" +cp -r "tests/fixtures/ember-container-query-nested/input" "tests/fixtures/ember-container-query-nested/output" + +./dist/bin/ember-codemod-args-to-signature.js \ + --component-structure nested \ + --root "tests/fixtures/ember-container-query-nested/output" \ + --src "app/components" + +# Update fixtures +rm -r "tests/fixtures/ember-container-query-no-args/output" +cp -r "tests/fixtures/ember-container-query-no-args/input" "tests/fixtures/ember-container-query-no-args/output" + +./dist/bin/ember-codemod-args-to-signature.js \ + --root "tests/fixtures/ember-container-query-no-args/output" \ + --src "app/components"