Skip to content

repo sync #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -21,7 +21,9 @@ If you don't define a configuration in your repository, {% data variables.produc

You can create a default codespace configuration using a pre-built container configuration for your project type, or you can create a custom configuration specific to your project's needs.

{% data variables.product.prodname_codespaces %} uses settings contained in a file named `devcontainer.json` in the root of the repository or in a `.devcontainer` folder. You can use `devcontainer.json` to set default settings for the entire codespace environment, including the {% data variables.product.prodname_vscode %} editor, but you can also set editor-specific settings in a file named `.vscode/settings.json`.
{% data variables.product.prodname_codespaces %} uses settings contained in a configuration file named `devcontainer.json`. {% data reusables.codespaces.devcontainer-location %}

You can use your `devcontainer.json` to set default settings for the entire codespace environment, including the {% data variables.product.prodname_vscode %} editor, but you can also set editor-specific settings in a file named `.vscode/settings.json`.

Changes to a repository's codespace configuration apply only to every new codespace and do not affect any existing codespace.

@@ -38,7 +40,9 @@ Each new codespace created from a branch which contains the `.devcontainer` fold

### Creating a custom codespace configuration

If none of the pre-built configurations meet your needs, you can create a custom configuration by adding a `devcontainer.json` file to the root of your repository or a `.devcontainer` folder. In the file, you can use supported configuration keys to specify aspects of the codespace's environment, like which {% data variables.product.prodname_vscode %} extensions will be installed.
If none of the pre-built configurations meet your needs, you can create a custom configuration by adding a `devcontainer.json` file. {% data reusables.codespaces.devcontainer-location %}

In the file, you can use supported configuration keys to specify aspects of the codespace's environment, like which {% data variables.product.prodname_vscode %} extensions will be installed.

{% data reusables.codespaces.vscode-settings-order %}

1 change: 1 addition & 0 deletions data/reusables/codespaces/devcontainer-location.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file can be located in the root of the repository or in a folder called `.devcontainer`. If the file is located in the root of the repository, the filename must begin with a period: `.devcontainer.json`.
4 changes: 2 additions & 2 deletions lib/enterprise-server-releases.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const versionSatisifiesRange = require('./version-satisfies-range')
const versionSatisfiesRange = require('./version-satisfies-range')

// GHES Release Lifecycle Dates:
// https://github.com/github/enterprise-releases/blob/master/docs/supported-versions.md#release-lifecycle-dates
@@ -36,7 +36,7 @@ const all = supported.concat(deprecated)
const latest = supported[0]
const oldestSupported = supported[supported.length - 1]
const nextDeprecationDate = dates[oldestSupported].deprecationDate
const deprecatedOnNewSite = deprecated.filter(version => versionSatisifiesRange(version, '>=2.13'))
const deprecatedOnNewSite = deprecated.filter(version => versionSatisfiesRange(version, '>=2.13'))
const firstVersionDeprecatedOnNewSite = '2.13'
// starting from 2.18, we updated the archival script to create stubbed HTML redirect files
const lastVersionWithoutStubbedRedirectFiles = '2.17'
4 changes: 2 additions & 2 deletions lib/get-applicable-versions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const allVersions = require('./all-versions')
const versionSatisifiesRange = require('./version-satisfies-range')
const versionSatisfiesRange = require('./version-satisfies-range')

// return an array of versions that an article's product versions encompasses
function getApplicableVersions (frontmatterVersions, filepath) {
@@ -33,7 +33,7 @@ function getApplicableVersions (frontmatterVersions, filepath) {
relevantVersions.forEach(relevantVersion => {
// special handling for versions with numbered releases
if (relevantVersion.hasNumberedReleases) {
if (versionSatisifiesRange(relevantVersion.currentRelease, planValue)) {
if (versionSatisfiesRange(relevantVersion.currentRelease, planValue)) {
applicableVersions.push(relevantVersion.version)
}
} else {
6 changes: 3 additions & 3 deletions lib/redirects/get-old-paths-from-permalink.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { latest, lastReleaseWithLegacyFormat } = require('../enterprise-server-releases')
const { getPathWithoutLanguage, getPathWithLanguage } = require('../path-utils')
const patterns = require('../patterns')
const versionSatisifiesRange = require('../version-satisfies-range')
const versionSatisfiesRange = require('../version-satisfies-range')
const currentlySupportedVersions = Object.keys(require('../all-versions'))
const nonEnterpriseDefaultVersion = require('../non-enterprise-default-version')

@@ -32,7 +32,7 @@ module.exports = function getOldPathsFromPath (currentPath, languageCode, curren
}

// create old path /user from current path /user/github on 2.16+ only
if (currentlySupportedVersions.includes(currentVersion) || versionSatisifiesRange(currentVersion, '>2.15')) {
if (currentlySupportedVersions.includes(currentVersion) || versionSatisfiesRange(currentVersion, '>2.15')) {
oldPaths.add(currentPath
.replace('/user/github', '/user'))
}
@@ -55,7 +55,7 @@ module.exports = function getOldPathsFromPath (currentPath, languageCode, curren
// ------ END LEGACY VERSION FORMAT REPLACEMENTS ------//

// ------ BEGIN MODERN VERSION FORMAT REPLACEMENTS ------//
if (currentlySupportedVersions.includes(currentVersion) || versionSatisifiesRange(currentVersion, `>${lastReleaseWithLegacyFormat}`)) {
if (currentlySupportedVersions.includes(currentVersion) || versionSatisfiesRange(currentVersion, `>${lastReleaseWithLegacyFormat}`)) {
oldPaths.forEach(oldPath => {
// create old path /github from new path /free-pro-team@latest/github
oldPaths.add(oldPath
2 changes: 1 addition & 1 deletion lib/version-satisfies-range.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ const semver = require('semver')

// workaround for Enterprise Server 11.10.340 because we can't use semver to
// compare it to 2.x like we can with 2.0+
module.exports = function versionSatisifiesRange (version, range) {
module.exports = function versionSatisfiesRange (version, range) {
if (version === '11.10.340') return range.startsWith('<')

return semver.satisfies(semver.coerce(version), range)
6 changes: 3 additions & 3 deletions middleware/archived-enterprise-versions-assets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const path = require('path')
const versionSatisifiesRange = require('../lib/version-satisfies-range')
const versionSatisfiesRange = require('../lib/version-satisfies-range')
const enterpriseServerReleases = require('../lib/enterprise-server-releases')
const patterns = require('../lib/patterns')
const firstVersionDeprecatedOnNewSite = '2.13'
@@ -32,10 +32,10 @@ module.exports = async (req, res, next) => {

// paths are slightly different depending on the enterprise version
let proxyPath
if (versionSatisifiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`)) {
if (versionSatisfiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`)) {
// routing for >=2.13
proxyPath = path.join('/', requestedVersion, assetPath)
} else if (versionSatisifiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)) {
} else if (versionSatisfiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)) {
// routing for <2.13
proxyPath = path.join('/', requestedVersion, 'assets', assetPath)
}
14 changes: 7 additions & 7 deletions middleware/archived-enterprise-versions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const path = require('path')
const { latest, deprecated, firstVersionDeprecatedOnNewSite, lastVersionWithoutStubbedRedirectFiles } = require('../lib/enterprise-server-releases')
const patterns = require('../lib/patterns')
const versionSatisifiesRange = require('../lib/version-satisfies-range')
const versionSatisfiesRange = require('../lib/version-satisfies-range')
const got = require('got')
const findPage = require('../lib/find-page')

@@ -26,14 +26,14 @@ module.exports = async (req, res, next) => {

// redirect language-prefixed URLs like /en/enterprise/2.10 -> /enterprise/2.10
// (this only applies to versions <2.13)
if (req.path.startsWith('/en/') && versionSatisifiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)) {
if (req.path.startsWith('/en/') && versionSatisfiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)) {
return res.redirect(301, req.baseUrl + req.path.replace(/^\/en/, ''))
}

// find redirects for versions between 2.13 and 2.17
// starting with 2.18, we updated the archival script to create stubbed HTML redirect files
if (versionSatisifiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`) &&
versionSatisifiesRange(requestedVersion, `<=${lastVersionWithoutStubbedRedirectFiles}`)) {
if (versionSatisfiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`) &&
versionSatisfiesRange(requestedVersion, `<=${lastVersionWithoutStubbedRedirectFiles}`)) {
const redirect = req.context.redirects[req.path]
if (redirect && redirect !== req.path) {
return res.redirect(301, redirect)
@@ -68,7 +68,7 @@ module.exports = async (req, res, next) => {
// for >=2.13: /2.13/en/enterprise/2.13/user/articles/viewing-contributions-on-your-profile
// for <2.13: /2.12/user/articles/viewing-contributions-on-your-profile
function getProxyPath (reqPath, requestedVersion) {
const proxyPath = versionSatisifiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`)
const proxyPath = versionSatisfiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`)
? path.join('/', requestedVersion, reqPath)
: reqPath.replace(/^\/enterprise/, '')

@@ -78,8 +78,8 @@ function getProxyPath (reqPath, requestedVersion) {
// from 2.13 to 2.17, we lost access to frontmatter redirects during the archival process
// this workaround finds potentially relevant frontmatter redirects in currently supported pages
function getFallbackRedirects (req, requestedVersion) {
if (versionSatisifiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)) return
if (versionSatisifiesRange(requestedVersion, `>${lastVersionWithoutStubbedRedirectFiles}`)) return
if (versionSatisfiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)) return
if (versionSatisfiesRange(requestedVersion, `>${lastVersionWithoutStubbedRedirectFiles}`)) return

const pathWithNewVersion = req.path.replace(requestedVersion, latest)