Skip to content

Commit

Permalink
Updated pnpm.overrides to show the correct version for eslint-plugin-…
Browse files Browse the repository at this point in the history
…import (#97)

* bugfix: Updated pnpm.overrides to show the correct version for eslint-plugin-import

* chore: Updated test fixtures

* refactor: Allowed the update-package-json step to set pnpm.overrides

* chore: Added changeset

---------

Co-authored-by: ijlee2 <[email protected]>
  • Loading branch information
ijlee2 and ijlee2 authored Oct 29, 2023
1 parent 75560cc commit ad069d5
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .changeset/late-hairs-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@codemod-utils/cli": patch
---

Updated pnpm.overrides to show the correct version for eslint-plugin-import
5 changes: 0 additions & 5 deletions packages/cli/src/blueprints/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
"enhance: dependency": "Internal",
"enhance: documentation": "Documentation"
}
},
"pnpm": {
"overrides": {
"[email protected]>tsconfig-paths": "^4.2.0"
}
}
}<% } else { %>{
"name": "<%= options.codemod.name %>",
Expand Down
17 changes: 17 additions & 0 deletions packages/cli/src/migration/steps/update-package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,22 @@ function updateDevDependencies(
packageJson['devDependencies'] = convertToObject(devDependencies);
}

function addPnpmOverrides(packageJson: PackageJson, options: Options): void {
const { codemod } = options;

if (!codemod.hasTypeScript) {
return;
}

const version = getVersion('eslint-plugin-import').replace(/^\^/, '');

packageJson['pnpm'] = {
overrides: {
[`eslint-plugin-import@${version}>tsconfig-paths`]: '^4.2.0',
},
};
}

export function updatePackageJson(options: Options): void {
const { codemod, projectRoot } = options;

Expand All @@ -86,6 +102,7 @@ export function updatePackageJson(options: Options): void {

updateDependencies(packageJson, options);
updateDevDependencies(packageJson, options);
addPnpmOverrides(packageJson, options);

const destination = join(projectRoot, codemod.name, 'package.json');
const file = JSON.stringify(packageJson, null, 2) + '\n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,5 @@
"enhance: dependency": "Internal",
"enhance: documentation": "Documentation"
}
},
"pnpm": {
"overrides": {
"[email protected]>tsconfig-paths": "^4.2.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,5 @@
"enhance: dependency": "Internal",
"enhance: documentation": "Documentation"
}
},
"pnpm": {
"overrides": {
"[email protected]>tsconfig-paths": "^4.2.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"pnpm": {
"overrides": {
"eslint-plugin-import@2.27.5>tsconfig-paths": "^4.2.0"
"eslint-plugin-import@2.29.0>tsconfig-paths": "^4.2.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
},
"pnpm": {
"overrides": {
"eslint-plugin-import@2.27.5>tsconfig-paths": "^4.2.0"
"eslint-plugin-import@2.29.0>tsconfig-paths": "^4.2.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"pnpm": {
"overrides": {
"eslint-plugin-import@2.27.5>tsconfig-paths": "^4.2.0"
"eslint-plugin-import@2.29.0>tsconfig-paths": "^4.2.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"pnpm": {
"overrides": {
"eslint-plugin-import@2.27.5>tsconfig-paths": "^4.2.0"
"eslint-plugin-import@2.29.0>tsconfig-paths": "^4.2.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
},
"pnpm": {
"overrides": {
"eslint-plugin-import@2.28.1>tsconfig-paths": "^4.2.0"
"eslint-plugin-import@2.29.0>tsconfig-paths": "^4.2.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
},
"pnpm": {
"overrides": {
"eslint-plugin-import@2.28.1>tsconfig-paths": "^4.2.0"
"eslint-plugin-import@2.29.0>tsconfig-paths": "^4.2.0"
}
}
}

0 comments on commit ad069d5

Please sign in to comment.