getfilepress 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +102 -106
- package/packages/app/README.md +19 -0
- package/packages/app/src/routes/+layout.svelte +11 -2
- package/packages/core/README.md +29 -0
- package/packages/core/src/lib/components/SiteFooter.svelte +4 -1
- package/packages/core/src/lib/components/SiteHeader.svelte +4 -1
- package/packages/core/src/lib/index.ts +2 -0
- package/packages/core/src/lib/paths-shared.ts +8 -0
- package/packages/core/src/lib/paths.ts +1 -1
- package/scripts/filepress.mjs +0 -0
package/package.json
CHANGED
|
@@ -1,106 +1,102 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"devDependencies": {
|
|
104
|
-
"wrangler": "^4.120.1"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "getfilepress",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "FilePress — file-based Markdown blog engine. Link this package from a content-only site (config + posts), then run `filepress build`.",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://getfilepress.com",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Catalyst-Forge-LLC/filepress.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Catalyst-Forge-LLC/filepress/issues"
|
|
15
|
+
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"filepress": "./scripts/filepress.mjs",
|
|
18
|
+
"getfilepress": "./scripts/filepress.mjs"
|
|
19
|
+
},
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./packages/core/src/lib/index.ts",
|
|
23
|
+
"svelte": "./packages/core/src/lib/index.ts",
|
|
24
|
+
"default": "./packages/core/src/lib/index.ts"
|
|
25
|
+
},
|
|
26
|
+
"./server": {
|
|
27
|
+
"types": "./packages/core/src/lib/server.ts",
|
|
28
|
+
"default": "./packages/core/src/lib/server.ts"
|
|
29
|
+
},
|
|
30
|
+
"./theme": {
|
|
31
|
+
"default": "./packages/core/src/lib/theme.ts"
|
|
32
|
+
},
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"scripts/filepress.mjs",
|
|
37
|
+
"scripts/copy-path-mounts.mjs",
|
|
38
|
+
"scripts/create-site.mjs",
|
|
39
|
+
"scripts/ensure-lease.mjs",
|
|
40
|
+
"scripts/postinstall.mjs",
|
|
41
|
+
"scripts/link-embedded-packages.mjs",
|
|
42
|
+
"packages/core",
|
|
43
|
+
"packages/app",
|
|
44
|
+
"packages/import",
|
|
45
|
+
"pnpm-workspace.yaml",
|
|
46
|
+
"README.md",
|
|
47
|
+
"LICENSE"
|
|
48
|
+
],
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@fontsource-variable/inter": "^5.2.8",
|
|
51
|
+
"@fontsource-variable/newsreader": "^5.2.10",
|
|
52
|
+
"@sveltejs/adapter-static": "^3.0.10",
|
|
53
|
+
"@sveltejs/kit": "^2.63.0",
|
|
54
|
+
"@sveltejs/vite-plugin-svelte": "^7.1.2",
|
|
55
|
+
"@types/turndown": "^5.0.5",
|
|
56
|
+
"fast-xml-parser": "^5.2.5",
|
|
57
|
+
"gray-matter": "^4.0.3",
|
|
58
|
+
"highlight.js": "^11.11.1",
|
|
59
|
+
"linkedom": "^0.18.12",
|
|
60
|
+
"ollanet": "^0.4.0",
|
|
61
|
+
"rehype-autolink-headings": "^7.1.0",
|
|
62
|
+
"rehype-highlight": "^7.0.2",
|
|
63
|
+
"rehype-raw": "^7.0.0",
|
|
64
|
+
"rehype-slug": "^6.0.0",
|
|
65
|
+
"rehype-stringify": "^10.0.1",
|
|
66
|
+
"remark-gfm": "^4.0.1",
|
|
67
|
+
"remark-parse": "^11.0.0",
|
|
68
|
+
"remark-rehype": "^11.1.2",
|
|
69
|
+
"sirv-cli": "^3.0.1",
|
|
70
|
+
"svelte": "^5.56.1",
|
|
71
|
+
"svelte-check": "^4.6.0",
|
|
72
|
+
"tsx": "^4.20.5",
|
|
73
|
+
"turndown": "^7.2.1",
|
|
74
|
+
"typescript": "^6.0.3",
|
|
75
|
+
"unified": "^11.0.5",
|
|
76
|
+
"vite": "^8.0.16"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=20"
|
|
80
|
+
},
|
|
81
|
+
"devDependencies": {
|
|
82
|
+
"wrangler": "^4.120.1"
|
|
83
|
+
},
|
|
84
|
+
"scripts": {
|
|
85
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
86
|
+
"filepress": "node scripts/filepress.mjs",
|
|
87
|
+
"test": "pnpm --filter @filepress/core test && pnpm --filter @filepress/import test && pnpm --filter @filepress/app test && tsx --test scripts/sync-sibling-sites.test.ts",
|
|
88
|
+
"check": "pnpm filepress check --site demo",
|
|
89
|
+
"build": "pnpm filepress build --site demo",
|
|
90
|
+
"build:demo": "pnpm filepress build --site demo",
|
|
91
|
+
"build:www": "pnpm filepress build --site getfilepress",
|
|
92
|
+
"ship": "pnpm build:www && wrangler pages deploy sites/getfilepress/build --project-name getfilepress",
|
|
93
|
+
"deploy:www": "pnpm ship",
|
|
94
|
+
"dev": "node scripts/ensure-lease.mjs demo 5179 && pnpm filepress dev --site demo --host 0.0.0.0",
|
|
95
|
+
"dev:demo": "node scripts/ensure-lease.mjs demo 5179 && pnpm filepress dev --site demo --host 0.0.0.0",
|
|
96
|
+
"dev:www": "node scripts/ensure-lease.mjs getfilepress 5180 && pnpm filepress dev --site getfilepress --host 0.0.0.0",
|
|
97
|
+
"create-site": "node scripts/create-site.mjs",
|
|
98
|
+
"sync-siblings": "tsx scripts/sync-sibling-sites.ts",
|
|
99
|
+
"import": "node scripts/filepress.mjs import",
|
|
100
|
+
"pack:smoke": "node scripts/pack-smoke.mjs"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @filepress/app
|
|
2
|
+
|
|
3
|
+
The only SvelteKit application in the filepress monorepo. All routes, layouts, and
|
|
4
|
+
Kit wiring live here. Content sites under [`../../sites`](../../sites) provide:
|
|
5
|
+
|
|
6
|
+
- `filepress.config.ts` — identity
|
|
7
|
+
- `posts/` — Markdown
|
|
8
|
+
- `static/` — favicon, images (optional)
|
|
9
|
+
|
|
10
|
+
## Run against a site
|
|
11
|
+
|
|
12
|
+
From the repo root (do not run vite directly without `FILEPRESS_SITE_ROOT`):
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm filepress dev --site demo
|
|
16
|
+
pnpm filepress build --site demo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Build output is written to `sites/<name>/build/`.
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import '$lib/theme-entry';
|
|
3
3
|
import criticalTheme from '$critical-theme';
|
|
4
|
-
import { SiteHeader, SiteFooter } from '@filepress/core';
|
|
4
|
+
import { SiteHeader, SiteFooter, isPathMountHref } from '@filepress/core';
|
|
5
5
|
import config from '$site-config';
|
|
6
6
|
import GenieHost from '$lib/genie/GenieHost.svelte';
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
let { children } = $props();
|
|
9
|
+
|
|
10
|
+
function markPathMountLink(event: PointerEvent) {
|
|
11
|
+
const a = (event.target as HTMLElement | null)?.closest('a[href]');
|
|
12
|
+
if (!a) return;
|
|
13
|
+
const href = a.getAttribute('href');
|
|
14
|
+
if (!href || !isPathMountHref(href, config.paths)) return;
|
|
15
|
+
a.setAttribute('data-sveltekit-reload', '');
|
|
16
|
+
}
|
|
10
17
|
</script>
|
|
11
18
|
|
|
19
|
+
<svelte:window onpointerdown={markPathMountLink} />
|
|
20
|
+
|
|
12
21
|
<svelte:head>
|
|
13
22
|
{#if criticalTheme}
|
|
14
23
|
{@html `<style data-filepress-critical>${criticalTheme}</style>`}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @filepress/core
|
|
2
|
+
|
|
3
|
+
The reusable filepress engine. Sites under [`../../sites`](../../sites) depend on
|
|
4
|
+
it (via `workspace:*` in this monorepo) and provide their own SvelteKit routes,
|
|
5
|
+
content, and `filepress.config.ts`.
|
|
6
|
+
|
|
7
|
+
## Entry points
|
|
8
|
+
|
|
9
|
+
- `@filepress/core` — client-safe: `PostCard`, `PostIndex`, `Newsletter`,
|
|
10
|
+
`SiteHeader`, `SiteFooter`, `defineFilepressConfig`, `absoluteUrl`,
|
|
11
|
+
`formatDate`, and shared types.
|
|
12
|
+
- `@filepress/core/server` — server-only (filesystem access): `createContent`,
|
|
13
|
+
`renderMarkdown`, `buildRssXml` / `buildSitemapXml` / `buildRobotsTxt`, and the
|
|
14
|
+
content-parsing primitives. Import only from `+page.server.ts`, `+server.ts`,
|
|
15
|
+
or `*.server.ts` modules.
|
|
16
|
+
- `@filepress/core/theme` — self-hosted fonts + the Essay theme CSS. Import once
|
|
17
|
+
from a site's root layout.
|
|
18
|
+
|
|
19
|
+
## Why routes live in the site
|
|
20
|
+
|
|
21
|
+
SvelteKit's router is per-project, so each site owns its `src/routes/`. Those
|
|
22
|
+
route files stay thin: they call `createContent(...)` + core builders and render
|
|
23
|
+
core components. `scripts/create-site.mjs` scaffolds them.
|
|
24
|
+
|
|
25
|
+
## Testing
|
|
26
|
+
|
|
27
|
+
`pnpm --filter @filepress/core test` runs the unit tests over the pure parsing
|
|
28
|
+
and figure-transform logic. Type-checking of the whole library happens through
|
|
29
|
+
each site's `svelte-check`.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { SiteConfig } from '../config';
|
|
3
|
+
import { isPathMountHref } from '../paths-shared';
|
|
3
4
|
import NavIcon from './NavIcon.svelte';
|
|
4
5
|
|
|
5
6
|
let { site, year = new Date().getFullYear() }: { site: SiteConfig; year?: number } = $props();
|
|
@@ -16,7 +17,9 @@
|
|
|
16
17
|
class:nav-github={item.icon === 'github'}
|
|
17
18
|
{...(item.icon === 'github'
|
|
18
19
|
? { target: '_blank', rel: 'noopener noreferrer' }
|
|
19
|
-
:
|
|
20
|
+
: isPathMountHref(item.href, site.paths)
|
|
21
|
+
? { 'data-sveltekit-reload': true }
|
|
22
|
+
: {})}
|
|
20
23
|
>
|
|
21
24
|
{#if item.icon}
|
|
22
25
|
<NavIcon name={item.icon} />
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { SiteConfig } from '../config';
|
|
3
|
+
import { isPathMountHref } from '../paths-shared';
|
|
3
4
|
import NavIcon from './NavIcon.svelte';
|
|
4
5
|
|
|
5
6
|
let { site }: { site: SiteConfig } = $props();
|
|
@@ -28,7 +29,9 @@
|
|
|
28
29
|
class:nav-github={item.icon === 'github'}
|
|
29
30
|
{...(item.icon === 'github'
|
|
30
31
|
? { target: '_blank', rel: 'noopener noreferrer' }
|
|
31
|
-
:
|
|
32
|
+
: isPathMountHref(item.href, site.paths)
|
|
33
|
+
? { 'data-sveltekit-reload': true }
|
|
34
|
+
: {})}
|
|
32
35
|
>
|
|
33
36
|
{#if item.icon}
|
|
34
37
|
<NavIcon name={item.icon} />
|
|
@@ -87,3 +87,11 @@ export function normalizePathMounts(input: PathMount[] | undefined): PathMount[]
|
|
|
87
87
|
export function pathMountReservedSlugs(mounts: PathMount[]): string[] {
|
|
88
88
|
return mounts.map((m) => m.url.slice(1).split('/')[0]!).filter(Boolean);
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
/** Same-origin href that belongs to a `paths` mount (e.g. `/docs`, `/docs/install`). */
|
|
92
|
+
export function isPathMountHref(href: string, mounts: PathMount[]): boolean {
|
|
93
|
+
const raw = href.trim();
|
|
94
|
+
if (!raw.startsWith('/')) return false;
|
|
95
|
+
const path = raw.split(/[?#]/)[0] ?? '';
|
|
96
|
+
return mounts.some((m) => path === m.url || path.startsWith(`${m.url}/`));
|
|
97
|
+
}
|
|
@@ -12,7 +12,7 @@ import { join, relative, resolve, sep } from 'node:path';
|
|
|
12
12
|
import type { PathMount } from './paths-shared';
|
|
13
13
|
|
|
14
14
|
export type { PathMount } from './paths-shared';
|
|
15
|
-
export { normalizePathMounts, pathMountReservedSlugs } from './paths-shared';
|
|
15
|
+
export { normalizePathMounts, pathMountReservedSlugs, isPathMountHref } from './paths-shared';
|
|
16
16
|
|
|
17
17
|
/** Absolute filesystem path for a mount's source directory. */
|
|
18
18
|
export function resolvePathMountDir(siteRoot: string, mount: PathMount): string {
|
package/scripts/filepress.mjs
CHANGED
|
File without changes
|