7 Commits

Author SHA1 Message Date
d0166b1db9 0.1.7
Some checks failed
Build and publish / build-and-publish (push) Failing after 10s
2023-08-19 15:39:27 -07:00
821456c226 publish 2023-08-19 15:39:24 -07:00
5ff9cee8de make base_url more optional 2023-08-19 15:38:54 -07:00
df4545a7f1 update package-lock.json
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 22s
Build and test / build-and-test (20.x) (push) Successful in 21s
2023-08-18 17:21:49 -07:00
34c4144c3d cleanup
Some checks failed
Build and test / build-and-test (18.x) (push) Failing after 11s
Build and test / build-and-test (20.x) (push) Failing after 19s
2023-08-18 17:20:51 -07:00
fbe142f12f only build on node 18+
All checks were successful
Build and test / build-and-test (18.x) (push) Successful in 20s
Build and test / build-and-test (20.x) (push) Successful in 19s
2023-08-18 17:09:21 -07:00
bcd60473b6 setup gitea actions
Some checks failed
Build and test / build-and-test (14.x) (push) Failing after 57s
Build and test / build-and-test (16.x) (push) Successful in 19s
Build and test / build-and-test (18.x) (push) Successful in 22s
Build and test / build-and-test (20.x) (push) Successful in 21s
2023-08-18 17:06:19 -07:00
5 changed files with 93 additions and 18 deletions

View File

@@ -0,0 +1,36 @@
name: Build and publish
on:
# - workflow_dispatch
push:
branches:
- master
jobs:
build-and-publish:
runs-on: ubuntu-latest
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Login to package registry
run: |
npm config set @doc-utils:registry https://gitea.jbrumond.me/api/packages/doc-utils/npm/
npm config set -- '//gitea.jbrumond.me/api/packages/doc-utils/npm/:_authToken' "$NPM_PUBLISH_TOKEN"
- name: Install dependencies
run: npm ci
- name: Compile TypeScript
run: npm run tsc
- name: Publish package
run: npm publish

View File

@@ -0,0 +1,40 @@
name: Build and test
on:
# push:
# branches:
# - master
pull_request:
branches:
- master
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Login to package registry
run: |
npm config set @doc-utils:registry https://gitea.jbrumond.me/api/packages/doc-utils/npm/
npm config set -- '//gitea.jbrumond.me/api/packages/doc-utils/npm/:_authToken' "$NPM_PUBLISH_TOKEN"
- name: Install dependencies
run: npm ci
- name: Compile TypeScript
run: npm run tsc
# todo: tests
- name: Run tests
run: exit 0

18
package-lock.json generated
View File

@@ -1,14 +1,14 @@
{ {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.1.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.1.7",
"dependencies": { "dependencies": {
"@doc-utils/color-themes": "^0.1.15", "@doc-utils/color-themes": "^0.2.0",
"@doc-utils/jsonschema2markdown": "^0.1.1", "@doc-utils/jsonschema2markdown": "^0.1.1",
"@doc-utils/markdown2html": "^0.3.4", "@doc-utils/markdown2html": "^0.3.4",
"glob": "^10.2.3", "glob": "^10.2.3",
@@ -33,9 +33,9 @@
} }
}, },
"node_modules/@doc-utils/color-themes": { "node_modules/@doc-utils/color-themes": {
"version": "0.1.15", "version": "0.2.0",
"resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fcolor-themes/-/0.1.15/color-themes-0.1.15.tgz", "resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fcolor-themes/-/0.2.0/color-themes-0.2.0.tgz",
"integrity": "sha512-P0oIlq4Z0cUOf7P4T2OUfhT/Cn/msl3oHTenVWHxKMDPlIYueR6AhFdRCHTI0A+DxyH+0EIi6CnMq3JYnILI0w==" "integrity": "sha512-UtjY25B8m4qdMvrmTPK3I1JXckbc1cvCOmIygHFBexpSWBQmb+sdoXfdCsoSpgPncurz1kwlEXffgPELCGtP8g=="
}, },
"node_modules/@doc-utils/jsonschema2markdown": { "node_modules/@doc-utils/jsonschema2markdown": {
"version": "0.1.1", "version": "0.1.1",
@@ -2677,9 +2677,9 @@
}, },
"dependencies": { "dependencies": {
"@doc-utils/color-themes": { "@doc-utils/color-themes": {
"version": "0.1.15", "version": "0.2.0",
"resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fcolor-themes/-/0.1.15/color-themes-0.1.15.tgz", "resolved": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/%40doc-utils%2Fcolor-themes/-/0.2.0/color-themes-0.2.0.tgz",
"integrity": "sha512-P0oIlq4Z0cUOf7P4T2OUfhT/Cn/msl3oHTenVWHxKMDPlIYueR6AhFdRCHTI0A+DxyH+0EIi6CnMq3JYnILI0w==" "integrity": "sha512-UtjY25B8m4qdMvrmTPK3I1JXckbc1cvCOmIygHFBexpSWBQmb+sdoXfdCsoSpgPncurz1kwlEXffgPELCGtP8g=="
}, },
"@doc-utils/jsonschema2markdown": { "@doc-utils/jsonschema2markdown": {
"version": "0.1.1", "version": "0.1.1",

View File

@@ -1,8 +1,8 @@
{ {
"name": "@doc-utils/docs2website", "name": "@doc-utils/docs2website",
"version": "0.1.6", "version": "0.1.7",
"publishConfig": { "publishConfig": {
"registry": "https://gitea.home.jbrumond.me/api/packages/doc-utils/npm/" "registry": "https://gitea.jbrumond.me/api/packages/doc-utils/npm/"
}, },
"scripts": { "scripts": {
"tsc": "tsc", "tsc": "tsc",
@@ -22,9 +22,9 @@
"typescript": "^5.0.4" "typescript": "^5.0.4"
}, },
"dependencies": { "dependencies": {
"@doc-utils/color-themes": "^0.1.15", "@doc-utils/color-themes": "^0.2.0",
"@doc-utils/jsonschema2markdown": "^0.1.1", "@doc-utils/jsonschema2markdown": "^0.1.1",
"@doc-utils/markdown2html": "^0.3.4", "@doc-utils/markdown2html": "^0.3.5",
"glob": "^10.2.3", "glob": "^10.2.3",
"ical": "^0.8.0", "ical": "^0.8.0",
"ical-generator": "^4.1.0", "ical-generator": "^4.1.0",

View File

@@ -8,9 +8,8 @@ import { render_theme_css_properties } from '../themes';
import { load_partials, FrontMatter, Context, load_layout, render_template, EventFrontmatter } from '../template'; import { load_partials, FrontMatter, Context, load_layout, render_template, EventFrontmatter } from '../template';
import { render_markdown_to_html, render_markdown_to_html_inline_sync } from '@doc-utils/markdown2html'; import { render_markdown_to_html, render_markdown_to_html_inline_sync } from '@doc-utils/markdown2html';
import { RSSEntry } from './rss'; import { RSSEntry } from './rss';
import { DateTime } from 'luxon';
import { EventEntry } from './icalendar'; import { EventEntry } from './icalendar';
import { as_context_time, as_html_time, from_iso } from '../time'; import { as_context_time, from_iso } from '../time';
import { FileMetadata } from '../metadata'; import { FileMetadata } from '../metadata';
export interface OutFileURL { export interface OutFileURL {
@@ -31,9 +30,9 @@ export function map_output_file_to_url(state: BuildState, out_file: string, inde
rel_path = '/' + rel_path; rel_path = '/' + rel_path;
} }
const base_url = state.conf.base_url.endsWith('/') const base_url = state.conf.base_url?.endsWith('/')
? state.conf.base_url.slice(0, -1) ? state.conf.base_url.slice(0, -1)
: state.conf.base_url; : (state.conf.base_url ?? '');
return { return {
base_url, base_url,
@@ -108,7 +107,7 @@ export function mustache_context(state: BuildState, page_url: string, metadata:
return { return {
env: state.env, env: state.env,
page: frontmatter, page: frontmatter,
base_url: state.conf.base_url, base_url: state.conf.base_url ?? '/',
page_url: page_url, page_url: page_url,
page_published: as_context_time(from_iso(metadata.first_seen_time), 'dt-published'), page_published: as_context_time(from_iso(metadata.first_seen_time), 'dt-published'),
page_updated: has_been_updated ? as_context_time(from_iso(metadata.last_updated_time), 'dt-updated') : null, page_updated: has_been_updated ? as_context_time(from_iso(metadata.last_updated_time), 'dt-updated') : null,