Skip to content

Commit 44945c8

Browse files
committed
export source code
0 parents  commit 44945c8

48 files changed

Lines changed: 45317 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[{*.go,go.mod,Makefile,Caddyfile}]
12+
indent_style = tab
13+
indent_size = 4
14+
15+
[*.html]
16+
indent_size = 4

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Environment variables for DIRELEX
2+
# Copy this file to .env and modify as needed
3+
4+
PORT=80

.github/workflows/docker-test.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Docker Startup Test
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
9+
jobs:
10+
test-docker-startup:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@main
16+
17+
- name: Start Docker Compose services
18+
run: docker compose up -d
19+
20+
- name: Wait for and test web server
21+
run: |
22+
timeout 30 sh -c 'until curl -f http://localhost > /dev/null 2>&1; do echo "Waiting for app..."; sleep 2; done'
23+
24+
- name: Show logs on failure
25+
if: failure()
26+
run: docker compose logs
27+
28+
- name: Cleanup
29+
if: always()
30+
run: docker compose down -v

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.local.*
2+
*.min.css
3+
*.min.js
4+
/build/
5+
/direlex
6+
/tmp/
7+
node_modules/

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# --- Build stage ---
2+
FROM golang:1.26-alpine@sha256:d4c4845f5d60c6a974c6000ce58ae079328d03ab7f721a0734277e69905473e5 AS builder
3+
4+
WORKDIR /app
5+
6+
COPY go.mod go.sum ./
7+
RUN go mod download
8+
9+
COPY cmd/ cmd/
10+
COPY css/ css/
11+
COPY internal/ internal/
12+
COPY js/ js/
13+
14+
RUN go run ./cmd/build-assets
15+
16+
ENV CGO_ENABLED=0
17+
RUN go build -ldflags="-s -w" -o direlex ./cmd/server
18+
19+
# --- Final image ---
20+
FROM scratch
21+
22+
WORKDIR /app
23+
24+
COPY data/ data/
25+
COPY public/ public/
26+
COPY --from=builder /app/public/css/ public/css/
27+
COPY --from=builder /app/public/js/ public/js/
28+
COPY --from=builder /app/direlex .
29+
30+
EXPOSE 80
31+
32+
CMD ["./direlex"]

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.PHONY: help build-assets build generate start lint fix clean
2+
3+
## help: Show this help message
4+
help:
5+
@grep -E '^## ' $(MAKEFILE_LIST)
6+
7+
## build-assets: Build CSS and JavaScript assets
8+
build-assets:
9+
go run ./cmd/build-assets
10+
11+
## build: Build the server binary
12+
build: build-assets
13+
go build -buildvcs=false -ldflags="-s -w" -o direlex ./cmd/server
14+
15+
## generate: Generate static site
16+
generate: build-assets
17+
go run ./cmd/generate
18+
19+
## start: Build and run the server
20+
start: build
21+
./direlex
22+
23+
## lint: Run all Go linters
24+
lint:
25+
go vet ./...
26+
gofmt -l .
27+
28+
## fix: Format Go code
29+
fix:
30+
go fmt ./...
31+
32+
## clean: Remove built binaries and build artifacts
33+
clean:
34+
rm -f direlex
35+
rm -rf build/

README.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Diccionari de recursos lexicals
2+
3+
*Catalan version available below / Versió en català disponible a continuació*
4+
5+
Source code for the online version of the Diccionari de recursos lexicals ([DIRELEX](https://direlex.softcatala.org/)).
6+
7+
## Dependencies
8+
9+
### Option 1: Docker execution
10+
11+
- Docker Compose
12+
13+
### Option 2: Native compilation with Go
14+
15+
- Go 1.24+
16+
17+
## Build and execution
18+
19+
### Static mode
20+
21+
The website can be generated as a 100% static site and served with Caddy:
22+
23+
```bash
24+
docker compose -f deploy/docker-compose.static.yml up
25+
```
26+
27+
### Go server mode (development)
28+
29+
#### Option 1: Docker
30+
31+
```bash
32+
docker compose up
33+
```
34+
35+
#### Option 2: Native Go
36+
37+
```bash
38+
go run ./cmd/build-assets
39+
go build -o direlex ./cmd/server
40+
./direlex
41+
```
42+
43+
Alternatively, you can use `make start` as a shortcut. Run `make` to see all available commands.
44+
45+
## Copyright and licenses
46+
47+
Copyright (c) Pere Orga Esteve <pere@orga.cat>, 2025.
48+
49+
The source code of this project is distributed under the [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html.en) license or later.
50+
51+
### Dictionary data
52+
53+
Copyright (c) 2025 Carles Castellanos i Llorenç, Agustí Mayor i Lloret.
54+
55+
The dictionary data included in this repository is subject to a different license than the source code: [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/deed.en).
56+
57+
---
58+
59+
# Diccionari de recursos lexicals
60+
61+
Codi font de la versió en línia del Diccionari de recursos lexicals ([DIRELEX](https://direlex.softcatala.org/)).
62+
63+
## Dependències
64+
65+
### Opció 1: execució amb Docker
66+
67+
- Docker Compose
68+
69+
### Opció 2: compilació nativa amb Go
70+
71+
- Go 1.24+
72+
73+
## Compilació i execució
74+
75+
### Mode estàtic
76+
77+
El lloc web es pot generar com un lloc 100% estàtic i servir-lo amb Caddy:
78+
79+
```bash
80+
docker compose -f deploy/docker-compose.static.yml up
81+
```
82+
83+
### Mode servidor Go (desenvolupament)
84+
85+
#### Opció 1: Docker
86+
87+
```bash
88+
docker compose up
89+
```
90+
91+
#### Opció 2: Go natiu
92+
93+
```bash
94+
go run ./cmd/build-assets
95+
go build -o direlex ./cmd/server
96+
./direlex
97+
```
98+
99+
També podeu utilitzar `make start` com a drecera. Executeu `make` per veure totes les ordres.
100+
101+
## Copyright i llicències
102+
103+
Copyright (c) Pere Orga Esteve <pere@orga.cat>, 2025.
104+
105+
El codi font d'aquest projecte es distribueix amb la llicència [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html.en) o superior.
106+
107+
### Dades del diccionari
108+
109+
Copyright (c) 2025 Carles Castellanos i Llorenç, Agustí Mayor i Lloret.
110+
111+
Les dades del diccionari incloses en aquest repositori tenen una llicència diferent de la del codi font: [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/deed.ca).

biome.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"files": {
3+
"includes": ["js/*.js", "css/*.css", "*.json"]
4+
},
5+
"formatter": {
6+
"indentStyle": "space",
7+
"lineWidth": 120
8+
},
9+
"linter": {
10+
"rules": {
11+
"complexity": {
12+
"noForEach": "error",
13+
"noImplicitCoercions": "error",
14+
"noUselessStringConcat": "error",
15+
"noVoid": "error"
16+
},
17+
"correctness": {
18+
"noUndeclaredVariables": "error"
19+
},
20+
"nursery": {
21+
"recommended": true
22+
},
23+
"style": {
24+
"noNegationElse": "error",
25+
"noDescendingSpecificity": "off",
26+
"noNestedTernary": "error",
27+
"noParameterAssign": "error",
28+
"noSubstr": "error",
29+
"noYodaExpression": "error",
30+
"useBlockStatements": "error",
31+
"useCollapsedElseIf": "error",
32+
"useCollapsedIf": "error",
33+
"useConsistentBuiltinInstantiation": "error",
34+
"useDefaultParameterLast": "error",
35+
"useDefaultSwitchClause": "error",
36+
"useExplicitLengthCheck": "error",
37+
"useForOf": "error",
38+
"useGroupedAccessorPairs": "error",
39+
"useNumberNamespace": "error",
40+
"useShorthandAssign": "error",
41+
"useSingleVarDeclarator": "error",
42+
"useSymbolDescription": "error",
43+
"useThrowNewError": "error",
44+
"useTrimStartEnd": "error"
45+
},
46+
"suspicious": {
47+
"noConstantBinaryExpressions": "error",
48+
"useErrorMessage": "error",
49+
"noEmptyBlockStatements": "error",
50+
"noFunctionAssign": "error",
51+
"noUnassignedVariables": "error",
52+
"noVar": "error",
53+
"useAwait": "error",
54+
"useGuardForIn": "error",
55+
"useNumberToFixedDigitsArgument": "error"
56+
}
57+
}
58+
},
59+
"assist": {
60+
"actions": {
61+
"source": {
62+
"organizeImports": "on",
63+
"useSortedProperties": "on"
64+
}
65+
}
66+
}
67+
}

0 commit comments

Comments
 (0)