mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-04-11 05:57:37 +02:00
Add init script and instructions for dev setup
This commit is contained in:
parent
77180b9568
commit
4b65e30c95
3 changed files with 69 additions and 8 deletions
|
@ -1,16 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Pre-commit hook to run lightweight checks and auto-format the code. It's designed
|
||||
# to be blazingly fast, so it checks only changed files. Run the following command
|
||||
# to install this hook for yourself. It's a symlink, to make sure it stays always
|
||||
# up-to-date.
|
||||
# to be blazingly fast, so it checks only changed files.
|
||||
#
|
||||
# ```bash
|
||||
# ln -s ../../.githooks/pre-commit .git/hooks/pre-commit
|
||||
# ```
|
||||
# You can install this hook and some of its dependencies by running `scripts/init.sh`.
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
# ```
|
||||
function command_exists() {
|
||||
bin_name=$(basename "$1")
|
||||
|
||||
|
|
38
README.md
38
README.md
|
@ -2,7 +2,7 @@
|
|||
|
||||

|
||||
|
||||
## Getting started
|
||||
## Getting Started
|
||||
|
||||
On systems with `docker` and `docker compose` installed, the process should be as simple as:
|
||||
|
||||
|
@ -20,6 +20,42 @@ podman-compose up
|
|||
|
||||
Once the application has started, navigate to http://localhost:8080 and login with admin@example.com / philomena123
|
||||
|
||||
## Development
|
||||
|
||||
### Dependencies
|
||||
|
||||
Install NodeJS, Rust and Elixir toolchains. Then, run the following command to install other dependencies and configure the git pre-commit hook that will auto-format the code and run lightweight checks on each commit:
|
||||
|
||||
```
|
||||
./scripts/init.sh
|
||||
```
|
||||
|
||||
### VSCode Extensions
|
||||
|
||||
If you are using VSCode, then the following extensions are recommended:
|
||||
|
||||
| Extension | Short description |
|
||||
| -------------------------------------------------- | ------------------------------------------------------- |
|
||||
| [Rust Analyzer][vscode-rust-analyzer] | Rust LSP |
|
||||
| [Lexical][vscode-lexical] | Elixir LSP |
|
||||
| [PostCSS Language Support][vscode-postcss] | PostCSS LSP |
|
||||
| [Slime][vscode-slime] | `.slime` syntax highlighting |
|
||||
| [ESLint][vscode-eslint] | `.js`, `.ts` linter |
|
||||
| [Stylelint][vscode-stylelint] | `.css` linter |
|
||||
| [Prettier - Code formatter][vscode-prettier] | `.js`, `.ts`. `.css`, `.json`, `.yaml`, `.md` formatter |
|
||||
| [Typos Spell Checker][vscode-typos] | Spell checker enforced on CI |
|
||||
| [Jest Snapshot Language Support][vscode-jest-snap] | `.toMatchInlineSnapshot()` syntax highlighting |
|
||||
|
||||
[vscode-rust-analyzer]: https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer
|
||||
[vscode-lexical]: https://marketplace.visualstudio.com/items?itemName=lexical-lsp.lexical
|
||||
[vscode-postcss]: https://marketplace.visualstudio.com/items?itemName=csstools.postcss
|
||||
[vscode-slime]: https://marketplace.visualstudio.com/items?itemName=xolan.slime
|
||||
[vscode-eslint]: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
|
||||
[vscode-stylelint]: https://marketplace.visualstudio.com/items?itemName=stylelint.vscode-stylelint
|
||||
[vscode-prettier]: https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode
|
||||
[vscode-typos]: https://marketplace.visualstudio.com/items?itemName=tekumara.typos-vscode
|
||||
[vscode-jest-snap]: https://marketplace.visualstudio.com/items?itemName=tlent.jest-snapshot-language-support
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you are running Docker on Windows and the application crashes immediately upon startup, please ensure that `autocrlf` is set to `false` in your Git config, and then re-clone the repository. Additionally, it is recommended that you allocate at least 4GB of RAM to your Docker VM.
|
||||
|
|
29
scripts/init.sh
Executable file
29
scripts/init.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
# Script to initialize the repo for development.
|
||||
|
||||
set -euxo pipefail
|
||||
|
||||
function fetch {
|
||||
local url="$1"
|
||||
curl --fail --silent --show-error --location --retry-all-errors "$url"
|
||||
}
|
||||
|
||||
function fetch_github_artifact_url {
|
||||
local owner_and_repo="$1"
|
||||
local artifact_pattern="$2"
|
||||
|
||||
fetch "https://api.github.com/repos/$owner_and_repo/releases/latest" \
|
||||
| grep browser_download_url \
|
||||
| grep "$artifact_pattern" \
|
||||
| cut --delimiter '"' --fields 4
|
||||
}
|
||||
|
||||
# Install `typos` CLI
|
||||
typos_url=$(fetch_github_artifact_url crate-ci/typos x86_64-unknown-linux-musl)
|
||||
fetch "$typos_url" | sudo tar -xzC /usr/local/bin ./typos
|
||||
|
||||
# Install prettier (see top-level package.json)
|
||||
npm ci --ignore-scripts
|
||||
|
||||
# Install the pre-commit hook. It's a symlink, to make sure it stays always up-to-date.
|
||||
ln -sf ../../.githooks/pre-commit .git/hooks/pre-commit
|
Loading…
Add table
Reference in a new issue