Compare commits

...

21 Commits

Author SHA1 Message Date
ge
718665e520 make: replace Makefile with make.vsh 2025-05-29 23:28:49 +03:00
ge
480a407b9e ci: add tests CI 2025-04-22 19:35:34 +03:00
ge
d0e9c04326 upd doc, version 2025-04-22 19:27:53 +03:00
ge
3ab92ee93a all: stop using src/ dir, update licenses.json 2025-04-22 19:21:20 +03:00
dc6e801c23 ci: fix Pages deployment
Some checks failed
CI / build (push) Has been cancelled
CI / deploy (push) Has been cancelled
2025-03-29 20:35:19 +03:00
788a9f38fe ci: fix V setup one more time 2025-03-29 20:33:16 +03:00
2d1a4bc89f ci: fix V setup again 2025-03-29 20:31:34 +03:00
143b646dc8 ci: fix V setup 2025-03-29 20:28:08 +03:00
755db6988c ci: fix 2025-03-29 20:24:12 +03:00
0a231f6ba2 ci: fix build x6 2025-03-29 20:20:19 +03:00
e2fa558ad9 ci: fix build x5 2025-03-29 20:05:12 +03:00
f409fcee70 Create .vdocignore 2025-03-29 19:52:56 +03:00
ffa1bb68c8 ci: fix build x5 2025-03-29 19:51:27 +03:00
e3101160e1 ci: fix build x4 2025-03-29 19:49:14 +03:00
2429fcf6f7 ci: try to fix build 2025-03-29 19:47:53 +03:00
3cb451251c ci: fix build x3 2025-03-29 19:46:04 +03:00
c771a8671f ci: fix build x2 2025-03-29 19:40:30 +03:00
950fd84ae6 ci: fix docs build 2025-03-29 19:34:21 +03:00
15c5ca21d5 ci: Add pages deployment 2025-03-29 19:28:11 +03:00
4f563cae10 ci: Add docs.yaml 2025-03-29 19:12:28 +03:00
0b85f4a661 fix SPDX URL in Makefile 2025-01-22 03:29:26 +03:00
10 changed files with 7486 additions and 7411 deletions

48
.github/workflows/docs.yaml vendored Normal file
View File

@ -0,0 +1,48 @@
name: Docs
on:
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup V
run: |
wget -qO /tmp/v.zip https://github.com/vlang/v/releases/latest/download/v_linux.zip
unzip -q /tmp/v.zip -d /tmp
echo /tmp/v >> "$GITHUB_PATH"
- name: Build docs
run: |
v doc -f html -m .
pushd _docs
ln -vs licenseid.html index.html
ls -alFh
popd
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: _docs/
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
permissions:
contents: read
pages: write
id-token: write

24
.github/workflows/test.yaml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Tests
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup V
run: |
wget -qO /tmp/v.zip https://github.com/vlang/v/releases/latest/download/v_linux.zip
unzip -q /tmp/v.zip -d /tmp
echo /tmp/v >> "$GITHUB_PATH"
- name: Run tests
run: |
v -stats test .

1
.vdocignore Normal file
View File

@ -0,0 +1 @@
examples/

View File

@ -1,23 +0,0 @@
SRC_DIR = src
DOC_DIR = doc
SPDX_LICENSE_LIST_FILE = src/licenselist.json
SPDX_LICENSE_LIST_FILE_MIN = src/licenselist.min.json
SPDX_LICENSE_LIST_FILE_TMP = /tmp/licenselist.json.new
SPDX_LICENSE_LIST_JSON_URL = https://spdx.org/licenses/licenses.json
licenselist:
wget -q -O $(SPDX_LICENSE_LIST_FILE_TMP) $(SPDX_LICENSE_LIST_JSON_URL1)
if ! diff $(SPDX_LICENSE_LIST_FILE) $(SPDX_LICENSE_LIST_FILE_TMP) >/dev/null 2>&1; \
then mv -v $(SPDX_LICENSE_LIST_FILE_TMP) $(SPDX_LICENSE_LIST_FILE); \
fi
jq -c . < $(SPDX_LICENSE_LIST_FILE) > $(SPDX_LICENSE_LIST_FILE_MIN)
doc:
v doc -f html -m ./$(SRC_DIR) -o $(DOC_DIR)
serve: clean doc
v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')"
clean:
rm -r $(DOC_DIR) || true

View File

@ -1,4 +1,4 @@
## Query the SPDX license list and licenses information
# Query the SPDX license list
`licenseid` module embeds the SPDX license list data file taken from
https://spdx.org/licenses/licenses.json and allows you to obtain basic

View File

@ -3,7 +3,7 @@ module licenseid
import json
import net.http
const licenses_file = $embed_file('licenselist.min.json')
const licenses_file = $embed_file('licenses.min.json')
const licenses = json.decode(LicenseList, licenses_file.to_string()) or { LicenseList{} }
struct LicenseList {
@ -47,7 +47,7 @@ pub:
}
// details fetches the license details object from SPDX data file using the
// details_url. Requires access to public network.
// details_url. Requires access to internet.
pub fn (l License) details() !LicenseDetails {
response := http.get(l.details_url)!
details := json.decode(LicenseDetails, response.body)!

File diff suppressed because it is too large Load Diff

25
make.vsh Executable file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env -S v run
import build
import net.http
const source_url = 'https://spdx.org/licenses/licenses.json'
mut context := build.context(default: 'licenses.min.json')
context.artifact(
name: 'licenses.json'
help: 'SPDX licenses list in JSON format'
should_run: |self| true
run: |self| http.download_file(source_url, self.name)!
)
context.artifact(
name: 'licenses.min.json'
help: 'The minified licenses.json ready for embedding (requires jq util)'
depends: ['licenses.json']
should_run: |self| true
run: |self| system('jq -c . < licenses.json > ${self.name}')
)
context.run()

2
v.mod
View File

@ -1,7 +1,7 @@
Module{
name: 'licenseid'
description: 'Query the SPDX license list and licenses information'
version: '0.0.1'
version: '0.0.2'
license: 'Unlicense'
dependencies: []
}