Skip to content

Commit

Permalink
finalize
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwidlund committed Nov 1, 2024
1 parent 28bac48 commit b1cd4d7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "checkout-link",
"version": "0.1.1",
"version": "0.1.2",
"license": "Apache-2.0",
"bin": "bin/cli.js",
"type": "module",
Expand Down
4 changes: 1 addition & 3 deletions src/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export const createProduct = async (
size: fs.statSync(absoluteFilePath).size,
readStream,
},
onFileUploadProgress: (file, uploaded) => {
console.log(`Uploaded ${uploaded} bytes of ${file.size}`);
},
onFileUploadProgress: () => {},
onFileUploaded: resolve,
});

Expand Down
2 changes: 1 addition & 1 deletion src/prompts/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const serverPrompt = async () => {
name: "server",
message: "Server",
choices: [
{ title: "Production", value: "production" },
{ title: "Sandbox", value: "sandbox" },
{ title: "Production", value: "production" },
],
});

Expand Down
26 changes: 17 additions & 9 deletions src/ui/success.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,31 @@ import { StatusMessage } from "@inkjs/ui";
import type { CheckoutLink } from "@polar-sh/sdk/models/components/checkoutlink.js";
import type { Product } from "@polar-sh/sdk/models/components/product.js";
import { Box, Text, render } from "ink";
import Link from "ink-link";
import React from "react";
import open from "open";
import spawn from "cross-spawn";

function pbcopy(data: string) {
const proc = spawn("pbcopy");
proc.stdin?.write(data);
proc.stdin?.end();
}

export const successMessage = (
product: Product,
checkoutLink: CheckoutLink,
) => {
pbcopy(checkoutLink.url);

render(
<Box flexDirection="column" columnGap={2}>
<Box flexDirection="column" paddingY={1}>
<Text>🎉 {product.name} was successfully created!</Text>
<Text>🔗 {checkoutLink.url}</Text>
<StatusMessage variant="success">
<Text>🎉 {product.name} was successfully created!</Text>
<Text>Checkout URL copied to clipboard!</Text>
</StatusMessage>
<Box flexDirection="column" paddingY={1}>
<Text color="magentaBright">
{">"} <Link url={checkoutLink.url}>Checkout URL</Link>
</Text>
</Box>
</Box>,
</Box>
);

open(checkoutLink.url);
};

0 comments on commit b1cd4d7

Please sign in to comment.