Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/commands/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ora from "ora";

import {
BASE_URL,
displayFarcasterInstructions,
displayInstructions,
getProjectJson,
getTemplateUrl,
Expand All @@ -36,6 +37,7 @@ export default class Create extends Command {
static override examples = [
"<%= config.bin %> <%= command.id %>",
'<%= config.bin %> <%= command.id %> --name my-celo-app --owner "John Doe" --hardhat --template Minipay',
'<%= config.bin %> <%= command.id %> --name my-farcaster-app --owner "Jane Smith" --hardhat --template Farcaster',
'<%= config.bin %> <%= command.id %> -n my-app -o "Jane Smith" --no-hardhat',
];

Expand All @@ -58,7 +60,7 @@ export default class Create extends Command {
template: Flags.string({
char: "t",
description: "Template to use for the project",
options: ["Minipay", "Valora"],
options: ["Minipay", "Valora", "Farcaster"],
required: false,
}),
};
Expand Down Expand Up @@ -148,7 +150,7 @@ export default class Create extends Command {

if (useTemplate) {
const { templateName } = await inquirer.prompt({
choices: ["Minipay", "Valora"],
choices: ["Minipay", "Valora", "Farcaster"],
default: "Minipay",
message: "Which template do you want to use?",
name: "templateName",
Expand Down Expand Up @@ -283,7 +285,13 @@ export default class Create extends Command {
symbol: emoji.get("100"),
text: chalk.green(" Done!"),
});
displayInstructions();

// Display template-specific instructions
if (template === "Farcaster") {
displayFarcasterInstructions();
} else {
displayInstructions();
}
} catch (error: unknown) {
console.error(error);
this.log("Error generating project");
Expand Down
77 changes: 77 additions & 0 deletions src/utils/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export const getTemplateUrl = (template: string) => {
return "https://github.com/celo-org/valora-template.git";
}

case "Farcaster": {
return "https://github.com/celo-org/farcaster-template.git";
}

default: {
return "https://github.com/celo-org/minipay-template.git";
}
Expand Down Expand Up @@ -122,3 +126,76 @@ export const displayInstructions = () => {

console.log(chalk.blue.bold("Happy coding! 🎉\n"));
};

export const displayFarcasterInstructions = () => {
console.log(
chalk.green.bold(
"\n🚀 Your Farcaster Frame project has been successfully created!\n"
)
);

console.log(
chalk.bold("Before you start the project, please follow these steps:\n")
);

console.log(chalk.cyan("1.") + " Rename the file:");
console.log(chalk.yellow(" packages/react-app/.env.template"));
console.log(" to");
console.log(chalk.yellow(" packages/react-app/.env\n"));

console.log(
chalk.cyan("2.") +
" Open the newly renamed " +
chalk.yellow(".env") +
" file and add your environment variables:"
);
console.log(
chalk.yellow(" NEXT_PUBLIC_WC_PROJECT_ID=your_walletconnect_project_id")
);
console.log(chalk.yellow(" NEXT_PUBLIC_BASE_URL=http://localhost:3000"));
console.log(chalk.yellow(" NEXT_PUBLIC_CELO_NETWORK=alfajores\n"));

console.log(
chalk.cyan("3.") +
" Get your WalletConnect Cloud Project ID from " +
chalk.blue("https://cloud.walletconnect.com\n")
);

console.log(
chalk.cyan("4.") + " Update your Farcaster Frame configuration in:"
);
console.log(chalk.yellow(" packages/react-app/public/.well-known/\n"));

console.log(
chalk.bold("Once you've done that, you're all set to start your project!\n")
);

console.log(
chalk.green.bold(
"Run the following commands from the packages/react-app folder to start the project:\n"
)
);
console.log(chalk.yellow(" yarn install"));
console.log(chalk.yellow(" yarn dev\n"));

console.log(
chalk.green(
"For deploying your Farcaster Frame, please refer to the Deployment Guide:"
)
);
console.log(
chalk.blue(
"https://github.com/celo-org/celo-composer/blob/main/docs/DEPLOYMENT_GUIDE.md"
)
);

console.log(chalk.green("For Frame development and testing, visit:"));
console.log(chalk.blue("https://warpcast.com/~/developers/frames\n"));

console.log(
chalk.green("Thank you for using Celo Composer!") +
" If you have any questions or need further assistance, please refer to the README or reach out to our team.\n"
);

console.log(chalk.blue.bold("Happy Frame building! 🎨\n"));
};