diff options
| author | 2023-11-03 21:25:40 +0800 | |
|---|---|---|
| committer | 2023-11-03 21:25:40 +0800 | |
| commit | 9029588590bea8b10451575c5142dcde77ecd1b5 (patch) | |
| tree | 04cf8aee56c23fd225ff19d340f7cee621d874ef /packages/turbo-codemod/src/commands/migrate/steps/getCurrentVersion.ts | |
| parent | 94071d7ce16c56641d67d488e2bac6be84ffe731 (diff) | |
| download | HydroRoll-9029588590bea8b10451575c5142dcde77ecd1b5.tar.gz HydroRoll-9029588590bea8b10451575c5142dcde77ecd1b5.zip | |
chore: delete useless files
Diffstat (limited to 'packages/turbo-codemod/src/commands/migrate/steps/getCurrentVersion.ts')
| -rw-r--r-- | packages/turbo-codemod/src/commands/migrate/steps/getCurrentVersion.ts | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/packages/turbo-codemod/src/commands/migrate/steps/getCurrentVersion.ts b/packages/turbo-codemod/src/commands/migrate/steps/getCurrentVersion.ts deleted file mode 100644 index 3644f8b..0000000 --- a/packages/turbo-codemod/src/commands/migrate/steps/getCurrentVersion.ts +++ /dev/null @@ -1,45 +0,0 @@ -import path from "path"; -import { existsSync } from "fs-extra"; - -import getPackageManager from "../../../utils/getPackageManager"; -import { exec } from "../utils"; -import type { MigrateCommandOptions } from "../types"; - -function getCurrentVersion( - directory: string, - opts: MigrateCommandOptions -): string | undefined { - const { from } = opts; - if (from) { - return from; - } - - // try global first - const turboVersionFromGlobal = exec(`turbo --version`, { cwd: directory }); - - if (turboVersionFromGlobal) { - return turboVersionFromGlobal; - } - - // try to use the package manager to find the version - const packageManager = getPackageManager({ directory }); - if (packageManager) { - if (packageManager === "yarn") { - return exec(`yarn turbo --version`, { cwd: directory }); - } - if (packageManager === "pnpm") { - return exec(`pnpm turbo --version`, { cwd: directory }); - } else { - // this doesn't work for npm, so manually build the binary path - const turboBin = path.join(directory, "node_modules", ".bin", "turbo"); - if (existsSync(turboBin)) { - return exec(`${turboBin} --version`, { cwd: directory }); - } - } - } - - // unable to determine local version, - return undefined; -} - -export default getCurrentVersion; |
