diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 596ed37f96ba..f2d845b30e23 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -45,7 +45,6 @@ jobs: run: npm run check-deps test: - if: github.repository == 'github/docs-internal' runs-on: windows-latest strategy: fail-fast: false diff --git a/lib/all-products.js b/lib/all-products.js index 72edac31fd34..09e9d2070aae 100644 --- a/lib/all-products.js +++ b/lib/all-products.js @@ -1,5 +1,6 @@ const fs = require('fs') const path = require('path') +const slash = require('slash') const assert = require('assert') const { difference } = require('lodash') const yaml = require('js-yaml') @@ -23,11 +24,11 @@ const internalProducts = {} sortedProductIds.forEach(productId => { const relPath = productId - const dir = path.join('content', relPath) - const toc = path.join(dir, 'index.md') + const dir = slash(path.join('content', relPath)) + const toc = slash(path.join(dir, 'index.md')) const { data } = frontmatter(fs.readFileSync(toc, 'utf8')) const applicableVersions = getApplicableVersions(data.versions, toc) - const href = path.join('/', applicableVersions[0], productId) + const href = slash(path.join('/', applicableVersions[0], productId)) internalProducts[productId] = { id: productId, diff --git a/lib/redirects/precompile.js b/lib/redirects/precompile.js index 97cd39cacba5..91f57591efbf 100755 --- a/lib/redirects/precompile.js +++ b/lib/redirects/precompile.js @@ -1,4 +1,5 @@ const path = require('path') +const slash = require('slash') const patterns = require('../patterns') const { latest } = require('../enterprise-server-releases') const getOldPathsFromPermalink = require('../redirects/get-old-paths-from-permalink') @@ -85,7 +86,7 @@ module.exports = async function precompileRedirects (pages) { // add a veriation like `/free-pro-team@latest/v3/gists/comments`; // again, we need to do this because all links in content get rewritten if (!developerRoute.startsWith('/enterprise/')) { - const developerRouteWithVersion = path.join(nonEnterpriseDefaultVersion, developerRoute) + const developerRouteWithVersion = slash(path.join(nonEnterpriseDefaultVersion, developerRoute)) const developerRouteWithVersionAndLanguage = `/en/${developerRouteWithVersion}` allRedirects[developerRouteWithVersion] = newPath allRedirects[developerRouteWithVersionAndLanguage] = newPath diff --git a/middleware/archived-enterprise-versions.js b/middleware/archived-enterprise-versions.js index 9c0d7f68f650..1c533f3c669a 100644 --- a/middleware/archived-enterprise-versions.js +++ b/middleware/archived-enterprise-versions.js @@ -1,4 +1,5 @@ const path = require('path') +const slash = require('slash') const { latest, deprecated, firstVersionDeprecatedOnNewSite, lastVersionWithoutStubbedRedirectFiles } = require('../lib/enterprise-server-releases') const patterns = require('../lib/patterns') const versionSatisfiesRange = require('../lib/version-satisfies-range') @@ -69,7 +70,7 @@ module.exports = async (req, res, next) => { // for <2.13: /2.12/user/articles/viewing-contributions-on-your-profile function getProxyPath (reqPath, requestedVersion) { const proxyPath = versionSatisfiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`) - ? path.join('/', requestedVersion, reqPath) + ? slash(path.join('/', requestedVersion, reqPath)) : reqPath.replace(/^\/enterprise/, '') return `https://github.github.com/help-docs-archived-enterprise-versions${proxyPath}` @@ -97,7 +98,7 @@ function getFallbackRedirects (req, requestedVersion) { // ] .filter(oldPath => oldPath.startsWith('/enterprise') && patterns.enterpriseNoVersion.test(oldPath)) // add in the current language and version - .map(oldPath => path.join('/', req.context.currentLanguage, oldPath.replace('/enterprise/', `/enterprise/${requestedVersion}/`))) + .map(oldPath => slash(path.join('/', req.context.currentLanguage, oldPath.replace('/enterprise/', `/enterprise/${requestedVersion}/`)))) // ignore paths that match the requested path .filter(oldPath => oldPath !== req.path) } diff --git a/tests/content/lint-files.js b/tests/content/lint-files.js index 7a918b074731..085a392e4e0c 100644 --- a/tests/content/lint-files.js +++ b/tests/content/lint-files.js @@ -1,4 +1,5 @@ const path = require('path') +const slash = require('slash') const fs = require('fs') const walk = require('walk-sync') const matter = require('@github-docs/frontmatter') @@ -109,11 +110,11 @@ describe('lint-files', () => { } const contentMarkdownAbsPaths = walk(contentDir, mdWalkOptions).sort() - const contentMarkdownRelPaths = contentMarkdownAbsPaths.map(p => path.relative(rootDir, p)) + const contentMarkdownRelPaths = contentMarkdownAbsPaths.map(p => slash(path.relative(rootDir, p))) const contentMarkdownTuples = zip(contentMarkdownRelPaths, contentMarkdownAbsPaths) const reusableMarkdownAbsPaths = walk(reusablesDir, mdWalkOptions).sort() - const reusableMarkdownRelPaths = reusableMarkdownAbsPaths.map(p => path.relative(rootDir, p)) + const reusableMarkdownRelPaths = reusableMarkdownAbsPaths.map(p => slash(path.relative(rootDir, p))) const reusableMarkdownTuples = zip(reusableMarkdownRelPaths, reusableMarkdownAbsPaths) describe.each([...contentMarkdownTuples, ...reusableMarkdownTuples])(