Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(cli): use tsx parser for .ts files in codemod runner (#953)

Cindy Zhang2ed5f77f37d6
diff --git a/packages/cli/src/codemods/runner.mjs b/packages/cli/src/codemods/runner.mjs
index 160f3d4471..8d45f4b537 100644
--- a/packages/cli/src/codemods/runner.mjs
+++ b/packages/cli/src/codemods/runner.mjs
@@ -171,7 +171,7 @@ export async function runCodemods(versionManifests, {apply, path: srcPath, codem
const source = fs.readFileSync(filePath, 'utf-8');
// Configure parser based on file extension
const ext = path.extname(filePath);
- const parser = ext === '.tsx' ? 'tsx' : ext === '.jsx' ? 'babel' : 'babel';
+ const parser = (ext === '.tsx' || ext === '.ts') ? 'tsx' : 'babel';
const j = jscodeshift.withParser(parser);
const api = {
jscodeshift: j,
diff --git a/packages/cli/src/commands/upgrade.mjs b/packages/cli/src/commands/upgrade.mjs
index 6c4f54c9b3..778ab62e01 100644
--- a/packages/cli/src/commands/upgrade.mjs
+++ b/packages/cli/src/commands/upgrade.mjs
@@ -45,6 +45,7 @@ function detectCurrentVersion() {
try {
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
const deps = {
+ ...pkg.peerDependencies,
...pkg.dependencies,
...pkg.devDependencies,
};