seekter 0.11.1 → 0.12.0
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 +1 -1
- package/readme.mjs +0 -48
package/package.json
CHANGED
package/readme.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Writes npm/README.md from the repository's README.md, so the npm page shows the same text as
|
|
3
|
-
// GitHub. Run it before every `npm publish` from this folder: npm shows the README packed into the
|
|
4
|
-
// latest version, never the repository's, and a page can only change by publishing.
|
|
5
|
-
//
|
|
6
|
-
// node npm/readme.mjs
|
|
7
|
-
//
|
|
8
|
-
// The npm page resolves nothing relative to the repository, so links to files become GitHub links,
|
|
9
|
-
// images become raw.githubusercontent.com addresses, and GitHub's own alert syntax ("> [!NOTE]"),
|
|
10
|
-
// which npm prints as text, is dropped. Not shipped: package.json lists only bin/ and README.md.
|
|
11
|
-
import fs from "node:fs";
|
|
12
|
-
import path from "node:path";
|
|
13
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
14
|
-
|
|
15
|
-
const HERE = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
-
const BLOB = "https://github.com/selfishprimate/seekter/blob/main/";
|
|
17
|
-
const RAW = "https://raw.githubusercontent.com/selfishprimate/seekter/main/";
|
|
18
|
-
|
|
19
|
-
const INTRO = `> **This package installs Seekter.** \`npx seekter init\` puts the newest release in \`./seekter\` (or the folder you name); then open Claude Code there and run \`/seekter-init\`. The package has no dependencies. Everything below is the project's README.
|
|
20
|
-
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
const relative = (p) => !/^(?:[a-z][a-z0-9+.-]*:|#|\/\/)/i.test(p);
|
|
24
|
-
|
|
25
|
-
// The note goes under the title block (cover image, heading, version badge), so the page still
|
|
26
|
-
// opens on the picture; with no badge line it goes first.
|
|
27
|
-
export function npmReadme(text) {
|
|
28
|
-
const out = String(text)
|
|
29
|
-
// Images: markdown and HTML.
|
|
30
|
-
.replace(/(!\[[^\]]*\]\()([^)\s]+)(\))/g, (m, a, p, b) => (relative(p) ? a + RAW + p.replace(/^\.\//, "") + b : m))
|
|
31
|
-
.replace(/(<img\b[^>]*\bsrc=")([^"]+)(")/g, (m, a, p, b) => (relative(p) ? a + RAW + p.replace(/^\.\//, "") + b : m))
|
|
32
|
-
// Links to files in the repository.
|
|
33
|
-
.replace(/(\]\()([^)\s]+)(\))/g, (m, a, p, b) => (relative(p) ? a + BLOB + p.replace(/^\.\//, "") + b : m))
|
|
34
|
-
// GitHub alerts: npm would print "[!IMPORTANT]" literally; the quote around it stays.
|
|
35
|
-
.replace(/^>\s*\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*\n/gm, "");
|
|
36
|
-
const badge = out.match(/^\[!\[version\].*\n\n?/m);
|
|
37
|
-
if (!badge) return INTRO + out;
|
|
38
|
-
const at = badge.index + badge[0].length;
|
|
39
|
-
return out.slice(0, at) + INTRO + out.slice(at);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function main() {
|
|
43
|
-
const src = fs.readFileSync(path.join(HERE, "..", "README.md"), "utf8");
|
|
44
|
-
fs.writeFileSync(path.join(HERE, "README.md"), npmReadme(src));
|
|
45
|
-
console.log("npm/README.md written from README.md");
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (process.argv[1] && pathToFileURL(fs.realpathSync(process.argv[1])).href === import.meta.url) main();
|