Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify how to run this locally #1

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .codespellignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sade
9 changes: 9 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[codespell]
skip =
*.po,
*.ts,
tests/*
count =
quiet-level = 3
ignore-words-list =
cips
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# EditorConfig: https://EditorConfig.org. Provides sensible defaults for
# non vscode editors.

# top-most EditorConfig file
root = true

# Every file.
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true

indent_style = space
indent_size = 4

trim_trailing_whitespace = true
15 changes: 15 additions & 0 deletions .github/workflows/.pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ Thumbs.db
# Vite
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

# PNPM
package-lock.json
15 changes: 15 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

---
default: true

# Exceptions, example given, MD045
# MD045: false # allow image with no tag

# In-line HTML.
MD033: false
# Line lengths
MD013:
line_length: 80
tables: false
# First line in a file should be a top-level heading
MD041: false
3 changes: 3 additions & 0 deletions .markdownlintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
drafts/*
LICENSE.md
SECURITY.md
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-json
- id: check-toml
- id: end-of-file-fixer
exclude: ".svg"
- id: trailing-whitespace
- id: check-case-conflict
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.42.0
hooks:
- id: markdownlint
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
- id: codespell
args: [-I .codespellignore]
46 changes: 36 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
# Orcfax Archive Viewer

Orcfax Archive Viewer is a Svelte app that compiles everything needed to explore a single Orcfax Fact Statement archive from Arweave into a single static `index.html` file that is intended to be used locally and offline.
Orcfax Archive Viewer is a Svelte app that compiles everything needed to explore
a single Orcfax Fact Statement archive from Arweave into a single static
`index.html` file that is intended to be used locally and offline.

The compiled static `index.html` file is packaged along with the [Orcfax Explorer](https://github.com/orcfax/explorer.orcfax.io) as a static asset so that it can be downloaded and packaged along with a full Fact Statement archive folder which is fetched from Arweave.
The compiled static `index.html` file is packaged along with the
[Orcfax Explorer](https://github.com/orcfax/explorer.orcfax.io) as a static
asset so that it can be downloaded and packaged along with a full Fact Statement
archive folder which is fetched from Arweave.

The viewer does not access the folder of archived files directly, instead, on download from the Explorer, a JSON representation of the archive's contents are injected into a global window variable so it can be used internally.
The viewer does not access the folder of archived files directly, instead, on
download from the Explorer, a JSON representation of the archive's contents are
injected into a global window variable so it can be used internally.

An example JSON file is included in the repo for local development purposes.

## Developing

Once you've cloned the repo and installed dependencies with `pnpm i`, start a development server:
Clone the repository and install the dependencies:

```bash
pnpm run dev
```sh
git clone [email protected]:orcfax/orcfax-archive-viewer.git
cd orcfax-archive-viewer
pnpm i
```

To run the viewer with local test data, copy the contents of `example-archive.json` and paste it in place of `'DATA_PLACEHOLDER'` at the bottom of `/index.html` located at the project's root.

## Building

Before creating a new build, it is recommended to run formatting and linting first:
To run the viewer with local test data, copy the contents of
`example-archive.json` and paste it in place of `'DATA_PLACEHOLDER'` (NB.
replace the single-quotation marks as well) at the bottom of `/index.html`
located at the root of this repository.

Once you have replaced the `'DATA_PLACEHOLDER'` (including quotes) it is
recommended to run formatting and linting first. This will prettify the source
data.

```bash
pnpm run format
Expand All @@ -33,4 +47,16 @@ To create a new production version of the viewer, run:
pnpm run build
```

After building, you will see `index.html` under the build folder. The contents of this file are then to be copied and pasted over the contents of `/static/archive-viewer.html` in the [Explorer](https://github.com/orcfax/explorer.orcfax.io/blob/main/static/archive-viewer.html).
After building, you will find `index.html` under the build folder.

## Viewing

Start a development server with:

```bash
pnpm run dev
```

The local archive will be visible at the server location and port on your
localhost, e.g. `http://<localhost-ip>:<port>/`. Alternatively, open the
`build/index.html` file in your choice of web-browser.
20 changes: 20 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ROOT := `git rev-parse --show-toplevel`
# Get help
help:
just -l

# (Re-)build the glossary
build:
node {{ROOT}}/builder/index.js --input {{ROOT}}/content > {{ROOT}}/docs/index.html

# Run all pre-commit checks
all-checks:
pre-commit run --all-files

# Run pre-commit spelling check
spell:
pre-commit run codespell --all-files

# Run pre-commit makdown-lint
markdown:
pre-commit run markdownlint --all-files
Loading