@next/codemod 15.0.0-canary.196 → 15.0.0-canary.197
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/upgrade.js +8 -2
- package/package.json +1 -1
package/bin/upgrade.js
CHANGED
|
@@ -119,7 +119,7 @@ async function runUpgrade(revision, options) {
|
|
|
119
119
|
// we should only let the user stay on React 18 if they are using pure Pages Router.
|
|
120
120
|
// x-ref(PR): https://github.com/vercel/next.js/pull/65058
|
|
121
121
|
// x-ref(release): https://github.com/vercel/next.js/releases/tag/v14.3.0-canary.45
|
|
122
|
-
(0, compare_1.default)(
|
|
122
|
+
(0, compare_1.default)(targetNextVersion, '14.3.0-canary.45') >= 0 &&
|
|
123
123
|
installedReactVersion.startsWith('18')) {
|
|
124
124
|
const shouldStayOnReact18Res = await (0, prompts_1.default)({
|
|
125
125
|
type: 'confirm',
|
|
@@ -149,7 +149,8 @@ async function runUpgrade(revision, options) {
|
|
|
149
149
|
let execCommand = 'npx';
|
|
150
150
|
// The following React codemods are for React 19
|
|
151
151
|
if (!shouldStayOnReact18 &&
|
|
152
|
-
(0, compare_1.default)(targetReactVersion, '
|
|
152
|
+
(0, compare_1.default)(targetReactVersion, '18.9999.9999') > 0 &&
|
|
153
|
+
(0, compare_1.default)(installedReactVersion, '18.9999.9999') <= 0) {
|
|
153
154
|
shouldRunReactCodemods = await suggestReactCodemods();
|
|
154
155
|
shouldRunReactTypesCodemods = await suggestReactTypesCodemods();
|
|
155
156
|
const execCommandMap = {
|
|
@@ -400,6 +401,11 @@ async function suggestReactTypesCodemods() {
|
|
|
400
401
|
}
|
|
401
402
|
function writeOverridesField(packageJson, packageManager, overrides) {
|
|
402
403
|
const entries = Object.entries(overrides);
|
|
404
|
+
// Avoids writing an empty overrides field into package.json
|
|
405
|
+
// which would be an unnecessary diff.
|
|
406
|
+
if (entries.length === 0) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
403
409
|
if (packageManager === 'npm') {
|
|
404
410
|
if (!packageJson.overrides) {
|
|
405
411
|
packageJson.overrides = {};
|