Skip to content

Commit 71675ff

Browse files
authored
repo sync
2 parents 7b599f1 + 67021f3 commit 71675ff

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

.github/workflows/test-windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ jobs:
4545
run: npm run check-deps
4646

4747
test:
48-
if: github.repository == 'github/docs-internal'
4948
runs-on: windows-latest
5049
strategy:
5150
fail-fast: false

lib/all-products.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const fs = require('fs')
22
const path = require('path')
3+
const slash = require('slash')
34
const assert = require('assert')
45
const { difference } = require('lodash')
56
const yaml = require('js-yaml')
@@ -23,11 +24,11 @@ const internalProducts = {}
2324

2425
sortedProductIds.forEach(productId => {
2526
const relPath = productId
26-
const dir = path.join('content', relPath)
27-
const toc = path.join(dir, 'index.md')
27+
const dir = slash(path.join('content', relPath))
28+
const toc = slash(path.join(dir, 'index.md'))
2829
const { data } = frontmatter(fs.readFileSync(toc, 'utf8'))
2930
const applicableVersions = getApplicableVersions(data.versions, toc)
30-
const href = path.join('/', applicableVersions[0], productId)
31+
const href = slash(path.join('/', applicableVersions[0], productId))
3132

3233
internalProducts[productId] = {
3334
id: productId,

lib/redirects/precompile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path')
2+
const slash = require('slash')
23
const patterns = require('../patterns')
34
const { latest } = require('../enterprise-server-releases')
45
const getOldPathsFromPermalink = require('../redirects/get-old-paths-from-permalink')
@@ -85,7 +86,7 @@ module.exports = async function precompileRedirects (pages) {
8586
// add a veriation like `/free-pro-team@latest/v3/gists/comments`;
8687
// again, we need to do this because all links in content get rewritten
8788
if (!developerRoute.startsWith('/enterprise/')) {
88-
const developerRouteWithVersion = path.join(nonEnterpriseDefaultVersion, developerRoute)
89+
const developerRouteWithVersion = slash(path.join(nonEnterpriseDefaultVersion, developerRoute))
8990
const developerRouteWithVersionAndLanguage = `/en/${developerRouteWithVersion}`
9091
allRedirects[developerRouteWithVersion] = newPath
9192
allRedirects[developerRouteWithVersionAndLanguage] = newPath

middleware/archived-enterprise-versions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path')
2+
const slash = require('slash')
23
const { latest, deprecated, firstVersionDeprecatedOnNewSite, lastVersionWithoutStubbedRedirectFiles } = require('../lib/enterprise-server-releases')
34
const patterns = require('../lib/patterns')
45
const versionSatisfiesRange = require('../lib/version-satisfies-range')
@@ -69,7 +70,7 @@ module.exports = async (req, res, next) => {
6970
// for <2.13: /2.12/user/articles/viewing-contributions-on-your-profile
7071
function getProxyPath (reqPath, requestedVersion) {
7172
const proxyPath = versionSatisfiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`)
72-
? path.join('/', requestedVersion, reqPath)
73+
? slash(path.join('/', requestedVersion, reqPath))
7374
: reqPath.replace(/^\/enterprise/, '')
7475

7576
return `https://github.github.com/help-docs-archived-enterprise-versions${proxyPath}`
@@ -97,7 +98,7 @@ function getFallbackRedirects (req, requestedVersion) {
9798
// ]
9899
.filter(oldPath => oldPath.startsWith('/enterprise') && patterns.enterpriseNoVersion.test(oldPath))
99100
// add in the current language and version
100-
.map(oldPath => path.join('/', req.context.currentLanguage, oldPath.replace('/enterprise/', `/enterprise/${requestedVersion}/`)))
101+
.map(oldPath => slash(path.join('/', req.context.currentLanguage, oldPath.replace('/enterprise/', `/enterprise/${requestedVersion}/`))))
101102
// ignore paths that match the requested path
102103
.filter(oldPath => oldPath !== req.path)
103104
}

tests/content/lint-files.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const path = require('path')
2+
const slash = require('slash')
23
const fs = require('fs')
34
const walk = require('walk-sync')
45
const matter = require('@github-docs/frontmatter')
@@ -109,11 +110,11 @@ describe('lint-files', () => {
109110
}
110111

111112
const contentMarkdownAbsPaths = walk(contentDir, mdWalkOptions).sort()
112-
const contentMarkdownRelPaths = contentMarkdownAbsPaths.map(p => path.relative(rootDir, p))
113+
const contentMarkdownRelPaths = contentMarkdownAbsPaths.map(p => slash(path.relative(rootDir, p)))
113114
const contentMarkdownTuples = zip(contentMarkdownRelPaths, contentMarkdownAbsPaths)
114115

115116
const reusableMarkdownAbsPaths = walk(reusablesDir, mdWalkOptions).sort()
116-
const reusableMarkdownRelPaths = reusableMarkdownAbsPaths.map(p => path.relative(rootDir, p))
117+
const reusableMarkdownRelPaths = reusableMarkdownAbsPaths.map(p => slash(path.relative(rootDir, p)))
117118
const reusableMarkdownTuples = zip(reusableMarkdownRelPaths, reusableMarkdownAbsPaths)
118119

119120
describe.each([...contentMarkdownTuples, ...reusableMarkdownTuples])(

0 commit comments

Comments
 (0)