aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2023-11-03 21:25:40 +0800
committer简律纯 <i@jyunko.cn>2023-11-03 21:25:40 +0800
commit9029588590bea8b10451575c5142dcde77ecd1b5 (patch)
tree04cf8aee56c23fd225ff19d340f7cee621d874ef /packages/turbo-codemod/src/commands/migrate/steps/getLatestVersion.ts
parent94071d7ce16c56641d67d488e2bac6be84ffe731 (diff)
downloadHydroRoll-9029588590bea8b10451575c5142dcde77ecd1b5.tar.gz
HydroRoll-9029588590bea8b10451575c5142dcde77ecd1b5.zip
chore: delete useless files
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;
-}