mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
feat: update deploy parsing
This commit is contained in:
parent
01231de8f4
commit
28cafb2808
@ -17,6 +17,12 @@ cd <PROJECT_NAME>
|
|||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Deploy to Vercel
|
||||||
|
For projects that have made minimal changes to the quickstart template, deploy to vercel by running:
|
||||||
|
```{bash}
|
||||||
|
npm run deploy:vercel
|
||||||
|
```
|
||||||
|
|
||||||
## Building for Production
|
## Building for Production
|
||||||
|
|
||||||
To create a production build, run:
|
To create a production build, run:
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "create-neynar-farcaster-frame",
|
"name": "create-neynar-farcaster-frame",
|
||||||
"version": "1.1.6",
|
"version": "1.1.7",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"bin/index.js"
|
"bin/index.js"
|
||||||
|
|||||||
@ -373,13 +373,7 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
...(process.env.NEYNAR_API_KEY && { NEYNAR_API_KEY: process.env.NEYNAR_API_KEY }),
|
...(process.env.NEYNAR_API_KEY && { NEYNAR_API_KEY: process.env.NEYNAR_API_KEY }),
|
||||||
...(process.env.NEYNAR_CLIENT_ID && { NEYNAR_CLIENT_ID: process.env.NEYNAR_CLIENT_ID }),
|
...(process.env.NEYNAR_CLIENT_ID && { NEYNAR_CLIENT_ID: process.env.NEYNAR_CLIENT_ID }),
|
||||||
|
|
||||||
// Frame metadata and images
|
// Frame metadata
|
||||||
...(process.env.NEXT_PUBLIC_FRAME_SPLASH_IMAGE_URL && {
|
|
||||||
NEXT_PUBLIC_FRAME_SPLASH_IMAGE_URL: process.env.NEXT_PUBLIC_FRAME_SPLASH_IMAGE_URL
|
|
||||||
}),
|
|
||||||
...(process.env.NEXT_PUBLIC_FRAME_ICON_IMAGE_URL && {
|
|
||||||
NEXT_PUBLIC_FRAME_ICON_IMAGE_URL: process.env.NEXT_PUBLIC_FRAME_ICON_IMAGE_URL
|
|
||||||
}),
|
|
||||||
...(frameMetadata && { FRAME_METADATA: frameMetadata }),
|
...(frameMetadata && { FRAME_METADATA: frameMetadata }),
|
||||||
|
|
||||||
// Public vars
|
// Public vars
|
||||||
@ -388,8 +382,6 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
.filter(([key]) => key.startsWith('NEXT_PUBLIC_'))
|
.filter(([key]) => key.startsWith('NEXT_PUBLIC_'))
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
console.log('vercelEnv');
|
|
||||||
console.log(vercelEnv);
|
|
||||||
|
|
||||||
// Add or update env vars in Vercel project
|
// Add or update env vars in Vercel project
|
||||||
console.log('\n📝 Setting up environment variables...');
|
console.log('\n📝 Setting up environment variables...');
|
||||||
@ -439,18 +431,31 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
// Verify the actual domain after deployment
|
// Verify the actual domain after deployment
|
||||||
|
|
||||||
console.log('\n🔍 Verifying deployment domain...');
|
console.log('\n🔍 Verifying deployment domain...');
|
||||||
const projectOutput = execSync('vercel project ls', {
|
|
||||||
|
// Create a temporary file path
|
||||||
|
const tempOutputFile = path.join(projectRoot, 'vercel_output.txt');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Redirect output to a file
|
||||||
|
execSync(`vercel project ls > "${tempOutputFile}" 2>&1`, {
|
||||||
cwd: projectRoot,
|
cwd: projectRoot,
|
||||||
encoding: 'utf8',
|
shell: true
|
||||||
stdio: ['inherit', 'pipe', 'inherit'] // Capture stdout but show stderr
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const projectLines = projectOutput.split('\n');
|
// Read the output file
|
||||||
|
const projectOutput = fs.readFileSync(tempOutputFile, 'utf8');
|
||||||
|
console.log('Raw project output:', projectOutput);
|
||||||
|
|
||||||
|
// Process the output
|
||||||
|
const projectLines = projectOutput
|
||||||
|
.split('\n')
|
||||||
|
.filter(line => line.includes('https://'));
|
||||||
|
|
||||||
console.log('Project lines:', projectLines);
|
console.log('Project lines:', projectLines);
|
||||||
|
|
||||||
// Find the line containing our project name
|
// Find the line containing our project name
|
||||||
const currentProject = projectLines.find(line =>
|
const currentProject = projectLines.find(line =>
|
||||||
line.includes(projectName) && line.includes('https://')
|
line.includes(projectName)
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log('Current project line:', currentProject);
|
console.log('Current project line:', currentProject);
|
||||||
@ -504,6 +509,22 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
console.warn('⚠️ Warning: Failed to update NEXTAUTH_URL with correct domain');
|
console.warn('⚠️ Warning: Failed to update NEXTAUTH_URL with correct domain');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update NEXT_PUBLIC_URL
|
||||||
|
try {
|
||||||
|
execSync(`vercel env rm NEXT_PUBLIC_URL production -y`, {
|
||||||
|
cwd: projectRoot,
|
||||||
|
stdio: 'ignore',
|
||||||
|
env: process.env
|
||||||
|
});
|
||||||
|
execSync(`printf "%s" "https://${actualDomain}" | vercel env add NEXT_PUBLIC_URL production`, {
|
||||||
|
cwd: projectRoot,
|
||||||
|
stdio: 'inherit',
|
||||||
|
env: process.env
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('⚠️ Warning: Failed to update NEXT_PUBLIC_URL with correct domain');
|
||||||
|
}
|
||||||
|
|
||||||
// Redeploy with updated environment variables
|
// Redeploy with updated environment variables
|
||||||
console.log('\n📦 Redeploying with correct domain...');
|
console.log('\n📦 Redeploying with correct domain...');
|
||||||
execSync('vercel deploy --prod', {
|
execSync('vercel deploy --prod', {
|
||||||
@ -521,6 +542,22 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
console.warn('⚠️ Could not find project in Vercel project list');
|
console.warn('⚠️ Could not find project in Vercel project list');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clean up the temporary file
|
||||||
|
fs.unlinkSync(tempOutputFile);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error:', error);
|
||||||
|
|
||||||
|
// Try to read the output file even if there was an error
|
||||||
|
try {
|
||||||
|
if (fs.existsSync(tempOutputFile)) {
|
||||||
|
const errorOutput = fs.readFileSync(tempOutputFile, 'utf8');
|
||||||
|
console.log('Error output file contents:', errorOutput);
|
||||||
|
fs.unlinkSync(tempOutputFile);
|
||||||
|
}
|
||||||
|
} catch (readError) {
|
||||||
|
console.error('Error reading output file:', readError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log('\n✨ Deployment complete! Your frame is now live at:');
|
console.log('\n✨ Deployment complete! Your frame is now live at:');
|
||||||
console.log(`🌐 https://${domain}`);
|
console.log(`🌐 https://${domain}`);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user