Skip to content

Commit 7403206

Browse files
authored
Remove support versions: * (#40548)
1 parent ceaeec8 commit 7403206

File tree

14 files changed

+69
-19
lines changed

14 files changed

+69
-19
lines changed

content/get-started/learning-about-github/about-versions-of-github-docs.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
---
22
title: About versions of GitHub Docs
33
intro: 'You can read documentation that reflects the {% data variables.product.company_short %} product you''re currently using.'
4-
versions: '*'
4+
versions:
5+
fpt: '*'
6+
ghes: '*'
7+
ghae: '*'
8+
ghec: '*'
59
shortTitle: Docs versions
610
---
711

content/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ redirect_from:
4242
- /github/enforcing-best-practices-with-github-policies/sharing
4343
- /early-access/github/enforcing-best-practices-with-github-policies/syntax
4444
- /github/enforcing-best-practices-with-github-policies/syntax
45-
versions: '*'
45+
versions:
46+
fpt: '*'
47+
ghes: '*'
48+
ghae: '*'
49+
ghec: '*'
4650
children:
4751
- search
4852
- get-started

lib/get-applicable-versions.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ function getApplicableVersions(versionsObj, filepath, opts = {}) {
1414
throw new Error(`No \`versions\` frontmatter found in ${filepath}`)
1515
}
1616

17-
// all versions are applicable!
17+
// Catch an old frontmatter value that was used to indicate an article was available in all versions.
1818
if (versionsObj === '*') {
19-
return allVersionKeys
19+
throw new Error(
20+
`${filepath} contains the invalid versions frontmatter: *. Please explicitly list out all the versions that apply to this article.`,
21+
)
2022
}
2123

2224
if (!featureData) {

script/update-tocs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// [start-readme]
44
//
55
// This script creates or updates an index.md file for a given directory.
6-
// It will add `children` frontmatter in alphabetical order and create versions: '*'.
6+
// It will add `children` frontmatter in alphabetical order and create versions: { fpt: '*', ghes: '*', ghae: '*', ghec: '*' }.
77
// It also prints a helpful message to update those values manually if needed.
88
//
99
// [end-readme]
@@ -52,7 +52,7 @@ function updateOrCreateToc(directory) {
5252
content = ''
5353
data = {
5454
title: sentenceCase(path.basename(directory)), // fake the title of the index.md from the directory name
55-
versions: '*', // default to all versions
55+
versions: { fpt: '*', ghes: '*', ghae: '*', ghec: '*' }, // default to all versions
5656
}
5757
}
5858

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: Article with redirect_from string
3-
versions: '*'
3+
versions:
4+
fpt: '*'
5+
ghes: '*'
6+
ghae: '*'
7+
ghec: '*'
48
redirect_from: /redirect-string
59
---

tests/fixtures/content/early-access/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
---
22
title: Early Access documentation
33
hidden: true
4-
versions: '*'
4+
versions:
5+
fpt: '*'
6+
ghes: '*'
7+
ghae: '*'
8+
ghec: '*'
59
children:
610
- /secrets
711
---

tests/fixtures/content/early-access/secrets/deeper/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
title: Deeper secrets
3-
versions: '*'
3+
versions:
4+
fpt: '*'
5+
ghes: '*'
6+
ghae: '*'
7+
ghec: '*'
48
hidden: true
59
children:
610
- /mariana-trench

tests/fixtures/content/early-access/secrets/deeper/mariana-trench.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
title: Mariana Trench
3-
versions: '*'
3+
versions:
4+
fpt: '*'
5+
ghes: '*'
6+
ghae: '*'
7+
ghec: '*'
48
hidden: true
59
---
610

tests/fixtures/content/early-access/secrets/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
title: GitHub Secrets
3-
versions: '*'
3+
versions:
4+
fpt: '*'
5+
ghes: '*'
6+
ghae: '*'
7+
ghec: '*'
48
hidden: true
59
children:
610
- /early-days

tests/fixtures/content/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ featuredLinks:
1212
- /actions/category/map-topic
1313
redirect_from:
1414
- /olden-days
15-
versions: '*'
15+
versions:
16+
fpt: '*'
17+
ghes: '*'
18+
ghae: '*'
19+
ghec: '*'
1620
children:
1721
# The list of childen in the fixtures has to be the same names
1822
# as we use in the real content. It can have fewer but can't include
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
title: Sample page
3-
versions: '*'
3+
versions:
4+
fpt: '*'
5+
ghes: '*'
6+
ghae: '*'
7+
ghec: '*'
48
---
59

610
{% data foo.bar.tipu %}
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
title: Good sample page
3-
versions: '*'
3+
versions:
4+
fpt: '*'
5+
ghes: '*'
6+
ghae: '*'
7+
ghec: '*'
48
---
59

610
{% data variables.stuff.foo %}

tests/unit/get-applicable-versions.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,18 @@ describe('Versions frontmatter', () => {
3535
})
3636

3737
describe('general cases', () => {
38-
test('simply a wildcard', () => {
39-
const applicableVersions = getApplicableVersions('*')
40-
expect(applicableVersions.length).toBe(Object.keys(allVersions).length)
41-
expect(Object.keys(allVersions).every((v) => applicableVersions.includes(v)))
38+
test('wildcard * is no longer used', () => {
39+
// docs engineering 3110
40+
expect.assertions(2)
41+
try {
42+
getApplicableVersions('*')
43+
} catch (e) {
44+
expect(e).toBeInstanceOf(Error)
45+
expect(e).toHaveProperty(
46+
'message',
47+
'undefined contains the invalid versions frontmatter: *. Please explicitly list out all the versions that apply to this article.',
48+
)
49+
}
4250
})
4351
test("using 'features'", () => {
4452
const possibleFeatures = fs

tests/unit/page.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ describe('Page class', () => {
341341
basePath: path.join(__dirname, '../../content'),
342342
languageCode: 'en',
343343
})
344-
expect(page.versions).toBe('*')
344+
expect(page.versions).toEqual({ fpt: '*', ghae: '*', ghec: '*', ghes: '*' })
345345
})
346346

347347
test('enterprise admin index page', async () => {

0 commit comments

Comments
 (0)