@next/codemod 16.1.0-canary.2 → 16.1.0-canary.4

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 +19 -8
  2. package/package.json +1 -1
package/bin/upgrade.js CHANGED
@@ -172,20 +172,14 @@ async function runUpgrade(revision, options) {
172
172
  const packageManager = (0, handle_package_1.getPkgManager)(cwd);
173
173
  let shouldRunReactCodemods = false;
174
174
  let shouldRunReactTypesCodemods = false;
175
- let execCommand = 'npx';
175
+ let execCommand = 'npx --yes';
176
176
  // The following React codemods are for React 19
177
177
  if (!shouldStayOnReact18 &&
178
178
  (0, semver_1.compare)(targetReactVersion, '19.0.0-0') >= 0 &&
179
179
  (0, semver_1.compare)(installedReactVersion, '19.0.0-0') < 0) {
180
180
  shouldRunReactCodemods = await suggestReactCodemods();
181
181
  shouldRunReactTypesCodemods = await suggestReactTypesCodemods();
182
- const execCommandMap = {
183
- yarn: 'yarn dlx',
184
- pnpm: 'pnpx',
185
- bun: 'bunx',
186
- npm: 'npx',
187
- };
188
- execCommand = execCommandMap[packageManager];
182
+ execCommand = getNpxCommand(packageManager);
189
183
  }
190
184
  fs_1.default.writeFileSync(appPackageJsonPath, JSON.stringify(appPackageJson, null, 2));
191
185
  const dependenciesToInstall = [];
@@ -560,4 +554,21 @@ function warnDependenciesOutOfRange(appPackageJson, versionMapping) {
560
554
  });
561
555
  }
562
556
  }
557
+ function getNpxCommand(pkgManager) {
558
+ let command = 'npx --yes';
559
+ if (pkgManager === 'pnpm') {
560
+ command = 'pnpm --silent dlx';
561
+ }
562
+ else if (pkgManager === 'yarn') {
563
+ try {
564
+ (0, child_process_1.execSync)('yarn dlx --help', { stdio: 'ignore', cwd });
565
+ command = 'yarn --quiet dlx';
566
+ }
567
+ catch { }
568
+ }
569
+ else if (pkgManager === 'bun') {
570
+ command = 'bunx';
571
+ }
572
+ return command;
573
+ }
563
574
  //# sourceMappingURL=upgrade.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next/codemod",
3
- "version": "16.1.0-canary.2",
3
+ "version": "16.1.0-canary.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",