diff --git a/.github/scripts/pr-prefixes.ts b/.github/scripts/pr-prefixes.ts index 5a8fb7d9..b9849657 100644 --- a/.github/scripts/pr-prefixes.ts +++ b/.github/scripts/pr-prefixes.ts @@ -10,4 +10,4 @@ export const SUPPORTED_PREFIXES = [ 'test', ] as const; -export const SCOPE_RGX = new RegExp(`^(${SUPPORTED_PREFIXES.join('|')})\\([\\w\\-\\d]*\\)\\: `); +export const SCOPE_RGX = new RegExp(`^(${SUPPORTED_PREFIXES.join('|')})\\(\\S[^)]*\\): [^\\n]*$`); diff --git a/.github/scripts/pr-title.test.ts b/.github/scripts/pr-title.test.ts index 37116784..1c23456a 100644 --- a/.github/scripts/pr-title.test.ts +++ b/.github/scripts/pr-title.test.ts @@ -11,69 +11,247 @@ describe('Pull Request checks', { concurrency: true }, async () => { const encoding = 'utf8'; const prTestPath = fileURLToPath(import.meta.resolve('./pr-title.ts')); - for (const prefix of SUPPORTED_PREFIXES) { - describe(prefix, () => { - it('should pass when valid', async () => { - const { code, stderr } = await spawnPromisified( - execPath, - [prTestPath], - { - encoding, - env: { PR_TITLE: `${prefix}(DEP0000): update …` }, - }, - ); - - equal(stderr, ''); - equal(code, 0); - }); + const runCheck = async (title: string) => + spawnPromisified(execPath, [prTestPath], { + encoding, + env: { PR_TITLE: title }, + }); - it('should fail when missing scope', async () => { - const { code, stderr } = await spawnPromisified( - execPath, - [prTestPath], - { - encoding, - env: { PR_TITLE: `${prefix}: update …` }, - }, - ); - - match(stderr, /AssertionError/); - match(stderr, new RegExp(prefix)); - match(stderr, /pull request title/i); - equal(code, 1); - }); + const assertPass = async (title: string) => { + const { code, stderr } = await runCheck(title); - it('should fail scope is misformatted', async () => { - const { code, stderr } = await spawnPromisified( - execPath, - [prTestPath], - { - encoding, - env: { PR_TITLE: `${prefix}(DEP0000) update …` }, - }, - ); - - match(stderr, /AssertionError/); - match(stderr, new RegExp(prefix)); - match(stderr, /pull request title/i); - equal(code, 1); + equal(stderr, ''); + equal(code, 0); + }; + + const assertFail = async (title: string) => { + const { code, stderr } = await runCheck(title); + + match(stderr, /AssertionError/); + match(stderr, /pull request title/i); + equal(code, 1); + }; + + describe('supported prefixes', () => { + for (const prefix of SUPPORTED_PREFIXES) { + describe(prefix, () => { + it('passes with valid scope', async () => { + await assertPass( + `${prefix}(DEP0000): update dependency`, + ); + }); + + it('passes with normal scope', async () => { + await assertPass( + `${prefix}(api): update endpoint`, + ); + }); + + it('passes with numeric scope', async () => { + await assertPass( + `${prefix}(v2): update API`, + ); + }); + + it('fails without scope', async () => { + await assertFail( + `${prefix}: update dependency`, + ); + }); + + it('fails without colon', async () => { + await assertFail( + `${prefix}(api) update dependency`, + ); + }); + + it('fails without space after colon', async () => { + await assertFail( + `${prefix}(api):update dependency`, + ); + }); + + it('fails with empty scope', async () => { + await assertFail( + `${prefix}(): update dependency`, + ); + }); }); + } + }); + + describe('scope formats', () => { + it('allows package.json scopes', async () => { + await assertPass( + 'setup(package.json): reduce amount of code to maintain', + ); }); - } - describe('unsupported prefix', () => { - it('should fail', async () => { - const prefix = 'foo'; - const { code, stderr } = await spawnPromisified(execPath, [prTestPath], { - encoding, - env: { PR_TITLE: `${prefix}(DEP0000): update …` }, - }); + it('allows dotted scopes', async () => { + await assertPass( + 'fix(node.test.ts): update tests', + ); + }); + + it('allows kebab-case scopes', async () => { + await assertPass( + 'feat(my-feature): add feature', + ); + }); + + it('allows snake_case scopes', async () => { + await assertPass( + 'fix(my_module): update module', + ); + }); + + it('allows backticks in scopes', async () => { + await assertPass( + 'feat(`foo`): introduced', + ); + }); + + it('allows npm package scopes', async () => { + await assertPass( + 'dep(@scope/pkg): update package', + ); + }); + + it('allows slash-separated scopes', async () => { + await assertPass( + 'fix(api/users): fix endpoint', + ); + }); + + it('allows long scopes', async () => { + await assertPass( + 'feat(very-long-package-name-that-is-used-by-the-app): cleanup', + ); + }); + }); + + describe('invalid scope formats', () => { + it('fails with missing opening parenthesis', async () => { + await assertFail( + 'featapi): add feature', + ); + }); + + it('fails with missing closing parenthesis', async () => { + await assertFail( + 'feat(api: add feature', + ); + }); + + it('fails with extra closing parenthesis', async () => { + await assertFail( + 'feat(api)): add feature', + ); + }); + + it('fails with whitespace-only scope', async () => { + await assertFail( + 'feat( ): add feature', + ); + }); + + it('fails with newline in title', async () => { + await assertFail( + 'feat(api): add feature\nsecond line', + ); + }); + }); + + describe('description formats', () => { + it('allows empty description', async () => { + await assertPass( + 'feat(api): ', + ); + }); + + it('allows punctuation', async () => { + await assertPass( + 'feat(api): update API, remove old behavior.', + ); + }); + + it('allows unicode', async () => { + await assertPass( + 'feat(api): improve documentation 🚀', + ); + }); + + it('allows numbers', async () => { + await assertPass( + 'fix(api): fix issue #1234', + ); + }); + }); + + describe('prefix validation', () => { + it('fails for unsupported prefix', async () => { + const { code, stderr } = await runCheck( + 'foo(api): update dependency', + ); match(stderr, /AssertionError/); - match(stderr, new RegExp(prefix)); - match(stderr, /pull request title/i); - for (const p of SUPPORTED_PREFIXES) match(stderr, new RegExp(p)); + match(stderr, /foo/); + + for (const prefix of SUPPORTED_PREFIXES) { + match(stderr, new RegExp(prefix)); + } + equal(code, 1); }); - }) + + it('fails with uppercase prefix', async () => { + await assertFail( + 'Feat(api): update feature', + ); + }); + + it('fails with leading whitespace', async () => { + await assertFail( + ' feat(api): update feature', + ); + }); + + it('fails with whitespace before scope', async () => { + await assertFail( + 'feat (api): update feature', + ); + }); + }); + + describe('real world examples', () => { + it('accepts setup(package.json)', async () => { + await assertPass( + 'setup(package.json): reduce amount of code to maintain', + ); + }); + + it('accepts feat(`foo`)', async () => { + await assertPass( + 'feat(`foo`): introduced', + ); + }); + + it('accepts dependency updates', async () => { + await assertPass( + 'dep(typescript): update to latest version', + ); + }); + + it('accepts documentation updates', async () => { + await assertPass( + 'doc(readme): improve examples', + ); + }); + + it('accepts test updates', async () => { + await assertPass( + 'test(pr-title): improve coverage', + ); + }); + }); }); diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 33ace462..caa3a114 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,6 @@ Each codemod resides in its own directory under `recipes/` and should include: | `codemod.yml` | Codemod manifest file | | `workflow.yml` | Workflow definition file | | `tests/` | Test suite using `jssg` testing utilities | -| `tsconfig.json` | TypeScript configuration | > [!NOTE] > The `workflow.ts` naming is conventional but can be changed as needed. Ensure to update the `workflow.yml` accordingly. We use `workflow` when there are one step codemods; for multi-step codemods, consider using `what-to-change.ts` or similar descriptive names. @@ -149,6 +148,20 @@ registry: visibility: public ``` +**`package.json` example:** +```json +{ + "name": "@nodejs/", + "type": "module", + "scripts": { + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" + }, + "devDependencies": { + "@nodejs/codemod-utils": "^*" + } +} +``` + ## Useful Resources - [Codemod CLI Reference](https://docs.codemod.com/cli/cli-reference) diff --git a/package-lock.json b/package-lock.json index a4deddbf..7fa0a832 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,10 @@ { "name": "userland-migrations", - "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "userland-migrations", - "version": "1.0.0", - "license": "MIT", "workspaces": [ "./recipes/*", "utils", @@ -609,8 +606,6 @@ }, "node_modules/@typescript/typescript-darwin-arm64": { "version": "7.0.2", - "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", - "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", "cpu": [ "arm64" ], @@ -946,8 +941,6 @@ }, "node_modules/typescript": { "version": "7.0.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", - "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", "dev": true, "license": "Apache-2.0", "bin": { @@ -981,15 +974,11 @@ }, "node_modules/undici-types": { "version": "8.3.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz", - "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==", "dev": true, "license": "MIT" }, "recipes/axios-to-whatwg-fetch": { "name": "@nodejs/axios-to-whatwg-fetch", - "version": "1.0.0", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*", "dedent": "^1.7.0" @@ -1000,8 +989,6 @@ }, "recipes/buffer-atob-btoa": { "name": "@nodejs/buffer-atob-btoa", - "version": "1.0.1", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1011,8 +998,6 @@ }, "recipes/chalk-to-util-styletext": { "name": "@nodejs/chalk-to-util-styletext", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1022,8 +1007,6 @@ }, "recipes/create-require-from-path": { "name": "@nodejs/create-require-from-path", - "version": "1.1.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1033,8 +1016,6 @@ }, "recipes/createCredentials-to-createSecureContext": { "name": "@nodejs/createcredentials-to-createsecurecontext", - "version": "1.0.1", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1044,8 +1025,6 @@ }, "recipes/crypto-createcipheriv-migration": { "name": "@nodejs/crypto-createcipheriv-migration", - "version": "1.0.0", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*", "dedent": "^1.7.1" @@ -1056,8 +1035,6 @@ }, "recipes/crypto-fips-to-getFips": { "name": "@nodejs/crypto-fips-to-getFips", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1067,8 +1044,6 @@ }, "recipes/crypto-rsa-pss-update": { "name": "@nodejs/crypto-rsa-pss-update", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1078,8 +1053,6 @@ }, "recipes/dirent-path-to-parent-path": { "name": "@nodejs/dirent-path-to-parent-path", - "version": "1.0.1", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1100,8 +1073,6 @@ }, "recipes/err-invalid-callback": { "name": "@nodejs/err-invalid-callback", - "version": "1.0.0", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1111,8 +1082,6 @@ }, "recipes/fs-access-mode-constants": { "name": "@nodejs/fs-access-mode-constants", - "version": "1.0.3", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1123,8 +1092,6 @@ }, "recipes/fs-truncate-fd-deprecation": { "name": "@nodejs/fs-truncate-fd-deprecation", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1134,8 +1101,6 @@ }, "recipes/http-classes-with-new": { "name": "@nodejs/http-classes-with-new", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1145,8 +1110,6 @@ }, "recipes/http-outgoingmessage-headers": { "name": "@nodejs/http-outgoingmessage-headers", - "version": "1.0.0", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1156,8 +1119,6 @@ }, "recipes/http2-priority-signaling": { "name": "@nodejs/http2-priority-signaling", - "version": "1.0.0", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1167,27 +1128,18 @@ }, "recipes/import-assertions-to-attributes": { "name": "@nodejs/import-assertions-to-attributes", - "version": "1.0.0", - "license": "MIT", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" } }, "recipes/mocha-to-node-test-runner": { "name": "@nodejs/mocha-to-node-test-runner", - "version": "1.0.0", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" - }, - "devDependencies": { - "@codemod.com/jssg-types": "^1.6.3" } }, "recipes/mock-module-exports": { "name": "@nodejs/mock-module-exports", - "version": "1.0.0", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1197,16 +1149,12 @@ }, "recipes/node-url-to-whatwg-url": { "name": "@nodejs/node-url-to-whatwg-url", - "version": "1.0.1", - "license": "MIT", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" } }, "recipes/process-assert-to-node-assert": { "name": "@nodejs/process-assert-to-node-assert", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1216,8 +1164,6 @@ }, "recipes/process-main-module": { "name": "@nodejs/process-main-module", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1227,8 +1173,6 @@ }, "recipes/repl-builtin-modules": { "name": "@nodejs/repl-builtin-modules", - "version": "1.0.1", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1238,8 +1182,6 @@ }, "recipes/repl-classes-with-new": { "name": "@nodejs/repl-classes-with-new", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1249,8 +1191,6 @@ }, "recipes/rmdir": { "name": "@nodejs/rmdir", - "version": "1.1.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1260,8 +1200,6 @@ }, "recipes/slow-buffer-to-buffer-alloc-unsafe-slow": { "name": "@nodejs/slow-buffer-to-buffer-alloc-unsafe-slow", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1271,8 +1209,6 @@ }, "recipes/timers-deprecations": { "name": "@nodejs/timers-deprecations", - "version": "1.0.0", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1282,8 +1218,6 @@ }, "recipes/tls-create-secure-pair-to-tls-socket": { "name": "@nodejs/tls-create-secure-pair-to-tls-socket", - "version": "1.0.1", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1293,8 +1227,6 @@ }, "recipes/tmpdir-to-tmpdir": { "name": "@nodejs/tmpdir-to-tmpdir", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1304,7 +1236,6 @@ }, "recipes/types-is-native-error": { "name": "@nodejs/types-is-native-error", - "version": "1.0.1", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1314,8 +1245,6 @@ }, "recipes/util-extend-to-object-assign": { "name": "@nodejs/util-extend-to-object-assign", - "version": "1.0.1", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1325,10 +1254,8 @@ }, "recipes/util-is": { "name": "@nodejs/util-is", - "version": "1.0.2", - "license": "MIT", "dependencies": { - "@nodejs/codemod-utils": "0.0.0" + "@nodejs/codemod-utils": "*" }, "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" @@ -1336,8 +1263,6 @@ }, "recipes/util-log-to-console-log": { "name": "@nodejs/util-log-to-console-log", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1347,8 +1272,6 @@ }, "recipes/util-print-to-console-log": { "name": "@nodejs/util-print-to-console-log", - "version": "1.0.2", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1363,8 +1286,6 @@ }, "recipes/zlib-bytesread-to-byteswritten": { "name": "@nodejs/zlib-bytesread-to-byteswritten", - "version": "1.0.1", - "license": "MIT", "dependencies": { "@nodejs/codemod-utils": "*" }, @@ -1374,8 +1295,6 @@ }, "utils": { "name": "@nodejs/codemod-utils", - "version": "0.0.0", - "license": "MIT", "devDependencies": { "@ast-grep/lang-bash": "^0.0.8", "@ast-grep/lang-json": "^0.0.7", diff --git a/package.json b/package.json index aa42387e..d97aff1d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,5 @@ { "name": "userland-migrations", - "version": "1.0.0", - "description": "A collection of migration recipes for userland code.", - "type": "module", "scripts": { "lint:fix": "biome lint --fix ./", "lint": "biome lint ./", @@ -10,21 +7,6 @@ "test": "npm run test --workspaces", "type-check": "tsc --noEmit" }, - "repository": { - "type": "git", - "url": "https://github.com/nodejs/userland-migrations" - }, - "keywords": [ - "automation", - "codemod", - "migrations", - "node.js" - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/nodejs/userland-migrations/issues" - }, - "homepage": "https://nodejs.org/learn/userland-migrations", "devDependencies": { "@biomejs/biome": "2.5.6", "@types/node": "^26.1.2", diff --git a/recipes/axios-to-whatwg-fetch/package.json b/recipes/axios-to-whatwg-fetch/package.json index afdc92d4..a6e38d73 100644 --- a/recipes/axios-to-whatwg-fetch/package.json +++ b/recipes/axios-to-whatwg-fetch/package.json @@ -1,22 +1,11 @@ { "name": "@nodejs/axios-to-whatwg-fetch", - "version": "1.0.0", - "description": "Replace `axios` with `fetch`", "type": "module", "scripts": { "test": "node --run test:workflow && node --run test:remove-dependencies", "test:workflow": "npx codemod jssg test -l tsx ./src/workflow.ts --strictness cst", "test:remove-dependencies": "npx codemod jssg test -l json ./src/remove-dependencies.ts ./tests/remove-dependencies --allow-child-process --allow-fs --strictness cst" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/axios-to-whatwg-fetch", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Bruno Rodrigues", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/axios-to-whatwg-fetch/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/axios-to-whatwg-fetch/src/workflow.ts b/recipes/axios-to-whatwg-fetch/src/workflow.ts index 09e8cb29..8e3cc179 100644 --- a/recipes/axios-to-whatwg-fetch/src/workflow.ts +++ b/recipes/axios-to-whatwg-fetch/src/workflow.ts @@ -106,7 +106,7 @@ const getObjectPropertyValue = ( const hasUnsupportedOptions = ( configNode: SgNode | undefined, ): { unsupported: boolean; optionName?: string } => { - if (!configNode || configNode.kind() !== 'object') { + if (!configNode?.is('object')) { return { unsupported: false }; } diff --git a/recipes/buffer-atob-btoa/package.json b/recipes/buffer-atob-btoa/package.json index d9183778..cbe52af8 100644 --- a/recipes/buffer-atob-btoa/package.json +++ b/recipes/buffer-atob-btoa/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/buffer-atob-btoa", - "version": "1.0.1", - "description": "Migrates usage of the legacy APIs `buffer.atob()` and `buffer.btoa()` to the current recommended approaches", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/buffer-atob-btoa", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "nekojanai (Jana)", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/buffer-atob-btoa/README.md", "dependencies": { "@nodejs/codemod-utils": "*" }, diff --git a/recipes/chalk-to-util-styletext/package.json b/recipes/chalk-to-util-styletext/package.json index 40f157b4..6b86e367 100644 --- a/recipes/chalk-to-util-styletext/package.json +++ b/recipes/chalk-to-util-styletext/package.json @@ -1,22 +1,11 @@ { "name": "@nodejs/chalk-to-util-styletext", - "version": "1.0.2", - "description": "Migrate from the chalk package to Node.js's built-in util.styleText API", "type": "module", "scripts": { "test": "node --run test:workflow && node --run test:remove-dependencies", "test:workflow": "npx codemod jssg test -l typescript ./src/workflow.ts ./", "test:remove-dependencies": "npx codemod jssg test -l json ./src/remove-dependencies.ts ./tests/remove-dependencies --allow-child-process --allow-fs --strictness cst" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/chalk-to-util-styletext", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Richie McColl", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/chalk-to-util-styletext/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/create-require-from-path/package.json b/recipes/create-require-from-path/package.json index 3e8aed99..30929040 100644 --- a/recipes/create-require-from-path/package.json +++ b/recipes/create-require-from-path/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/create-require-from-path", - "version": "1.1.2", - "description": "Handle DEP0130 via transforming `createRequireFromPath` to `createRequire`.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/create-require-from-path", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/create-require-from-path/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/createCredentials-to-createSecureContext/package.json b/recipes/createCredentials-to-createSecureContext/package.json index 0dec9319..9e5213b7 100644 --- a/recipes/createCredentials-to-createSecureContext/package.json +++ b/recipes/createCredentials-to-createSecureContext/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/createcredentials-to-createsecurecontext", - "version": "1.0.1", - "description": "Handle DEP0010 via transforming `crypto.createCredentials` to `tls.createSecureContext` with the appropriate options.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/crypto-create-credentials", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "0hmx", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/crypto-create-credentials/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/crypto-createcipheriv-migration/package.json b/recipes/crypto-createcipheriv-migration/package.json index 13dba10c..3d9c54c5 100644 --- a/recipes/crypto-createcipheriv-migration/package.json +++ b/recipes/crypto-createcipheriv-migration/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/crypto-createcipheriv-migration", - "version": "1.0.0", - "description": "Migrate deprecated crypto.createCipher()/createDecipher() (DEP0106) to crypto.createCipheriv()/createDecipheriv() with secure key derivation.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/crypto-createcipheriv-migration", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/crypto-createcipheriv-migration/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/crypto-fips-to-getFips/package.json b/recipes/crypto-fips-to-getFips/package.json index 3a337202..d5bf8850 100644 --- a/recipes/crypto-fips-to-getFips/package.json +++ b/recipes/crypto-fips-to-getFips/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/crypto-fips-to-getFips", - "version": "1.0.2", - "description": "Handle DEP0093 via transforming `crypto.fips` to `crypto.getFips()` and `crypto.setFips()`", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/crypto-fips-to-getFips", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Usman S.", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/crypto-fips-to-getFips/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/crypto-rsa-pss-update/package.json b/recipes/crypto-rsa-pss-update/package.json index 650941ab..48f8d233 100644 --- a/recipes/crypto-rsa-pss-update/package.json +++ b/recipes/crypto-rsa-pss-update/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/crypto-rsa-pss-update", - "version": "1.0.2", - "description": "Handle DEP0154 via transforming deprecated RSA-PSS crypto options `hash` to `hashAlgorithm` and `mgf1Hash` to `mgf1HashAlgorithm`.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/crypto-rsa-pss-update", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Mauro Nievas", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/crypto-rsa-pss-update/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/dirent-path-to-parent-path/package.json b/recipes/dirent-path-to-parent-path/package.json index 9a166cb4..35b2b295 100644 --- a/recipes/dirent-path-to-parent-path/package.json +++ b/recipes/dirent-path-to-parent-path/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/dirent-path-to-parent-path", - "version": "1.0.1", - "description": "Handle DEP0178 via transforming `dirent.path` to `dirent.parentPath`", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/dirent-path-to-parent-path", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Bruno Rodrigues", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/dirent-path-to-parent-path/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/dns-lookup-options-coercion/package.json b/recipes/dns-lookup-options-coercion/package.json index 556624e2..109a3375 100644 --- a/recipes/dns-lookup-options-coercion/package.json +++ b/recipes/dns-lookup-options-coercion/package.json @@ -4,7 +4,7 @@ "description": "Handle DEP0153 by converting literal dns.lookup option values to their proper types", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, "repository": { "type": "git", diff --git a/recipes/err-invalid-callback/package.json b/recipes/err-invalid-callback/package.json index 4d8784e5..f95a3af4 100644 --- a/recipes/err-invalid-callback/package.json +++ b/recipes/err-invalid-callback/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/err-invalid-callback", - "version": "1.0.0", - "description": "Handle DEP0159 by replacing ERR_INVALID_CALLBACK with ERR_INVALID_ARG_TYPE.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests/" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/err-invalid-callback", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Stanley Shen", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/err-invalid-callback/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/fs-access-mode-constants/package.json b/recipes/fs-access-mode-constants/package.json index c61e8238..52106726 100644 --- a/recipes/fs-access-mode-constants/package.json +++ b/recipes/fs-access-mode-constants/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/fs-access-mode-constants", - "version": "1.0.3", - "description": "Handle DEP0176 via transforming imports of `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` from the root `fs` module to `fs.constants`.", "type": "module", "scripts": { - "test": "npx codemod jssg test --allow-fs -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test --allow-fs -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/fs-access-mode-constants", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "nekojanai (Jana)", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/fs-access-mode-constants/README.md", "dependencies": { "@nodejs/codemod-utils": "*" }, diff --git a/recipes/fs-truncate-fd-deprecation/package.json b/recipes/fs-truncate-fd-deprecation/package.json index 7e1b4bc6..a3754933 100644 --- a/recipes/fs-truncate-fd-deprecation/package.json +++ b/recipes/fs-truncate-fd-deprecation/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/fs-truncate-fd-deprecation", - "version": "1.0.2", - "description": "Handle DEP0081 via transforming `truncate` to `ftruncateSync` when using a file descriptor.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/fs-truncate-fd-deprecation", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/fs-truncate-fd-deprecation/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/http-classes-with-new/package.json b/recipes/http-classes-with-new/package.json index 26ab2a53..c1aa211c 100644 --- a/recipes/http-classes-with-new/package.json +++ b/recipes/http-classes-with-new/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/http-classes-with-new", - "version": "1.0.2", - "description": "Handle DEP0195: Instantiating node:http classes without new.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/http-classes-with-new", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Usman S.", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/http-classes-with-new/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/http-outgoingmessage-headers/package.json b/recipes/http-outgoingmessage-headers/package.json index 1d25026a..4919ea59 100644 --- a/recipes/http-outgoingmessage-headers/package.json +++ b/recipes/http-outgoingmessage-headers/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/http-outgoingmessage-headers", - "version": "1.0.0", - "description": "Handle DEP0066: migrate deprecated use of `OutgoingMessage.prototype` `_headers` & `_headerNames` to public HTTP header APIs", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests/" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/http-outgoingmessage-headers", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Elves Vieira", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/http-outgoingmessage-headers/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/http2-priority-signaling/package.json b/recipes/http2-priority-signaling/package.json index d1efc258..586581a8 100644 --- a/recipes/http2-priority-signaling/package.json +++ b/recipes/http2-priority-signaling/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/http2-priority-signaling", - "version": "1.0.0", - "description": "Handle DEP0194 via removing HTTP/2 priority-related options and methods", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests/" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/http2-priority-signaling", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/http2-priority-signaling/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/import-assertions-to-attributes/package.json b/recipes/import-assertions-to-attributes/package.json index cd38557a..f602bf56 100644 --- a/recipes/import-assertions-to-attributes/package.json +++ b/recipes/import-assertions-to-attributes/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/import-assertions-to-attributes", - "version": "1.0.0", - "description": "Replace `assert` import attribute to the `with` ECMAScript import attribute.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/import-assertions-to-attributes", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/tree/main/import-assertions-to-attributes#readme", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" } diff --git a/recipes/mocha-to-node-test-runner/package.json b/recipes/mocha-to-node-test-runner/package.json index 6708d51d..8d05a36d 100644 --- a/recipes/mocha-to-node-test-runner/package.json +++ b/recipes/mocha-to-node-test-runner/package.json @@ -1,23 +1,9 @@ { "name": "@nodejs/mocha-to-node-test-runner", - "version": "1.0.0", - "description": "Migrate Mocha 8.x tests to Node.js (22.x, 24.x) test runner", "type": "module", "scripts": { "test": "npx codemod jssg test --strictness cst -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/mocha-to-node-test-runner", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Xavier Stouder", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/mocha-to-node-test-runner/README.md", - "devDependencies": { - "@codemod.com/jssg-types": "^1.6.3" - }, "dependencies": { "@nodejs/codemod-utils": "*" } diff --git a/recipes/mocha-to-node-test-runner/src/workflow.ts b/recipes/mocha-to-node-test-runner/src/workflow.ts index c74f71f8..3450b728 100644 --- a/recipes/mocha-to-node-test-runner/src/workflow.ts +++ b/recipes/mocha-to-node-test-runner/src/workflow.ts @@ -116,7 +116,7 @@ function transformImport(rootNode: SgNode, EOL: string): Edit[] { ]; } -function transformDoneCallbacks(rootNode: SgNode, EOL: string): Edit[] { +function transformDoneCallbacks(rootNode: SgNode): Edit[] { return rootNode .findAll({ constraints: { @@ -179,7 +179,7 @@ function transformThisSkip(rootNode: SgNode): Edit[] { }); } -function transformThisTimeout(rootNode: SgNode, EOL: string): Edit[] { +function transformThisTimeout(rootNode: SgNode): Edit[] { const source = rootNode.text(); return rootNode diff --git a/recipes/mock-module-exports/package.json b/recipes/mock-module-exports/package.json index b9dabdac..62c0720c 100644 --- a/recipes/mock-module-exports/package.json +++ b/recipes/mock-module-exports/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/mock-module-exports", - "version": "1.0.0", - "description": "Handle mock.module exports deprecation", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests/" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/mock-module-exports", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Bruno Rodrigues", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/mock-module-exports/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/node-url-to-whatwg-url/package.json b/recipes/node-url-to-whatwg-url/package.json index 0f37e827..331ce607 100644 --- a/recipes/node-url-to-whatwg-url/package.json +++ b/recipes/node-url-to-whatwg-url/package.json @@ -1,7 +1,5 @@ { "name": "@nodejs/node-url-to-whatwg-url", - "version": "1.0.1", - "description": "Handle DEP0116 via transforming `url.parse` to `new URL()`", "type": "module", "scripts": { "test": "node --run test:import-process && node --run test:url-format && node --run test:url-parse", @@ -9,15 +7,6 @@ "test:url-format": "npx codemod jssg test -l typescript ./src/url-format.ts ./tests/ --filter url-format", "test:url-parse": "npx codemod jssg test -l typescript ./src/url-parse.ts ./tests/ --filter url-parse" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/node-url-to-whatwg-url", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/tree/main/node-url-to-whatwg-url#readme", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" } diff --git a/recipes/process-assert-to-node-assert/package.json b/recipes/process-assert-to-node-assert/package.json index 7def4101..8f8f108a 100644 --- a/recipes/process-assert-to-node-assert/package.json +++ b/recipes/process-assert-to-node-assert/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/process-assert-to-node-assert", - "version": "1.0.2", - "description": "Handle DEP0100 via transforming `process.assert` to `node:assert`.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript --ignore-whitespace ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript --ignore-whitespace ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/process-assert-to-node-assert", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "matheusmorett2", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/process-assert-to-node-assert/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/process-main-module/package.json b/recipes/process-main-module/package.json index 07febdb2..4f7ce03a 100644 --- a/recipes/process-main-module/package.json +++ b/recipes/process-main-module/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/process-main-module", - "version": "1.0.2", - "description": "Handle DEP0138 via transforming `process.mainModule` to `require.main`.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/process-main-module", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Bruno Rodrigues", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/process-main-module/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/repl-builtin-modules/package.json b/recipes/repl-builtin-modules/package.json index fcdf4dbf..9690b272 100644 --- a/recipes/repl-builtin-modules/package.json +++ b/recipes/repl-builtin-modules/package.json @@ -1,21 +1,10 @@ { "name": "@nodejs/repl-builtin-modules", - "version": "1.0.1", - "description": "Handle DEP0191 via transforming `repl.builtinModules` usage to `module.builtinModules`.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests", - "test:update-snapshots": "npx codemod jssg test --update-snapshots -l typescript ./src/workflow.ts ./ " + "test": "npx codemod jssg test -l typescript ./src/workflow.ts", + "test:update-snapshots": "npx codemod jssg test --update-snapshots -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/repl-builtin-modules", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/repl-builtin-modules/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/repl-classes-with-new/package.json b/recipes/repl-classes-with-new/package.json index 1706fd43..8247f55e 100644 --- a/recipes/repl-classes-with-new/package.json +++ b/recipes/repl-classes-with-new/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/repl-classes-with-new", - "version": "1.0.2", - "description": "Handle DEP0185: Instantiating node:repl classes without new.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/repl-classes-with-new", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "GitHub Copilot", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/repl-classes-with-new/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/rmdir/package.json b/recipes/rmdir/package.json index 4c2e2d8c..5b7b2284 100644 --- a/recipes/rmdir/package.json +++ b/recipes/rmdir/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/rmdir", - "version": "1.1.2", - "description": "Handle DEP0147 via transforming `fs.rmdir` to `fs.rm` with the appropriate options.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/rmdirs", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/rmdirs/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/slow-buffer-to-buffer-alloc-unsafe-slow/package.json b/recipes/slow-buffer-to-buffer-alloc-unsafe-slow/package.json index 2db884e8..a9d22df2 100644 --- a/recipes/slow-buffer-to-buffer-alloc-unsafe-slow/package.json +++ b/recipes/slow-buffer-to-buffer-alloc-unsafe-slow/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/slow-buffer-to-buffer-alloc-unsafe-slow", - "version": "1.0.2", - "description": "Handle DEP0030 via transforming SlowBuffer usage to Buffer.allocUnsafeSlow().", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/slow-buffer-to-buffer-alloc-unsafe-slow", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "lluisemper(Lluis Semper Lloret)", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/slow-buffer-to-buffer-alloc-unsafe-slow/README.md", "dependencies": { "@nodejs/codemod-utils": "*" }, diff --git a/recipes/timers-deprecations/package.json b/recipes/timers-deprecations/package.json index 339bb67e..a567549e 100644 --- a/recipes/timers-deprecations/package.json +++ b/recipes/timers-deprecations/package.json @@ -1,7 +1,5 @@ { "name": "@nodejs/timers-deprecations", - "version": "1.0.0", - "description": "Migrate deprecated node:timers APIs to public timer functions.", "type": "module", "scripts": { "test": "node --run test:enroll && node --run test:unenroll && node --run test:active && node --run test:unref && node --run test:imports", @@ -11,15 +9,6 @@ "test:unref": "npx codemod jssg test -l typescript ./src/unref-active-to-unref.ts ./tests/ --filter unref", "test:imports": "npx codemod jssg test -l typescript ./src/cleanup-imports.ts ./tests/ --filter imports" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/timers-deprecations", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/tree/main/recipes/timers-deprecations#readme", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/tls-create-secure-pair-to-tls-socket/package.json b/recipes/tls-create-secure-pair-to-tls-socket/package.json index 2243abf4..c5137cd0 100644 --- a/recipes/tls-create-secure-pair-to-tls-socket/package.json +++ b/recipes/tls-create-secure-pair-to-tls-socket/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/tls-create-secure-pair-to-tls-socket", - "version": "1.0.1", - "description": "Handle DEP0064 replacing `tls.createSecurePair()` with `tls.TLSSocket()`", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/tls-create-secure-pair-to-tls-socket", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Leo Trevizo", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/tls-create-secure-pair-to-tls-socket/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/tmpdir-to-tmpdir/package.json b/recipes/tmpdir-to-tmpdir/package.json index 8f837ff6..83de1a5d 100644 --- a/recipes/tmpdir-to-tmpdir/package.json +++ b/recipes/tmpdir-to-tmpdir/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/tmpdir-to-tmpdir", - "version": "1.0.2", - "description": "Handle DEP0022 via transforming `tmpDir` to `tmpdir`.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/tmpdir-to-tmpdir", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "nekojanai (Jana)", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/tmpdir-to-tmpdir/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/types-is-native-error/package.json b/recipes/types-is-native-error/package.json index 9bc4c8b6..91a4fd1c 100644 --- a/recipes/types-is-native-error/package.json +++ b/recipes/types-is-native-error/package.json @@ -1,19 +1,9 @@ { "name": "@nodejs/types-is-native-error", - "version": "1.0.1", - "description": "Handle DEP0197 via transforming `types.isNativeError` to `Error.isError`", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/rmdirs", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Bruno Rodrigues", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/types-is-native-error/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/util-extend-to-object-assign/package.json b/recipes/util-extend-to-object-assign/package.json index 52b906ca..63ef68e7 100644 --- a/recipes/util-extend-to-object-assign/package.json +++ b/recipes/util-extend-to-object-assign/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/util-extend-to-object-assign", - "version": "1.0.1", - "description": "Handle DEP0060 by replacing `util._extend()` with `Object.assign()`.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/util-extend-to-object-assign", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "GitHub Copilot", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/util-extend-to-object-assign/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/util-is/package.json b/recipes/util-is/package.json index 66eb371e..e2e91c15 100644 --- a/recipes/util-is/package.json +++ b/recipes/util-is/package.json @@ -1,24 +1,13 @@ { "name": "@nodejs/util-is", - "version": "1.0.2", - "description": "Replaces deprecated `util.is*()` methods with their modern equivalents.", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/util-is", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Augustin Mauroy", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/util-is/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, "dependencies": { - "@nodejs/codemod-utils": "0.0.0" + "@nodejs/codemod-utils": "*" } } diff --git a/recipes/util-log-to-console-log/package.json b/recipes/util-log-to-console-log/package.json index ca05beaa..13d98ba3 100644 --- a/recipes/util-log-to-console-log/package.json +++ b/recipes/util-log-to-console-log/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/util-log-to-console-log", - "version": "1.0.2", - "description": "Handle DEP0059 via transforming `log.util()` to `console.log()`", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/util-log-to-console-log", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Bruno Rodrigues", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/util-log-to-console-log/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/util-print-to-console-log/package.json b/recipes/util-print-to-console-log/package.json index 66f24c5e..2e2603c7 100644 --- a/recipes/util-print-to-console-log/package.json +++ b/recipes/util-print-to-console-log/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/util-print-to-console-log", - "version": "1.0.2", - "description": "Handle DEP0026, DEP0027, DEP0028, DEP0029 via transforming `util.print|puts|debug|error()` to `console.log|error()`", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/util-print-to-console-log", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Bruno Rodrigues", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/util-print-to-console-log/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/recipes/zlib-bytesread-to-byteswritten/package.json b/recipes/zlib-bytesread-to-byteswritten/package.json index 7ea39d77..6662f947 100644 --- a/recipes/zlib-bytesread-to-byteswritten/package.json +++ b/recipes/zlib-bytesread-to-byteswritten/package.json @@ -1,20 +1,9 @@ { "name": "@nodejs/zlib-bytesread-to-byteswritten", - "version": "1.0.1", - "description": "Replace deprecated `zlib.bytesRead` with `zlib.bytesWritten` in Node.js transform streams", "type": "module", "scripts": { - "test": "npx codemod jssg test -l typescript ./src/workflow.ts ./tests" + "test": "npx codemod jssg test -l typescript ./src/workflow.ts" }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/userland-migrations.git", - "directory": "recipes/zlib-bytesread-to-byteswritten", - "bugs": "https://github.com/nodejs/userland-migrations/issues" - }, - "author": "Elie Khoury", - "license": "MIT", - "homepage": "https://github.com/nodejs/userland-migrations/blob/main/recipes/zlib-bytesread-to-byteswritten/README.md", "devDependencies": { "@codemod.com/jssg-types": "^1.6.3" }, diff --git a/utils/package.json b/utils/package.json index 17b29e17..b88e675c 100644 --- a/utils/package.json +++ b/utils/package.json @@ -1,16 +1,12 @@ { "name": "@nodejs/codemod-utils", - "version": "0.0.0", - "description": "Utilities for Node.js userland migrations.", + "type": "module", "exports": { "./*":"./src/*.ts" }, "scripts": { - "test": "node --no-warnings --import=./src/codemod-jssg-context.ts --experimental-test-snapshots --experimental-strip-types --import='./src/snapshots.ts' --test --experimental-test-coverage --test-coverage-include='src/**/*' --test-coverage-exclude='**/*.test.ts' './**/*.test.ts'" + "test": "node --import=./src/codemod-jssg-context.ts --import='./src/snapshots.ts' --test --experimental-test-coverage --test-coverage-include='src/**/*' --test-coverage-exclude='**/*.test.ts' './**/*.test.ts'" }, - "author": "Augustin Maurouy", - "license": "MIT", - "type": "module", "devDependencies": { "@ast-grep/lang-bash": "^0.0.8", "@ast-grep/lang-json": "^0.0.7", diff --git a/utils/src/ast-grep/update-binding.ts b/utils/src/ast-grep/update-binding.ts index fcde97b2..b88532b8 100644 --- a/utils/src/ast-grep/update-binding.ts +++ b/utils/src/ast-grep/update-binding.ts @@ -185,7 +185,7 @@ function handleNamedImportBindings( }, }); - if (Boolean(namespaceImport) && namespaceImport.text() === options.old) { + if (namespaceImport && namespaceImport.text() === options.old) { if (options?.new) { // Namespace imports can only be replaced with a single binding const newName = Array.isArray(options.new) ? options.new[0] : options.new; diff --git a/utils/src/is-esm.test.ts b/utils/src/is-esm.test.ts index fbf58b84..b5c0b33d 100644 --- a/utils/src/is-esm.test.ts +++ b/utils/src/is-esm.test.ts @@ -174,5 +174,13 @@ describe('isESM', () => { assert.strictEqual(result, false); }); + + it('should return false when package.json is invalid JSON', async () => { + writeFileSync(join(tempDir, 'package.json'), '{ invalid json }'); + + const mockRoot = createMockRoot('test.js', false, false); + const result = isESM(mockRoot); + assert.strictEqual(result, false); + }); }); });