@jfdevelops/docs 0.1.0 → 0.2.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/README.md +22 -0
- package/dist/check.d.ts +1 -0
- package/dist/check.js +8 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,6 +76,28 @@ docs/
|
|
|
76
76
|
|
|
77
77
|
Version status comes from the package major: that major is `current`, earlier ones are `previous`, `v0` is `legacy`, and later ones are `next`. Install commands in earlier majors must pin exact versions, with the documented package at that major's last release.
|
|
78
78
|
|
|
79
|
+
Each install command is written once per package manager, in consecutive fences labeled `npm`, `pnpm`, `yarn` and `bun`:
|
|
80
|
+
|
|
81
|
+
````markdown
|
|
82
|
+
```npm
|
|
83
|
+
npm i @acme/widgets
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
```pnpm
|
|
87
|
+
pnpm add @acme/widgets
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```yarn
|
|
91
|
+
yarn add @acme/widgets
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```bun
|
|
95
|
+
bun add @acme/widgets
|
|
96
|
+
```
|
|
97
|
+
````
|
|
98
|
+
|
|
99
|
+
The check validates versions in all four, and rejects install commands in an `sh` or `bash` fence. A docs site can render the four fences as tabs.
|
|
100
|
+
|
|
79
101
|
Writing guidance lives in the `jf-docs` skill from `@jfdevelops/skills`.
|
|
80
102
|
|
|
81
103
|
## Development
|
package/dist/check.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export { parseFrontmatter };
|
|
|
49
49
|
* from the same tree, so the checker builds them in memory instead of reading
|
|
50
50
|
* them. It uses Node builtins only.
|
|
51
51
|
*/
|
|
52
|
+
export declare const PACKAGE_MANAGERS: string[];
|
|
52
53
|
export declare const FENCE_LANGUAGES: string[];
|
|
53
54
|
export declare const IMAGE_EXTENSIONS: string[];
|
|
54
55
|
export declare const FRONTMATTER_KEYS: string[];
|
package/dist/check.js
CHANGED
|
@@ -9,6 +9,9 @@ export { parseFrontmatter };
|
|
|
9
9
|
* from the same tree, so the checker builds them in memory instead of reading
|
|
10
10
|
* them. It uses Node builtins only.
|
|
11
11
|
*/
|
|
12
|
+
// Install commands get one fence per package manager, labeled with its name.
|
|
13
|
+
export const PACKAGE_MANAGERS = ['npm', 'pnpm', 'yarn', 'bun'];
|
|
14
|
+
const SHELL_LANGUAGES = ['sh', 'bash', ...PACKAGE_MANAGERS];
|
|
12
15
|
export const FENCE_LANGUAGES = [
|
|
13
16
|
'ts',
|
|
14
17
|
'tsx',
|
|
@@ -21,6 +24,7 @@ export const FENCE_LANGUAGES = [
|
|
|
21
24
|
'css',
|
|
22
25
|
'diff',
|
|
23
26
|
'yaml',
|
|
27
|
+
...PACKAGE_MANAGERS,
|
|
24
28
|
];
|
|
25
29
|
export const IMAGE_EXTENSIONS = [
|
|
26
30
|
'.png',
|
|
@@ -289,11 +293,14 @@ function validatePage(page, version, context, errors) {
|
|
|
289
293
|
}
|
|
290
294
|
for (const fence of scan.fences) {
|
|
291
295
|
const where = `${page.file}:${fence.line}`;
|
|
292
|
-
if (
|
|
296
|
+
if (SHELL_LANGUAGES.includes(fence.language)) {
|
|
293
297
|
for (const line of fence.content.split('\n')) {
|
|
294
298
|
if (!INSTALL_COMMAND.test(line)) {
|
|
295
299
|
continue;
|
|
296
300
|
}
|
|
301
|
+
if (!PACKAGE_MANAGERS.includes(fence.language)) {
|
|
302
|
+
issue(errors, 'install-fence', where, `Put install commands in one fence per package manager (${PACKAGE_MANAGERS.join(', ')}), not in a ${fence.language} fence.`);
|
|
303
|
+
}
|
|
297
304
|
const packages = line
|
|
298
305
|
.split(/\s+/)
|
|
299
306
|
.filter((word) => isFamilyPackage(word, context.family));
|