|
1 | | -#SCN website (operated by LCL) |
| 1 | +# SCN website (operated by LCL) |
| 2 | + |
| 3 | +Code repo for the seattlecommunitynetwork.org website. |
| 4 | + |
| 5 | +This site is built using [SvelteKit](https://svelte.dev/docs/kit/introduction). SvelteKit supports building fully static sites - which is how this site is built. SvelteKit uses NodeJS to run the static site build. |
| 6 | + |
| 7 | +The website is hosted on GitHub pages. See `./.github/workflows/static.yml` for deployment info. |
| 8 | + |
| 9 | + |
| 10 | +## How to update this website |
| 11 | + |
| 12 | +You'll want to run the site locally so you can preview your changes. It's fairly simple to setup if you have any programming experience. |
| 13 | + |
| 14 | +Make your changes and confirm them in your locally running site. Commit change to a feature Branch, and create a pull request in GitHub. |
| 15 | + |
| 16 | +The changes will then need to be reviewed and merged. After merging, a GitHub Action (`./.github/workflows/static.yml`) will kick off to build and deploy the site. This should only take 5 mins, after which your changes will be live! |
| 17 | + |
| 18 | + |
| 19 | +### Local setup |
| 20 | + |
| 21 | +**Install NodeJS** - two options: |
| 22 | + |
| 23 | +1. Download and install NodeJS https://nodejs.org/en/download |
| 24 | +See `./.nvmrc` for the version of NodeJS to install |
| 25 | +1. Use NVM https://github.com/nvm-sh/nvm |
| 26 | + |
| 27 | +**Setup** |
| 28 | + |
| 29 | +1. Clone the repo |
| 30 | +1. Using NVM? |
| 31 | + 1. `nvm install` to install the correct NodeJS version |
| 32 | + 1. `nvm use` to use the installed NodeJS version |
| 33 | +1. Install dependencies with `npm install` |
| 34 | +1. Start a development server `npm run dev` |
| 35 | + |
| 36 | +Open your browser to http://localhost:5173 |
| 37 | + |
| 38 | + |
| 39 | +### Update text |
| 40 | + |
| 41 | +All website text is in `./messages/en.json`. |
| 42 | + |
| 43 | +Adding or removing text sections will most certainly require updating a template |
| 44 | + |
| 45 | + |
| 46 | +### Update templates |
| 47 | + |
| 48 | +The website is built with a bunch of `*.svelte` files. Each file has a section for JS, HTML, and CSS. |
| 49 | + |
| 50 | +Each page of the website starts with a `+page.svelte` template, eg: `./src/routes/+page.svelte` for the homepage, and `./src/routes/about-us/+page.svelte` for the About Us. |
| 51 | + |
| 52 | +There's 1 layout template used for all pages - `./src/routes/+layout.ts`. |
| 53 | + |
| 54 | +There is a variety of reusable components in `./src/lib/components/*.svelte` |
| 55 | + |
| 56 | + |
| 57 | +## Tests |
| 58 | + |
| 59 | +There are automated tests using Playwright. |
| 60 | + |
| 61 | +- run this the first time, to install Playwright dependencies: `npx playwright install` |
| 62 | +- `npm run test` to run tests |
| 63 | + |
| 64 | + |
| 65 | +## Production build |
| 66 | + |
| 67 | +To create a *local* production version of your app: |
| 68 | + |
| 69 | +1. `npm run build` |
| 70 | +1. `npm run preview` |
| 71 | +1. open http://localhost:4137 |
| 72 | + |
| 73 | + |
| 74 | +## Redirects |
| 75 | + |
| 76 | +No good way to do this with GitHub pages, so we need to create stub sveltekit pages that do a client side redirect. |
| 77 | + |
| 78 | +See `./create-redirect.js`. |
0 commit comments