Skip to content

Commit

Permalink
Merge pull request #11 from OKN-CollabNext/update-readme
Browse files Browse the repository at this point in the history
Update README
  • Loading branch information
kaaloo committed Apr 17, 2024
2 parents 042f5eb + 652da28 commit 0fe3b29
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 7 deletions.
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,37 @@ The OPENALEX_EMAIL secret is used to [speed up calls](https://docs.openalex.org/

## Running

This project uses [Observable Framework](https://observablehq.com/framework/). You can run the site locally as follows
This project uses [Observable Framework](https://observablehq.com/framework/). You can run the site locally in development mode as follows

```bash
invoke run
invoke install
invoke dev
```

The homepage will be launched in your browser at http://127.0.0.1:3000

## Deploying

Deployments to this project on the Observable Cloud take place through the **Deploy** GitHub Action whenever new commits are added to the `main` branch or manually [through the GitHub UI](https://github.com/OKN-CollabNext/KnowHax/actions/workflows/deploy.yaml).

## Invoke Commands

You can run various other commands using `invoke` as follows.

Deploy the site to Observable Cloud.

```bash
invoke deploy
```

Build the static web site locally.

```bash
invoke build
```

Delete local git branches that have already been merged.

```bash
invoke clean-branches
```
32 changes: 27 additions & 5 deletions tasks.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,49 @@
import contextlib
import os
from pathlib import Path

from invoke import task


# context manager that make sure subsequent
# commands are run in the specified directory
@contextlib.contextmanager
def cwd(rel_path: str):
prev_cwd = os.getcwd()
try:
os.chdir(Path(__file__).parent / rel_path)
yield
finally:
os.chdir(prev_cwd)


@task
def hello(_):
print("Hello, world!")


@task
def install(c):
c.run("cd observable && yarn install")
with cwd("observable"):
c.run("yarn install")


@task
def build(c):
c.run("cd observable && yarn build")
with cwd("observable"):
c.run("yarn build")


@task
def run(c):
c.run("cd observable && yarn dev")
def dev(c):
with cwd("observable"):
c.run("yarn dev")


@task
def deploy(c):
c.run("cd observable && yarn deploy")
with cwd("observable"):
c.run("yarn deploy")


@task
Expand Down

0 comments on commit 0fe3b29

Please sign in to comment.