Skip to content

Commit 01dbdc9

Browse files
authored
Merge pull request #594 from git-stunts/fix-279-standard-doc-pointers
Fix #279: add standard doc root pointers
2 parents 79b15e0 + 4f6312b commit 01dbdc9

4 files changed

Lines changed: 51 additions & 0 deletions

File tree

CODE_OF_CONDUCT.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Code of Conduct
2+
3+
The repository code of conduct lives in
4+
[.github/CODE_OF_CONDUCT.md](.github/CODE_OF_CONDUCT.md).

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Contributing
2+
3+
Repository contribution guidance lives in
4+
[.github/CONTRIBUTING.md](.github/CONTRIBUTING.md).

SECURITY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Security
2+
3+
Repository security and vulnerability reporting guidance lives in
4+
[.github/SECURITY.md](.github/SECURITY.md).
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { existsSync, readFileSync } from 'node:fs';
2+
import { fileURLToPath } from 'node:url';
3+
import { describe, expect, it } from 'vitest';
4+
5+
const repoRoot = fileURLToPath(new URL('../../../', import.meta.url));
6+
7+
function readRepoFile(relativePath: string): string {
8+
return readFileSync(`${repoRoot}${relativePath}`, 'utf8');
9+
}
10+
11+
describe('repository standard docs', () => {
12+
it('keeps root pointers to the canonical GitHub standard docs', () => {
13+
const pointers = [
14+
{
15+
rootPath: 'CODE_OF_CONDUCT.md',
16+
githubPath: '.github/CODE_OF_CONDUCT.md',
17+
heading: 'Code of Conduct',
18+
},
19+
{
20+
rootPath: 'CONTRIBUTING.md',
21+
githubPath: '.github/CONTRIBUTING.md',
22+
heading: 'Contributing',
23+
},
24+
{
25+
rootPath: 'SECURITY.md',
26+
githubPath: '.github/SECURITY.md',
27+
heading: 'Security',
28+
},
29+
];
30+
31+
for (const pointer of pointers) {
32+
expect(existsSync(`${repoRoot}${pointer.rootPath}`)).toBe(true);
33+
expect(existsSync(`${repoRoot}${pointer.githubPath}`)).toBe(true);
34+
const rootPointer = readRepoFile(pointer.rootPath);
35+
expect(rootPointer).toContain(`[${pointer.githubPath}](${pointer.githubPath})`);
36+
expect(rootPointer).toContain(`# ${pointer.heading}\n\n`);
37+
}
38+
});
39+
});

0 commit comments

Comments
 (0)