@next/codemod 15.0.1-canary.2 → 15.0.1
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 +6 -6
- package/package.json +1 -1
package/bin/upgrade.js
CHANGED
|
@@ -319,16 +319,16 @@ function isUsingAppDir(projectPath) {
|
|
|
319
319
|
* Heuristics are used to determine whether to Turbopack is enabled or not and
|
|
320
320
|
* to determine how to update the dev script.
|
|
321
321
|
*
|
|
322
|
-
* 1. If the dev script contains `--
|
|
322
|
+
* 1. If the dev script contains `--turbopack` option, we assume that Turbopack is
|
|
323
323
|
* already enabled.
|
|
324
324
|
* 2. If the dev script contains the string `next dev`, we replace it to
|
|
325
|
-
* `next dev --
|
|
326
|
-
* 3. Otherwise, we ask the user to manually add `--
|
|
325
|
+
* `next dev --turbopack`.
|
|
326
|
+
* 3. Otherwise, we ask the user to manually add `--turbopack` to their dev command,
|
|
327
327
|
* showing the current dev command as the initial value.
|
|
328
328
|
*/
|
|
329
329
|
async function suggestTurbopack(packageJson) {
|
|
330
330
|
const devScript = packageJson.scripts['dev'];
|
|
331
|
-
if (devScript.includes('--
|
|
331
|
+
if (devScript.includes('--turbopack'))
|
|
332
332
|
return;
|
|
333
333
|
const responseTurbopack = await (0, prompts_1.default)({
|
|
334
334
|
type: 'confirm',
|
|
@@ -340,14 +340,14 @@ async function suggestTurbopack(packageJson) {
|
|
|
340
340
|
return;
|
|
341
341
|
}
|
|
342
342
|
if (devScript.includes('next dev')) {
|
|
343
|
-
packageJson.scripts['dev'] = devScript.replace('next dev', 'next dev --
|
|
343
|
+
packageJson.scripts['dev'] = devScript.replace('next dev', 'next dev --turbopack');
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
346
|
console.log(`${picocolors_1.default.yellow('⚠')} Could not find "${picocolors_1.default.bold('next dev')}" in your dev script.`);
|
|
347
347
|
const responseCustomDevScript = await (0, prompts_1.default)({
|
|
348
348
|
type: 'text',
|
|
349
349
|
name: 'customDevScript',
|
|
350
|
-
message: 'Please manually add "--
|
|
350
|
+
message: 'Please manually add "--turbopack" to your dev command.',
|
|
351
351
|
initial: devScript,
|
|
352
352
|
}, { onCancel: utils_1.onCancel });
|
|
353
353
|
packageJson.scripts['dev'] =
|