unitaryfund/unitary.fund

Add docs on running website locally

Closed this issue · 3 comments

I might be missing these somewhere, but I have not found any developer docs on spinning up the site locally (what commands do I need to run locally to install all the things, get it running, rebuild, etc). As a little bit of context, I am familiar with npm, but not astro.

cc @joshdavenport, @WrathfulSpatula

Tried further to get this up and running tonight, but I'm stuck. Here's what I did

  1. npm i in root of repo successfully installs dependencies
  2. npm start fails with
[config] Astro found issue(s) with your configuration:
  ! experimental  Invalid experimental key: `redirects`.
Make sure the spelling is correct, and that your Astro version supports this experiment.
See https://docs.astro.build/en/reference/configuration-reference/#experimental-flags for more information..
  1. Fixed this by removing these three lines from the astro config file
    experimental: {
    redirects: true,
    },
  2. npm start then appears to work, but when visiting http://127.0.0.1:3000/, the site crashes with the following error regarding the cloudName variable. This, or a same error occur with all of the scripts in package.json.
 error   "You must supply a cloudName when initializing the asset"
  Hint:
    To get as much information as possible from your errors, make sure to throw Error objects instead of `string`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.
  File:
    /Users/nate/code/unitary.fund/node_modules/astro/dist/core/errors/utils.js:64:19
  Code:
    63 |   } else {
    > 64 |     const error = new Error(JSON.stringify(err));
         |                   ^
      65 |     error.hint = `To get as much information as possible from your errors, make sure to throw Error objects instead of \`${typeof err}\`. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error for more information.`;
      66 |     return error;
      67 |   }

I also noticed while playing around with stuff here that typescript is not included in the package.json file, so I had to manually install that in order to check types. As stated previously, I'm not experienced in this area, so I may be doing something wrong. But when I ran npx tsc --build I did encounter quite a few errors. Is this expected?

Hi both, thanks for your patience on this one. I've added content to the wiki and will be migrating existing docs and writing some further docs there also, here's the relevant page: https://github.com/unitaryfund/unitary.fund/wiki/Getting-Started

The main things to note re steps you took @natestemen are:

  • This project uses pnpm, mainly because it is much faster during builds which is really helpful. It is generally easy to install and I'm using it primarily now because of the speed wins not just locally but during deployment builds but on reflection you guys may prefer to stick to npm, we can switch back quite easily if it's an issue.
  • Astro unflagged redirects as experimental in 2.9.0 and as package.json specifies ^2.8.3, install finds the latest 2.X version (which is 2.10.15 as of writing). This needs to be pinned, which I'll do shortly. Then your next install will find the correct version.
  • TypeScript is a dependency in package.json, you can find it in "devDependencies". Beyond that, Astro handles everything, so using tsc directly will likely behave strangely, notwithstanding skipping Astros dedicated build process. If you want to build locally you can use pnpm build (or which triggers astro build) but locally best to generally stick to pnpm dev as per the wiki unless you're wanting to test build.