@next/codemod 15.0.2-canary.0 → 15.0.2-canary.2

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.
Files changed (2) hide show
  1. package/bin/upgrade.js +15 -9
  2. package/package.json +1 -1
package/bin/upgrade.js CHANGED
@@ -328,18 +328,24 @@ function isUsingAppDir(projectPath) {
328
328
  */
329
329
  async function suggestTurbopack(packageJson) {
330
330
  const devScript = packageJson.scripts['dev'];
331
- if (devScript?.includes('--turbopack'))
332
- return;
333
- const responseTurbopack = await (0, prompts_1.default)({
334
- type: 'confirm',
335
- name: 'enable',
336
- message: 'Enable Turbopack for next dev?',
337
- initial: true,
338
- }, { onCancel: utils_1.onCancel });
339
- if (!responseTurbopack.enable) {
331
+ if (!devScript) {
332
+ console.log(`${picocolors_1.default.red('⨯')} Could not find a "dev" script in your package.json.`);
340
333
  return;
341
334
  }
342
335
  if (devScript.includes('next dev')) {
336
+ // covers "--turbopack" as well
337
+ if (devScript.includes('--turbo')) {
338
+ return;
339
+ }
340
+ const responseTurbopack = await (0, prompts_1.default)({
341
+ type: 'confirm',
342
+ name: 'enable',
343
+ message: `Enable Turbopack for ${picocolors_1.default.bold('next dev')}?`,
344
+ initial: true,
345
+ }, { onCancel: utils_1.onCancel });
346
+ if (!responseTurbopack.enable) {
347
+ return;
348
+ }
343
349
  packageJson.scripts['dev'] = devScript.replace('next dev', 'next dev --turbopack');
344
350
  return;
345
351
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next/codemod",
3
- "version": "15.0.2-canary.0",
3
+ "version": "15.0.2-canary.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",