@dmthepm/commune 0.6.3 → 0.6.4
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/lib/cli/check.js +3 -3
- package/lib/cli/gate.js +3 -3
- package/lib/cli/main.js +12 -12
- package/lib/cli/query.js +3 -3
- package/lib/cli/related.js +4 -4
- package/lib/cli/render.js +6 -6
- package/lib/cli/root.js +1 -1
- package/lib/cli/source.js +1 -1
- package/lib/cli/update.js +3 -3
- package/lib/integration.js +1 -1
- package/lib/lib/graph.js +2 -2
- package/lib/markdown.js +2 -2
- package/lib/remark-wikilinks.js +1 -1
- package/package.json +2 -2
package/lib/cli/check.js
CHANGED
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* v1 is scoped to link integrity so it does not block on #17's collection
|
|
11
11
|
* collapse. Frontmatter drift is a follow-up.
|
|
12
12
|
*/
|
|
13
|
-
import { buildGraph, checkEntries, loadContentEntries, } from
|
|
14
|
-
import { SCHEMA, writeJson, writeLines } from
|
|
15
|
-
import { EXIT_OK } from
|
|
13
|
+
import { buildGraph, checkEntries, loadContentEntries, } from '../lib/graph.js';
|
|
14
|
+
import { SCHEMA, writeJson, writeLines } from './output.js';
|
|
15
|
+
import { EXIT_OK } from './errors.js';
|
|
16
16
|
const RULES = [
|
|
17
17
|
'broken-link',
|
|
18
18
|
'ambiguous-target',
|
package/lib/cli/gate.js
CHANGED
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
*/
|
|
29
29
|
import { readFile } from 'node:fs/promises';
|
|
30
30
|
import path from 'node:path';
|
|
31
|
-
import { findNoncanonicalTitles, loadContentEntries, stripCode, } from
|
|
32
|
-
import { EXIT_FAILED, EXIT_OK, failure } from
|
|
33
|
-
import { SCHEMA, writeJson } from
|
|
31
|
+
import { findNoncanonicalTitles, loadContentEntries, stripCode, } from '../lib/graph.js';
|
|
32
|
+
import { EXIT_FAILED, EXIT_OK, failure } from './errors.js';
|
|
33
|
+
import { SCHEMA, writeJson } from './output.js';
|
|
34
34
|
const WIKILINK = /\[\[([^\]|]+)(?:\|[^\]]+)?\]\]/g;
|
|
35
35
|
async function readSearchIndex(root) {
|
|
36
36
|
// The public artifact, not the built one: `public/backlinks.json` is what
|
package/lib/cli/main.js
CHANGED
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
* JSON: `--json` is known before the strict parse that rejects the argv.
|
|
13
13
|
*/
|
|
14
14
|
import { parseArgs } from 'node:util';
|
|
15
|
-
import { CliError, EXIT_OK, EXIT_USAGE, isParseArgsError, usageError } from
|
|
16
|
-
import { writeError } from
|
|
17
|
-
import { resolveRoot } from
|
|
18
|
-
import { toIsoDay } from
|
|
19
|
-
import { parseRecent, queryCommand } from
|
|
20
|
-
import { checkCommand } from
|
|
21
|
-
import { gateCommand } from
|
|
22
|
-
import { relatedCommand } from
|
|
23
|
-
import { updateCommand } from
|
|
24
|
-
import { COMMAND_USAGE, USAGE } from
|
|
25
|
-
import { readVersion } from
|
|
15
|
+
import { CliError, EXIT_OK, EXIT_USAGE, isParseArgsError, usageError } from './errors.js';
|
|
16
|
+
import { writeError } from './output.js';
|
|
17
|
+
import { resolveRoot } from './root.js';
|
|
18
|
+
import { toIsoDay } from '../lib/graph.js';
|
|
19
|
+
import { parseRecent, queryCommand } from './query.js';
|
|
20
|
+
import { checkCommand } from './check.js';
|
|
21
|
+
import { gateCommand } from './gate.js';
|
|
22
|
+
import { relatedCommand } from './related.js';
|
|
23
|
+
import { updateCommand } from './update.js';
|
|
24
|
+
import { COMMAND_USAGE, USAGE } from './usage.js';
|
|
25
|
+
import { readVersion } from './version.js';
|
|
26
26
|
/** Options understood everywhere, in any position. */
|
|
27
27
|
const GLOBAL = {
|
|
28
28
|
root: { type: 'string' },
|
|
@@ -173,7 +173,7 @@ async function dispatch(args) {
|
|
|
173
173
|
// `check`, and an outright failure in a project that has the CLI but
|
|
174
174
|
// not the renderer, which is the opposite of the promise the rest of
|
|
175
175
|
// this CLI makes about running without Astro.
|
|
176
|
-
const { renderCommand } = await import(
|
|
176
|
+
const { renderCommand } = await import('./render.js');
|
|
177
177
|
return renderCommand(await resolveRoot(values.root), positionals[0], site, values.json);
|
|
178
178
|
}
|
|
179
179
|
case 'check': {
|
package/lib/cli/query.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* per note. Filters narrow which entries are *returned*; they never change how
|
|
7
7
|
* links resolve, so an entry's degree is the same whether or not you filtered.
|
|
8
8
|
*/
|
|
9
|
-
import { buildGraph, loadContentEntries, toIsoDay, } from
|
|
10
|
-
import { SCHEMA, writeJson, writeLines } from
|
|
11
|
-
import { EXIT_OK } from
|
|
9
|
+
import { buildGraph, loadContentEntries, toIsoDay, } from '../lib/graph.js';
|
|
10
|
+
import { SCHEMA, writeJson, writeLines } from './output.js';
|
|
11
|
+
import { EXIT_OK } from './errors.js';
|
|
12
12
|
/**
|
|
13
13
|
* Resolve `--recent` to the day it means.
|
|
14
14
|
*
|
package/lib/cli/related.js
CHANGED
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
* written `Noontide` are the same name spelled two ways, and matching them is
|
|
18
18
|
* still an exact match — just of the right string.
|
|
19
19
|
*/
|
|
20
|
-
import { buildGraph, buildLinkLookup, buildUrlLookup, extractLinks, loadContentEntries, resolveLink, stripCode, } from
|
|
21
|
-
import { SCHEMA, writeJson, writeLines } from
|
|
22
|
-
import { EXIT_OK } from
|
|
23
|
-
import { readSource } from
|
|
20
|
+
import { buildGraph, buildLinkLookup, buildUrlLookup, extractLinks, loadContentEntries, resolveLink, stripCode, } from '../lib/graph.js';
|
|
21
|
+
import { SCHEMA, writeJson, writeLines } from './output.js';
|
|
22
|
+
import { EXIT_OK } from './errors.js';
|
|
23
|
+
import { readSource } from './source.js';
|
|
24
24
|
/**
|
|
25
25
|
* Shortest name worth matching, measured after normalisation. Below this, a
|
|
26
26
|
* mention is noise — `B` would make every capital B a connection.
|
package/lib/cli/render.js
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
* the time there is HTML the broken link is indistinguishable from a sentence,
|
|
20
20
|
* and the one thing a reviewer most needs to be told is gone.
|
|
21
21
|
*/
|
|
22
|
-
import { communeMarkdown } from
|
|
23
|
-
import { buildLinkLookup, buildUrlLookup, extractLinks, loadContentEntries, resolveLink, } from
|
|
24
|
-
import { SCHEMA, writeJson } from
|
|
25
|
-
import { EXIT_OK } from
|
|
26
|
-
import { readSource } from
|
|
27
|
-
import { resolveSite } from
|
|
22
|
+
import { communeMarkdown } from '../markdown.js';
|
|
23
|
+
import { buildLinkLookup, buildUrlLookup, extractLinks, loadContentEntries, resolveLink, } from '../lib/graph.js';
|
|
24
|
+
import { SCHEMA, writeJson } from './output.js';
|
|
25
|
+
import { EXIT_OK } from './errors.js';
|
|
26
|
+
import { readSource } from './source.js';
|
|
27
|
+
import { resolveSite } from './site.js';
|
|
28
28
|
export async function renderCommand(root, input, siteFlag, json) {
|
|
29
29
|
// Read before anything else: `-` has to consume stdin before a slow scan of
|
|
30
30
|
// the content tree, or a producer writing into the pipe waits on us.
|
package/lib/cli/root.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { stat } from 'node:fs/promises';
|
|
12
12
|
import path from 'node:path';
|
|
13
|
-
import { failure } from
|
|
13
|
+
import { failure } from './errors.js';
|
|
14
14
|
export async function resolveRoot(value) {
|
|
15
15
|
const root = path.resolve(value ?? process.cwd());
|
|
16
16
|
const content = path.join(root, 'src', 'content');
|
package/lib/cli/source.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import { readFile, stat } from 'node:fs/promises';
|
|
16
16
|
import path from 'node:path';
|
|
17
17
|
import matter from 'gray-matter';
|
|
18
|
-
import { failure } from
|
|
18
|
+
import { failure } from './errors.js';
|
|
19
19
|
async function isFile(candidate) {
|
|
20
20
|
try {
|
|
21
21
|
return (await stat(candidate)).isFile();
|
package/lib/cli/update.js
CHANGED
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { mkdir, stat, writeFile } from 'node:fs/promises';
|
|
17
17
|
import path from 'node:path';
|
|
18
|
-
import { CONTENT_DIRS, loadContentEntries } from
|
|
19
|
-
import { SCHEMA, writeJson, writeLines } from
|
|
20
|
-
import { EXIT_OK, failure } from
|
|
18
|
+
import { CONTENT_DIRS, loadContentEntries } from '../lib/graph.js';
|
|
19
|
+
import { SCHEMA, writeJson, writeLines } from './output.js';
|
|
20
|
+
import { EXIT_OK, failure } from './errors.js';
|
|
21
21
|
/**
|
|
22
22
|
* The entry, as markdown.
|
|
23
23
|
*
|
package/lib/integration.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { copyFile, writeFile, mkdir } from 'node:fs/promises';
|
|
12
12
|
import { fileURLToPath } from 'node:url';
|
|
13
13
|
import path from 'node:path';
|
|
14
|
-
import { buildGraph, formatDiagnostic, loadContentEntries, summarizeSite, toBacklinksJson, toMarkdownPath, } from
|
|
14
|
+
import { buildGraph, formatDiagnostic, loadContentEntries, summarizeSite, toBacklinksJson, toMarkdownPath, } from './lib/graph.js';
|
|
15
15
|
function buildBacklinksGraph(entries, logger) {
|
|
16
16
|
const graph = buildGraph(entries);
|
|
17
17
|
logger.info(`📝 Found ${Object.keys(graph.nodes).length} public content entries`);
|
package/lib/lib/graph.js
CHANGED
|
@@ -21,8 +21,8 @@ import { slug as githubSlug } from 'github-slugger';
|
|
|
21
21
|
import matter from 'gray-matter';
|
|
22
22
|
import { readFile } from 'node:fs/promises';
|
|
23
23
|
import path from 'node:path';
|
|
24
|
-
import { readContentHistory, readMtimeDate, } from
|
|
25
|
-
export { SHALLOW_WARNING, toIsoDay } from
|
|
24
|
+
import { readContentHistory, readMtimeDate, } from './dates.js';
|
|
25
|
+
export { SHALLOW_WARNING, toIsoDay } from './dates.js';
|
|
26
26
|
/** Where each collection's markdown lives, relative to the project root. */
|
|
27
27
|
export const CONTENT_DIRS = {
|
|
28
28
|
notes: 'src/content/notes',
|
package/lib/markdown.js
CHANGED
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* own origin, which lives once in their `defineConfig({ site })`.
|
|
15
15
|
*/
|
|
16
16
|
import { unified } from '@astrojs/markdown-remark';
|
|
17
|
-
import remarkWikiLinks from
|
|
18
|
-
import rehypeExternalLinks from
|
|
17
|
+
import remarkWikiLinks from './remark-wikilinks.js';
|
|
18
|
+
import rehypeExternalLinks from './rehype-external-links.js';
|
|
19
19
|
export function communeMarkdown({ site, root } = {}) {
|
|
20
20
|
return unified({
|
|
21
21
|
remarkPlugins: [[remarkWikiLinks, { root }]],
|
package/lib/remark-wikilinks.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* graph core in `src/lib/graph.ts` — not here.
|
|
11
11
|
*/
|
|
12
12
|
import { visit } from 'unist-util-visit';
|
|
13
|
-
import { getLinkLookup, linkKey } from
|
|
13
|
+
import { getLinkLookup, linkKey } from './lib/graph.js';
|
|
14
14
|
/**
|
|
15
15
|
* Remark plugin function.
|
|
16
16
|
*
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dmthepm/commune",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.4",
|
|
5
5
|
"description": "Maintain a personal wiki from markdown notes, dictated thoughts and everyday work with authoring tools, a shared link graph and portable Astro publishing.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -94,6 +94,6 @@
|
|
|
94
94
|
"@types/node": "^22.20.1",
|
|
95
95
|
"astro": "^7.2.10",
|
|
96
96
|
"tailwindcss": "^3.4.0",
|
|
97
|
-
"typescript": "^
|
|
97
|
+
"typescript": "^7.0.2"
|
|
98
98
|
}
|
|
99
99
|
}
|