aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts')
-rw-r--r--packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts31
1 files changed, 0 insertions, 31 deletions
diff --git a/packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts b/packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts
deleted file mode 100644
index a6ab7e6..0000000
--- a/packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import axios from "axios";
-
-import type { MigrateCommandOptions } from "../types";
-
-const REGISTRY = "https://registry.npmjs.org";
-
-async function getPackageDetails({ packageName }: { packageName: string }) {
- try {
- const result = await axios.get(`${REGISTRY}/${packageName}`);
- return result.data;
- } catch (err) {
- throw new Error(`Unable to fetch the latest version of ${packageName}`);
- }
-}
-
-export default async function getLatestVersion({
- to,
-}: MigrateCommandOptions): Promise<string | undefined> {
- const packageDetails = await getPackageDetails({ packageName: "turbo" });
- const { "dist-tags": tags, versions } = packageDetails;
-
- if (to) {
- if (tags[to] || versions[to]) {
- return to;
- } else {
- throw new Error(`turbo@${to} does not exist`);
- }
- }
-
- return tags.latest as string;
-}