Skip to content

Commit

Permalink
feat: CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Oct 2, 2024
1 parent 25d3dce commit 1fcb2c0
Show file tree
Hide file tree
Showing 21 changed files with 4,675 additions and 212 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-geese-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kopflos-cms/core": patch
---

Revert dependency on `anylogger` to stable v1 branch
5 changes: 5 additions & 0 deletions .changeset/real-numbers-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@kopflos-cms/express": minor
---

The main export now returns and object `{ middleware: RequestHandler; instance: Kopflos }`
5 changes: 5 additions & 0 deletions .changeset/thin-buses-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"kopflos": minor
---

First version
1 change: 1 addition & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
oxigraph/
21 changes: 21 additions & 0 deletions example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Kopflos example

API inspired by [Read the Plaque](https://readtheplaque.com/).

## Start

1. Start the database:
```bash
docker compose up -d
```
2. Start the server:
```bash
npx kopflos serve
```

The API is running on http://localhost:1429

## Details

When starting, `kopflos` automatically seeds the database wit resource from directories `resources` and
`resources.dev` (configured in `kopflos.config.ts`).
10 changes: 10 additions & 0 deletions example/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '2'
services:
oxigraph:
image: ghcr.io/oxigraph/oxigraph:0.4.0-rc.1
user: root
command: serve --location /data --bind 0.0.0.0:7878
ports:
- 7878:7878
volumes:
- ./oxigraph:/data
13 changes: 13 additions & 0 deletions example/kopflos.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { KopflosConfig } from '@kopflos-cms/core'

export default <KopflosConfig> {
deploy: ['resources', 'resources.dev'],
baseIri: 'http://localhost:1429',
apiGraphs: ['http://localhost:1429/api'],
sparql: {
default: {
endpointUrl: 'http://localhost:7878/query?union-default-graph',
updateUrl: 'http://localhost:7878/update',
},
},
}
11 changes: 11 additions & 0 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "example",
"private": true,
"type": "module",
"scripts": {
"start": "kopflos serve"
},
"dependencies": {
"kopflos": "*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
PREFIX schema: <http://schema.org/>

<>
a </api/schema/Plaque> ;
schema:name "Newton's Apple Tree Monash University" ;
schema:image
[
schema:url
<http://lh3.googleusercontent.com/9plKip3uL4bOocjMGJA1qX5lXfDpYpy5uNJgW5wf8NjMbzlgjggDtZwcJLoQbyzaIlEfZaF-aDtHRLMv36ZvcRkz5g7F5qiW0gQOA_-1_A>
] ;
schema:contributor
[
schema:name "@wadekelly" ;
schema:url <https://twitter.com/wadekelly> ;
] ;
schema:geo [
schema:latitude "-37.909878" ;
schema:longitude "145.132809" ;
] ;
schema:text """
NEWTON'S APPLE
Newton's Apple tree,
the Flower of Kent variety,
was planted in 1975 and is
a cutting from the original tree
from which Sir Isaac Newton
reportedly observed an
apple fall, prompting him to
formulate his theories of
motion and gravity, one of the
most remarkable insights in
human history.
""";
.
13 changes: 13 additions & 0 deletions example/resources/api/index.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX kl: <https://kopflos.described.at/>

<>
a kl:Api ;
kl:resourceLoader kl:OwnGraphLoader ;
.

<#entrypoint>
a kl:ResourceShape ;
kl:api <> ;
sh:targetClass </api/schema/Plaque> ;
.
5 changes: 5 additions & 0 deletions example/resources/api/schema.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

<Plaque>
a rdfs:Class ;
.
Loading

0 comments on commit 1fcb2c0

Please sign in to comment.