mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
fix: frame metadata formatting
This commit is contained in:
parent
1d55fbe940
commit
44eeeddfc2
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "create-neynar-farcaster-frame",
|
"name": "create-neynar-farcaster-frame",
|
||||||
"version": "1.1.4",
|
"version": "1.1.5",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
"bin/index.js"
|
"bin/index.js"
|
||||||
|
|||||||
@ -310,12 +310,6 @@ async function main() {
|
|||||||
`NEXT_PUBLIC_FRAME_DESCRIPTION="${process.env.NEXT_PUBLIC_FRAME_DESCRIPTION || ''}"`,
|
`NEXT_PUBLIC_FRAME_DESCRIPTION="${process.env.NEXT_PUBLIC_FRAME_DESCRIPTION || ''}"`,
|
||||||
`NEXT_PUBLIC_FRAME_BUTTON_TEXT="${buttonText}"`,
|
`NEXT_PUBLIC_FRAME_BUTTON_TEXT="${buttonText}"`,
|
||||||
|
|
||||||
// Image URLs (if they exist in current env)
|
|
||||||
...(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}"`] : []),
|
|
||||||
|
|
||||||
// Neynar configuration (if it exists in current env)
|
// Neynar configuration (if it exists in current env)
|
||||||
...(process.env.NEYNAR_API_KEY ?
|
...(process.env.NEYNAR_API_KEY ?
|
||||||
[`NEYNAR_API_KEY="${process.env.NEYNAR_API_KEY}"`] : []),
|
[`NEYNAR_API_KEY="${process.env.NEYNAR_API_KEY}"`] : []),
|
||||||
|
|||||||
@ -43,7 +43,7 @@ async function generateFarcasterMetadata(domain, accountAddress, seedPhrase, web
|
|||||||
});
|
});
|
||||||
const encodedSignature = Buffer.from(signature, 'utf-8').toString('base64url');
|
const encodedSignature = Buffer.from(signature, 'utf-8').toString('base64url');
|
||||||
|
|
||||||
return {
|
const metadata = {
|
||||||
accountAssociation: {
|
accountAssociation: {
|
||||||
header: encodedHeader,
|
header: encodedHeader,
|
||||||
payload: encodedPayload,
|
payload: encodedPayload,
|
||||||
@ -61,6 +61,9 @@ async function generateFarcasterMetadata(domain, accountAddress, seedPhrase, web
|
|||||||
webhookUrl,
|
webhookUrl,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Return stringified metadata to ensure proper JSON formatting
|
||||||
|
return JSON.stringify(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function loadEnvLocal() {
|
async function loadEnvLocal() {
|
||||||
@ -377,7 +380,7 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
...(process.env.NEXT_PUBLIC_FRAME_ICON_IMAGE_URL && {
|
...(process.env.NEXT_PUBLIC_FRAME_ICON_IMAGE_URL && {
|
||||||
NEXT_PUBLIC_FRAME_ICON_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: JSON.stringify(frameMetadata) }),
|
...(frameMetadata && { FRAME_METADATA: frameMetadata }),
|
||||||
|
|
||||||
// Public vars
|
// Public vars
|
||||||
...Object.fromEntries(
|
...Object.fromEntries(
|
||||||
@ -385,6 +388,8 @@ 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...');
|
||||||
@ -402,8 +407,8 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
// Ignore errors from removal (var might not exist)
|
// Ignore errors from removal (var might not exist)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the new env var
|
// Add the new env var without newline
|
||||||
execSync(`echo "${value}" | vercel env add ${key} production`, {
|
execSync(`printf "%s" "${value}" | vercel env add ${key} production`, {
|
||||||
cwd: projectRoot,
|
cwd: projectRoot,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
env: process.env
|
env: process.env
|
||||||
@ -440,7 +445,9 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const projectLines = projectOutput.split('\n');
|
const projectLines = projectOutput.split('\n');
|
||||||
const currentProject = projectLines.find(line => line.includes('(current)'));
|
const currentProject = projectLines.find(line => line.includes(projectName));
|
||||||
|
console.log('currentProject');
|
||||||
|
console.log(currentProject);
|
||||||
if (currentProject) {
|
if (currentProject) {
|
||||||
const actualDomain = currentProject.split(/\s+/)[1]?.replace('https://', '');
|
const actualDomain = currentProject.split(/\s+/)[1]?.replace('https://', '');
|
||||||
if (actualDomain && actualDomain !== domain) {
|
if (actualDomain && actualDomain !== domain) {
|
||||||
@ -461,7 +468,7 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
env: process.env
|
env: process.env
|
||||||
});
|
});
|
||||||
execSync(`echo "${JSON.stringify(frameMetadata)}" | vercel env add FRAME_METADATA production`, {
|
execSync(`printf "%s" "${frameMetadata}" | vercel env add FRAME_METADATA production`, {
|
||||||
cwd: projectRoot,
|
cwd: projectRoot,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
env: process.env
|
env: process.env
|
||||||
@ -478,7 +485,7 @@ async function deployToVercel(useGitHub = false) {
|
|||||||
stdio: 'ignore',
|
stdio: 'ignore',
|
||||||
env: process.env
|
env: process.env
|
||||||
});
|
});
|
||||||
execSync(`echo "https://${actualDomain}" | vercel env add NEXTAUTH_URL production`, {
|
execSync(`printf "%s" "https://${actualDomain}" | vercel env add NEXTAUTH_URL production`, {
|
||||||
cwd: projectRoot,
|
cwd: projectRoot,
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
env: process.env
|
env: process.env
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user