Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix

Steven Tey9375acd17b3f
diff --git a/packages/cli/README.md b/packages/cli/README.md
index cbb37df7b2..36663e90e2 100644
--- a/packages/cli/README.md
+++ b/packages/cli/README.md
@@ -1,3 +1,3 @@
# `dub-cli`
-A CLI for easily shortening URLs.
+A CLI for easily shortening URLs with the [Dub.co API](https://dub.co/api).
diff --git a/packages/cli/package.json b/packages/cli/package.json
index d9239235c3..12a1004854 100644
--- a/packages/cli/package.json
+++ b/packages/cli/package.json
@@ -1,7 +1,7 @@
{
"name": "dub-cli",
- "version": "0.0.1",
- "description": "A CLI for easily shortening URLs.",
+ "version": "0.0.6",
+ "description": "A CLI for easily shortening URLs with the Dub.co API.",
"publishConfig": {
"access": "public"
},
@@ -37,8 +37,7 @@
"build": "tsup",
"typecheck": "tsc --noEmit",
"clean": "rimraf dist",
- "start": "node dist/index.js ",
- "pub:release": "pnpm build && pnpm publish --access public"
+ "start": "node dist/index.js "
},
"dependencies": {
"chalk": "^5.3.0",
diff --git a/packages/cli/src/api/domains.ts b/packages/cli/src/api/domains.ts
index e24feac503..a72bb60e15 100644
--- a/packages/cli/src/api/domains.ts
+++ b/packages/cli/src/api/domains.ts
@@ -3,11 +3,6 @@ import { getConfig } from "@/utils/config";
import { parseApiResponse } from "@/utils/parser";
import fetch from "node-fetch";
-interface UpdateDomainProps {
- oldSlug: string;
- newSlug: string;
-}
-
export async function getDomains() {
const config = await getConfig();
@@ -33,59 +28,3 @@ export async function getDomains() {
return Array.from(new Set(allSlugs));
}
-
-export async function createDomain(slug: string) {
- const config = await getConfig();
-
- const options = {
- method: "POST",
- headers: {
- Authorization: `Bearer ${config.key}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- slug: slug,
- }),
- };
-
- const response = await fetch("https://api.dub.co/domains", options);
-
- return await parseApiResponse<Domain[]>(response);
-}
-
-export async function updateDomain({ newSlug, oldSlug }: UpdateDomainProps) {
- const config = await getConfig();
-
- const options = {
- method: "PATCH",
- headers: {
- Authorization: `Bearer ${config.key}`,
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- slug: newSlug,
- }),
- };
-
- const response = await fetch(
- `https://api.dub.co/domains/${oldSlug}`,
- options,
- );
-
- return await parseApiResponse<Domain[]>(response);
-}
-
-export async function deleteDomain(slug: string) {
- const config = await getConfig();
-
- const options = {
- method: "DELETE",
- headers: {
- Authorization: `Bearer ${config.key}`,
- },
- };
-
- const response = await fetch(`https://api.dub.co/domains/${slug}`, options);
-
- return await parseApiResponse<Domain["id"]>(response);
-}