diff --git a/.gitignore b/.gitignore index 9708efd3418..7b58c17bbe8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ lib_map.json .jekyll-metadata .netlify __pycache__/ +node_modules +.vercel diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000000..209e3ef4b62 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20 diff --git a/.ruby-version b/.ruby-version index be94e6f53db..15a27998172 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.2 +3.3.0 diff --git a/Gemfile.lock b/Gemfile.lock index 3a1bdcb5b85..49774f0191c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,46 +1,59 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.0.7.2) - concurrent-ruby (~> 1.0, >= 1.0.2) + activesupport (7.2.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - tzinfo (~> 2.0) - addressable (2.8.4) - public_suffix (>= 2.0.2, < 6.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + base64 (0.2.0) + bigdecimal (3.1.8) coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.11.1) + coffee-script-source (1.12.2) colorator (1.1.0) commonmarker (0.23.10) - concurrent-ruby (1.2.2) - dnsruby (1.70.0) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + csv (3.3.0) + dnsruby (1.72.2) simpleidn (~> 0.2.1) + drb (2.2.1) em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) ethon (0.16.0) ffi (>= 1.15.0) eventmachine (1.2.7) - execjs (2.8.1) - faraday (2.7.4) - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.2) - ffi (1.15.5) + execjs (2.9.1) + faraday (2.12.0) + faraday-net_http (>= 2.0, < 3.4) + json + logger + faraday-net_http (3.3.0) + net-http + ffi (1.17.0-x86_64-linux-gnu) forwardable-extended (2.6.0) - gemoji (3.0.1) - github-pages (228) - github-pages-health-check (= 1.17.9) - jekyll (= 3.9.3) - jekyll-avatar (= 0.7.0) - jekyll-coffeescript (= 1.1.1) - jekyll-commonmark-ghpages (= 0.4.0) - jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.15.1) + gemoji (4.1.0) + github-pages (232) + github-pages-health-check (= 1.18.2) + jekyll (= 3.10.0) + jekyll-avatar (= 0.8.0) + jekyll-coffeescript (= 1.2.2) + jekyll-commonmark-ghpages (= 0.5.1) + jekyll-default-layout (= 0.1.5) + jekyll-feed (= 0.17.0) jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.13.0) + jekyll-github-metadata (= 2.16.1) jekyll-include-cache (= 0.2.1) jekyll-mentions (= 1.6.0) jekyll-optional-front-matter (= 0.3.2) @@ -67,30 +80,32 @@ GEM jekyll-theme-tactile (= 0.2.0) jekyll-theme-time-machine (= 0.2.0) jekyll-titles-from-headings (= 0.5.3) - jemoji (= 0.12.0) - kramdown (= 2.3.2) + jemoji (= 0.13.0) + kramdown (= 2.4.0) kramdown-parser-gfm (= 1.1.0) liquid (= 4.0.4) mercenary (~> 0.3) minima (= 2.5.1) - nokogiri (>= 1.13.6, < 2.0) - rouge (= 3.26.0) + nokogiri (>= 1.16.2, < 2.0) + rouge (= 3.30.0) terminal-table (~> 1.4) - github-pages-health-check (1.17.9) + webrick (~> 1.8) + github-pages-health-check (1.18.2) addressable (~> 2.3) dnsruby (~> 1.60) - octokit (~> 4.0) - public_suffix (>= 3.0, < 5.0) + octokit (>= 4, < 8) + public_suffix (>= 3.0, < 6.0) typhoeus (~> 1.3) html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) http_parser.rb (0.8.0) - i18n (1.14.1) + i18n (1.14.6) concurrent-ruby (~> 1.0) - jekyll (3.9.3) + jekyll (3.10.0) addressable (~> 2.4) colorator (~> 1.0) + csv (~> 3.0) em-websocket (~> 0.5) i18n (>= 0.7, < 2) jekyll-sass-converter (~> 1.0) @@ -101,27 +116,28 @@ GEM pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - jekyll-avatar (0.7.0) + webrick (>= 1.0) + jekyll-avatar (0.8.0) jekyll (>= 3.0, < 5.0) - jekyll-coffeescript (1.1.1) + jekyll-coffeescript (1.2.2) coffee-script (~> 2.2) - coffee-script-source (~> 1.11.1) + coffee-script-source (~> 1.12) jekyll-commonmark (1.4.0) commonmarker (~> 0.22) - jekyll-commonmark-ghpages (0.4.0) - commonmarker (~> 0.23.7) - jekyll (~> 3.9.0) + jekyll-commonmark-ghpages (0.5.1) + commonmarker (>= 0.23.7, < 1.1.0) + jekyll (>= 3.9, < 4.0) jekyll-commonmark (~> 1.4.0) rouge (>= 2.0, < 5.0) - jekyll-default-layout (0.1.4) - jekyll (~> 3.0) - jekyll-feed (0.15.1) + jekyll-default-layout (0.1.5) + jekyll (>= 3.0, < 5.0) + jekyll-feed (0.17.0) jekyll (>= 3.7, < 5.0) jekyll-gist (1.5.0) octokit (~> 4.2) - jekyll-github-metadata (2.13.0) + jekyll-github-metadata (2.16.1) jekyll (>= 3.4, < 5.0) - octokit (~> 4.0, != 4.4.0) + octokit (>= 4, < 7, != 4.4.0) jekyll-include-cache (0.2.1) jekyll (>= 3.7, < 5.0) jekyll-mentions (1.6.0) @@ -192,45 +208,47 @@ GEM jekyll (>= 3.3, < 5.0) jekyll-watch (2.2.1) listen (~> 3.0) - jemoji (0.12.0) - gemoji (~> 3.0) + jemoji (0.13.0) + gemoji (>= 3, < 5) html-pipeline (~> 2.2) jekyll (>= 3.0, < 5.0) + json (2.7.2) just-the-docs (0.3.3) jekyll (>= 3.8.5) jekyll-seo-tag (~> 2.0) rake (>= 12.3.1, < 13.1.0) - kramdown (2.3.2) + kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) liquid (4.0.4) - listen (3.8.0) + listen (3.9.0) rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) + logger (1.6.1) mercenary (0.3.6) minima (2.5.1) jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.19.0) - nokogiri (1.16.5-x86_64-linux) + minitest (5.25.1) + net-http (0.4.1) + uri + nokogiri (1.16.7-x86_64-linux) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) sawyer (~> 0.9) pathutil (0.16.2) forwardable-extended (~> 2.6) - public_suffix (4.0.7) - racc (1.7.3) + public_suffix (5.1.1) + racc (1.8.1) rake (13.0.6) rb-fsevent (0.11.2) - rb-inotify (0.10.1) + rb-inotify (0.11.1) ffi (~> 1.0) - rexml (3.3.6) - strscan - rouge (3.26.0) - ruby2_keywords (0.0.5) + rexml (3.3.7) + rouge (3.30.0) rubyzip (2.3.2) safe_yaml (1.0.5) sass (3.7.4) @@ -241,19 +259,16 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - simpleidn (0.2.1) - unf (~> 0.1.4) - strscan (3.1.0) + securerandom (0.3.1) + simpleidn (0.2.3) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - typhoeus (1.4.0) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) unicode-display_width (1.8.0) + uri (0.13.1) webrick (1.8.1) PLATFORMS @@ -265,4 +280,4 @@ DEPENDENCIES webrick (~> 1.8) BUNDLED WITH - 2.4.10 + 2.5.16 diff --git a/_config.yml b/_config.yml index a2cdf70f554..ac97d04fce1 100644 --- a/_config.yml +++ b/_config.yml @@ -13,6 +13,13 @@ exclude: - README.md - release_checklist.md - ci/ + - node_modules/ + - package.json + - package-lock.json + - vercel.sh + - vercel.json + - Gemfile + - Gemfile.lock include: - _sources - _static diff --git a/ci/vercel/config.mjs b/ci/vercel/config.mjs new file mode 100644 index 00000000000..ebaa8e3f900 --- /dev/null +++ b/ci/vercel/config.mjs @@ -0,0 +1,8 @@ +import { makeRoutes } from "./routes.mjs"; + +const makeConfig = () => ({ + version: 3, + routes: makeRoutes(), +}); + +console.log(JSON.stringify(makeConfig(), null, 2)); diff --git a/ci/vercel/routes.mjs b/ci/vercel/routes.mjs new file mode 100644 index 00000000000..7463e2d283a --- /dev/null +++ b/ci/vercel/routes.mjs @@ -0,0 +1,54 @@ +import { getTransformedRoutes } from "@vercel/routing-utils"; +import { convertTrailingSlash } from "@vercel/routing-utils/dist/superstatic.js"; +import { readFileSync } from "node:fs"; +import path from "node:path"; + +const DEFAULT_REDIRECT_CODE = 301; + +const makeRedirectsFromFile = () => { + const redirectsFile = path.join( + import.meta.dirname, + "..", + "..", + "_redirects" + ); + const redirectsFileContents = readFileSync(redirectsFile, "utf8"); + const redirects = redirectsFileContents + .split("\n") + .filter(Boolean) + .map((line) => { + const [source, destination] = line.split(/\s+/).filter(Boolean); + return { + source, + destination, + statusCode: DEFAULT_REDIRECT_CODE, + }; + }); + return redirects; +}; + +const makeRedirects = () => { + const redirects = []; + redirects.push(...makeRedirectsFromFile()); + return redirects; +}; + +export const makeRoutes = () => { + const { routes, error } = getTransformedRoutes({ + redirects: makeRedirects(), + }); + + if (error) throw error; + return [ + ...convertTrailingSlash(true, 301), + ...routes, + { + handle: "error", + }, + { + status: 404, + src: "^.*$", + dest: "/404.html", + }, + ]; +}; diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000000..0463c8de0bf --- /dev/null +++ b/package-lock.json @@ -0,0 +1,88 @@ +{ + "name": "docs", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@vercel/routing-utils": "^3.1.0" + } + }, + "node_modules/@vercel/routing-utils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@vercel/routing-utils/-/routing-utils-3.1.0.tgz", + "integrity": "sha512-Ci5xTjVTJY/JLZXpCXpLehMft97i9fH34nu9PGav6DtwkVUF6TOPX86U0W0niQjMZ5n6/ZP0BwcJK2LOozKaGw==", + "dev": true, + "dependencies": { + "path-to-regexp": "6.1.0" + }, + "optionalDependencies": { + "ajv": "^6.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "optional": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "optional": true + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "optional": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "optional": true + }, + "node_modules/path-to-regexp": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.1.0.tgz", + "integrity": "sha512-h9DqehX3zZZDCEm+xbfU0ZmwCGFCAAraPJWMXJ4+v32NjZJilVg3k1TcKsRgIb8IQ/izZSaydDc1OhJCZvs2Dw==", + "dev": true + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "optional": true, + "dependencies": { + "punycode": "^2.1.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000000..72e1eb45ea7 --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "description": "this file is only required for Vercel", + "scripts": { + "vercel-build": "./vercel.sh" + }, + "devDependencies": { + "@vercel/routing-utils": "^3.1.0" + } +} diff --git a/vercel.json b/vercel.json new file mode 100644 index 00000000000..f9eecd70915 --- /dev/null +++ b/vercel.json @@ -0,0 +1,15 @@ +{ + "builds": [ + { + "src": "package.json", + "use": "@vercel/static-build", + "config": { + "zeroConfig": true, + "installCommand": "./vercel.sh install" + } + } + ], + "github": { + "autoJobCancelation": true + } +} diff --git a/vercel.sh b/vercel.sh new file mode 100755 index 00000000000..0f68906316c --- /dev/null +++ b/vercel.sh @@ -0,0 +1,49 @@ +#!/bin/bash +set -euo pipefail +USAGE="Usage: + build: vercel.sh + install deps: vercel.sh install +" +if [ $# -eq 0 ]; then + CMD="build" +elif [ $# -eq 1 ]; then + CMD="$1" +else + echo "${USAGE}" + exit 1 +fi +INSTALL_PREFIX="/usr/local" +export PATH="${PATH}:${INSTALL_PREFIX}/go/bin" + +install_dependencies() { + echo "installing dependencies..." + bundle install + npm install +} + +build() { + echo "printing env..." + env | sort + + echo "clean output directories..." + rm -rf ./.vercel/ ./_site + + echo "building..." + jekyll build + mkdir -p .vercel/output/ + node ci/vercel/config.mjs > .vercel/output/config.json + cp -r _site .vercel/output/static +} + +case "${CMD}" in + "install") + install_dependencies + ;; + "build") + build + ;; + *) + echo "${USAGE}" + exit 1 + ;; +esac