bluesky-social / feed-generator

ATProto Feed Generator Starter Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lexicon CLI HOWTO when updating packages

justin opened this issue · comments

I tried updating my fork to use the latest version of the @atproto packages, but there are lexicon changes that seem to be required (and fixed). I'm fine fixing them on my own, but I'm not 100% sure how to use the @atproto/lex-cli package to update the src/lexicon directory properly.

Could someone explain it? Happy to update the README as a PR afterwards.

I just ran into this issue myself. Here's what I've done to get things working after updating all @atproto packages to their latest versions. Note: I also indulged in some hubris and upgraded yarn to 3.6.1 using the 'node-modules' nodeLinker which added some complexity so you may not need to do it exactly like I did when it comes to how you reference the lex-cli commands.

Clone the https://github.com/bluesky-social/atproto repo and run yarn install.

The lex-cli is now available at ./node_modules/.bin/lex

Run ./node_modules/.bin/lex gen-server ./output lexicons/**/*.json. The first argument to lex gen-server is just the directory you want to spit the resulting files out to and I just called it output arbitrarily. Could be wherever you want.

You'll be prompted with a list of the files to be generated and asked if you want to continue. Hit y, then enter. It will think for a second and then declare API generated.

In your output folder, or whatever you named it, you'll find a directory called types, and three files: index.ts, lexicons.ts, and util.ts. Copy all of these and then go to your feed-generator repo.

Delete the contents of the src/lexicon directory, then paste in the files you just generated.

Run yarn start and you should have the firehose streaming in your console.