mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-18 17:09:47 -05:00
feat: ask for splash image url
This commit is contained in:
24
bin/index.js
24
bin/index.js
@@ -38,6 +38,24 @@ async function init() {
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'buttonText',
|
||||
message: 'Enter the button text for your frame:',
|
||||
default: 'Launch Frame',
|
||||
validate: (input) => {
|
||||
if (input.trim() === '') {
|
||||
return 'Button text cannot be empty';
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'splashImageUrl',
|
||||
message: 'Enter the URL for your splash image\n(optional -- leave blank to use the default public/splash.png image or replace public/splash.png with your own)\n\nExternal splash image URL:',
|
||||
default: null
|
||||
},
|
||||
{
|
||||
type: 'password',
|
||||
name: 'seedPhrase',
|
||||
@@ -92,9 +110,11 @@ async function init() {
|
||||
const envExampleContent = fs.readFileSync(envExamplePath, 'utf8');
|
||||
// Write it to .env
|
||||
fs.writeFileSync(envPath, envExampleContent);
|
||||
// Append project name and description to .env
|
||||
// Append project name, description, and button text to .env
|
||||
fs.appendFileSync(envPath, `\nNEXT_PUBLIC_FRAME_NAME="${answers.projectName}"`);
|
||||
fs.appendFileSync(envPath, `\nNEXT_PUBLIC_FRAME_DESCRIPTION="${answers.description}"`);
|
||||
fs.appendFileSync(envPath, `\nNEXT_PUBLIC_FRAME_BUTTON_TEXT="${answers.buttonText}"`);
|
||||
fs.appendFileSync(envPath, `\nNEXT_PUBLIC_FRAME_SPLASH_IMAGE_URL="${answers.splashImageUrl}"`);
|
||||
fs.unlinkSync(envExamplePath);
|
||||
console.log('\nCreated .env file from .env.example');
|
||||
} else {
|
||||
@@ -138,7 +158,7 @@ async function init() {
|
||||
execSync('git add .', { cwd: projectPath });
|
||||
execSync('git commit -m "initial commit from frames-v2-quickstart"', { cwd: projectPath });
|
||||
|
||||
console.log(`\n🪐 ✨ Successfully created frame ${projectName} with git and dependencies installed! ✨🪐`);
|
||||
console.log(`\n🪐✨ Successfully created frame ${projectName} with git and dependencies installed! ✨🪐`);
|
||||
console.log('\nTo run the app:');
|
||||
console.log(` cd ${projectName}`);
|
||||
console.log(' npm run dev\n');
|
||||
|
||||
Reference in New Issue
Block a user