mirror of
https://github.com/neynarxyz/create-farcaster-mini-app.git
synced 2025-11-16 08:08:56 -05:00
feat: export init function
This commit is contained in:
parent
b940d16d4c
commit
f018890e78
@ -17,7 +17,13 @@ cd <PROJECT_NAME>
|
|||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deploy to Vercel
|
### Importing the CLI
|
||||||
|
To invoke the CLI directly in JavaScript, add the npm package to your project and use the following import statement:
|
||||||
|
```{javascript}
|
||||||
|
import { init } from 'create-neynar-farcaster-frame';
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deploying to Vercel
|
||||||
For projects that have made minimal changes to the quickstart template, deploy to vercel by running:
|
For projects that have made minimal changes to the quickstart template, deploy to vercel by running:
|
||||||
```{bash}
|
```{bash}
|
||||||
npm run deploy:vercel
|
npm run deploy:vercel
|
||||||
|
|||||||
16
bin/index.js
16
bin/index.js
@ -63,7 +63,7 @@ async function lookupFidByCustodyAddress(custodyAddress, apiKey) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://api.neynar.com/v2/farcaster/user/custody-address?custody_address=${custodyAddress}`,
|
`https://api.neynar.com/v2/farcaster/user/bulk-by-address?addresses=${custodyAddress}&address_types=custody_address`,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
'accept': 'application/json',
|
'accept': 'application/json',
|
||||||
@ -84,7 +84,8 @@ async function lookupFidByCustodyAddress(custodyAddress, apiKey) {
|
|||||||
return data.user.fid;
|
return data.user.fid;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
// Export the main CLI function for programmatic use
|
||||||
|
export async function init() {
|
||||||
printWelcomeMessage();
|
printWelcomeMessage();
|
||||||
|
|
||||||
// Ask about Neynar usage
|
// Ask about Neynar usage
|
||||||
@ -475,7 +476,10 @@ async function init() {
|
|||||||
console.log(' npm run dev\n');
|
console.log(' npm run dev\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
init().catch((err) => {
|
// Only run the CLI automatically if this file is being run directly
|
||||||
console.error('Error:', err);
|
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
||||||
process.exit(1);
|
init().catch((err) => {
|
||||||
});
|
console.error('Error:', err);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "create-neynar-farcaster-frame",
|
"name": "create-neynar-farcaster-frame",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
"exports": {
|
||||||
|
".": "./bin/index.js"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"bin/index.js"
|
"bin/index.js"
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user