From 7942f81998fe8de268942a94e25d777e55e2033b Mon Sep 17 00:00:00 2001 From: Jordan Young Date: Thu, 14 Nov 2024 11:30:42 -0500 Subject: [PATCH] feat: add rewriting jsconfig to tsconfig --- packages/workflow-upgrade/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/workflow-upgrade/index.js b/packages/workflow-upgrade/index.js index c0f34ce1..6b3fe9b0 100755 --- a/packages/workflow-upgrade/index.js +++ b/packages/workflow-upgrade/index.js @@ -162,6 +162,18 @@ module.exports = async (cwd) => { fs.unlinkSync(yarnLock); } + const jsconfigPath = path.join(cwd, 'jsconfig.json'); + const hasJsconfig = fs.existsSync(jsconfigPath); + + if (hasJsconfig) { + // Copy jsconfig into tsconfig + const jsconfigData = fs.readFileSync(jsconfigPath); + fs.writeFileSync(jsconfigData, `${JSON.stringify(pkg, null, 2)}\n`, 'utf8'); + + // Delete jsconfig + fs.unlinkSync(jsconfigPath); + } + // Delete node_modules Logger.info('Deleting node_modules...'); rimraf.sync(path.join(cwd, 'node_modules'));