pub.solar/README.md

90 lines
2.9 KiB
Markdown
Raw Normal View History

2022-10-03 16:54:26 +00:00
# pub.solar homepage
This is the repository containing the code for https://pub.solar.
2022-10-20 14:17:19 +00:00
It is built using [lume](https://lume.land/) with JSX. To get started, make sure
2023-07-02 22:33:32 +00:00
you have the [nix package manager](https://nixos.org/download.html) installed.
Then you can start developing with:
2022-10-03 16:54:26 +00:00
### Quick start
2022-10-03 16:54:26 +00:00
```
2023-07-02 22:33:32 +00:00
nix develop
2022-10-03 16:54:26 +00:00
```
2023-07-02 22:33:32 +00:00
This will use a [nix devshell](https://nix.dev/tutorials/first-steps/ad-hoc-shell-environments#ad-hoc-envs)
to create an environment that has [deno](https://deno.land/) and [lume](https://lume.land/)
2022-10-20 14:17:19 +00:00
available.
2022-10-03 16:54:26 +00:00
2023-07-02 22:33:32 +00:00
An alternative approach for loading all dependencies is [`direnv`](https://direnv.net).
It basically runs `nix develop` for you, once you enter a directory which
contains a `.envrc` file and allow it by running `direnv allow`. Once installed
globally, run:
```
direnv allow
```
2022-10-03 16:54:26 +00:00
To get a live development server, run
```
2023-07-02 22:33:32 +00:00
deno task serve
2022-10-03 16:54:26 +00:00
```
2022-10-20 14:17:19 +00:00
Unfortunately, hot module reloading is currently broken for JSX modules, so
you'll need to restart this process regularly during development.
2022-10-03 16:54:26 +00:00
## Updating Open Sans
2022-10-20 14:17:19 +00:00
To update the font files and CSS, run `google-font-downloader $FONT_CSS_URL`.
2022-10-20 16:21:34 +00:00
As "documentation" `flake.nix` shows the internals, and
2022-10-20 14:17:19 +00:00
`_includes/styles/typography.css` has a comment at the top that shows which
command was used to generate it.
2024-04-12 17:43:52 +00:00
### Deployment
Our [Drone CI](https://ci.pub.solar/pub-solar/pub.solar) is configured to
deploy the `main` branch to the production website. To integrate any changes,
first create a pull request, which will be reviewed. After merging it, the new
version will get deployed automatically.
### Troubleshooting
When running `deno task serve`, if you see an error message like:
```
NotFound: No such file or directory (os error 2): stat '/home/<user>/.../git.pub.solar/pub-solar/pub.solar/.direnv/flake-inputs/5acdh8xyry0kdvp6xla2hw7wf3zkphkl-source/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/foo.nix'
at Object.statSync (ext:deno_fs/30_fs.js:362:7)
at FS.#walkLink (https://deno.land/x/lume@v2.0.1/core/fs.ts:143:23)
at FS.#walkFs (https://deno.land/x/lume@v2.0.1/core/fs.ts:117:23)
at FS.#walkFs (https://deno.land/x/lume@v2.0.1/core/fs.ts:136:21)
at FS.#walkFs (https://deno.land/x/lume@v2.0.1/core/fs.ts:136:21)
at FS.#walkFs (https://deno.land/x/lume@v2.0.1/core/fs.ts:136:21)
at FS.#walkFs (https://deno.land/x/lume@v2.0.1/core/fs.ts:136:21)
at FS.#walkFs (https://deno.land/x/lume@v2.0.1/core/fs.ts:136:21)
at FS.#walkFs (https://deno.land/x/lume@v2.0.1/core/fs.ts:136:21)
at FS.#walkFs (https://deno.land/x/lume@v2.0.1/core/fs.ts:136:21) {
name: "NotFound",
code: "ENOENT"
}
```
try removing the .direnv directory:
```
rm -rf .direnv
deno task serve
```
Another common error message after updating dependencies is:
```
22.31 error: The source code is invalid, as it does not match the expected hash in the lock file.
```
To recreate the deno lock file, run
```
deno cache --lock=deno.lock --lock-write _config.ts
```