reddit / devvit

Reddit for Developers
https://developers.reddit.com
BSD 3-Clause "New" or "Revised" License
81 stars 18 forks source link

Improve process for building and testing public repo #111

Open devvit-help-bot[bot] opened 2 weeks ago

devvit-help-bot[bot] commented 2 weeks ago

Details

It's difficult for devs to build the reddit/devvit public repo. For example there are dependencies referencing npm packages that don't exist publicly.

PitchforkAssitant has detailed the steps below for how they got the repo working, but the process should not be so complex.

Additional info

Discord message:
Steps to compile the public-api subpackage:

  1. Delete all the other subpackages and apps (otherwise you'll have to jump through these hoops for all of them).
  2. Remove the @devvit/repo-tools and @reddit/faceplate-ui dependencies from public-api/package.json. They're not public, can't install them.
  3. Change the @devvit/protos, @devvit/shared-types, and @devvit/tsconfig dependencies from -dev to the latest -next version. This is because the matching version aren't present on the GitHub monorepo. For example "@devvit/protos": "0.11.3-dev", would become "@devvit/protos": "0.11.3-next-2024-10-31-9ef830d31.0".
  4. Run npm install in the public-api directory.
  5. Get @devvit/public-api/types/icons.js from a published version and put it in the public-api/src/types directory. Generating this would require whatever make-icons comes from and the presence of the src/types/icons.ts file, neither of which is available.
  6. Get @devvit/public-api/devvit/internals/semanticColors.js from a published version and put it in the public-api/src/devvit/internals directory. You can't build this because the script to build it depends on the private @reddit/faceplate-ui package.
  7. Remove the references to PaymentsService in Devvit.ts, as that's not present in the latest @next version we have.
  8. Now you can do tsc in the public-api directory and it should output a build into public-api/dist. Use output as you see fit (most likely by replacing existing files in the node_modules/@devvit/public-api folder of one of your apps).

Message author: pitchforkassistant

Discord link: https://discord.com/channels/1050224141732687912/1242689647478308895/1303495416469524491

shannon-feng commented 2 weeks ago

Note: this issue was uncovered after reviewing https://github.com/reddit/devvit/pull/109