Skip to content

Commit 8ac60d8

Browse files
authored
Merge pull request #210 from telepresenceio/thalllgren/transfer-oss-docs
Transfer oss docs
2 parents ff2754d + 02870a8 commit 8ac60d8

File tree

631 files changed

+13821
-58934
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

631 files changed

+13821
-58934
lines changed

.eslintrc.js

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,9 @@
1-
const fs = require('fs');
2-
const graphql = require('graphql');
3-
const gatsbyESLintConfig = require('gatsby/dist/utils/eslint-config');
4-
const gatsbyWebpackUtils = require('gatsby/dist/utils/webpack-utils');
5-
6-
const graphQLSchema = (() => {
7-
let str;
8-
try {
9-
str = fs.readFileSync('./schema.graphql').toString();
10-
} catch (err) {
11-
console.log("Warning: File ./schema.graphql does not exist;\n"+
12-
" ESLint output regarding GraphQL queries may be inaccurate.\n"+
13-
" Run a Gatsby command to generate the schema file.")
14-
str = "type Query {\n\tempty(filter: Int!): Int\n}\n";
15-
}
16-
return graphql.buildSchema(str);
17-
})();
18-
const usingJSXRuntime = gatsbyWebpackUtils.reactHasJsxRuntime();
19-
20-
const baseConfig = gatsbyESLintConfig.eslintConfig(graphQLSchema, usingJSXRuntime).baseConfig;
21-
221
module.exports = {
23-
...baseConfig,
24-
2+
globals: {
3+
__PATH_PREFIX__: true,
4+
},
5+
extends: `react-app`,
256
ignorePatterns: [
267
"/public/",
278
],
28-
rules: {
29-
...baseConfig.rules,
30-
},
319
};

.github/workflows/blc.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@ jobs:
44
"Check":
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/setup-node@v2
8-
with:
9-
node-version: '16'
10-
- uses: actions/setup-python@v2
11-
with:
12-
python-version: '^3.9'
13-
- uses: actions/checkout@v2
7+
- uses: actions/setup-node@v4
8+
- uses: actions/setup-python@v5
9+
- uses: actions/checkout@v4
1410
with:
1511
path: site
16-
- uses: actions/checkout@master
12+
- uses: actions/checkout@v4
1713
with:
1814
repository: datawire/getambassador.io-blc2
1915
path: blc

.github/workflows/lint.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@ jobs:
44
"Lint":
55
runs-on: ubuntu-latest
66
steps:
7-
- uses: actions/setup-node@v2
8-
with:
9-
node-version: '16'
10-
- uses: actions/checkout@v2
7+
- uses: actions/setup-node@v4
8+
- uses: actions/checkout@v4
119
- run: yarn install
1210
- name: "yarn run gatsby build"
1311
run: |
1412
# The sed part of this command removes terminal escape codes.
15-
OVERRIDE_NODE_ENV=development yarn run gatsby build 2> >(tee /dev/stdout | sed $'s/\e[^a-z]*[a-z]//g' > err.log)
16-
- run: |
17-
! grep ^ err.log
13+
NODE_ENV=development yarn run gatsby build
1814
- name: "Dirty check"
1915
run: |
2016
git add .

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.12.2

DEVELOPING.md

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
# How to hack on this
22

33
## Releasing Docs for new Telepresence Versions
4-
If you are only making changes to the `docs/` directory and those changes
5-
aren't ready to go out immediately (for example, if they are for a future
6-
telepresence release), please make those changes in the
7-
[telepresence repository](https://github.com/telepresenceio/telepresence).
8-
9-
If you are making changes to more than the `docs/` and those changes are
10-
for a future release, merge those changes into a branch `rel/x.y.z`.
11-
12-
When it is time to do a telepresence release, the docs will be pushed to
13-
the [docs repo](https://github.com/telepresenceio/docs). From there, you can
14-
create (or checkout if it already exists) a `rel/x.y.z` branch on this repo
15-
and run `make pull-docs`. Once you merge that PR, the website will update
16-
with the docs for the new release.
174

185
## Local development quickstart
196

@@ -29,10 +16,11 @@ Commands of interest:
2916
yarn install # Install dependencies in to ./node_modules/
3017

3118
# Development
19+
export NODE_OPTIONS=--openssl-legacy-provider
3220
yarn run gatsby develop # Serve a hot-reloading development-build at http://localhost:8000/
3321
yarn run gatsby repl # Run a Node.js REPL in the Gatsby environment
3422
yarn run eslint . # Run the linter
35-
make pull-docs # Update ./docs/ from ambassador-docs.git
23+
make pull-docs # Update ./docs/ from telepresenceio/telepresence.git
3624

3725
# Production or production-like
3826
yarn run gatsby build # Build a production-build, writing it to ./public/
@@ -191,11 +179,10 @@ So we should upgrade Gatsby and associated plugins, and then turn
191179

192180
The docs-build machinery in of `package.json`, `gatsby-config.js`,
193181
`gatsby-node.js`, `src/assets/` and `src/components/` seem obviously
194-
want be a separate reusable module, so that these things don't need to
195-
be manually kept in-sync between getambassador.io, telepresence.io,
196-
and emissaryingress.io. This seems to be mostly obvious an trival to
197-
do... except for I can't figure how to handle
198-
`src/templates/doc-page.js` to where it's sufficiently
182+
want to be a separate reusable module, so that these things don't need to
183+
be manually kept in-sync between telepresence.io, and telepresence.
184+
This seems to be mostly obvious an trival to do... except for I can't
185+
figure how to handle `src/templates/doc-page.js` to where it's sufficiently
199186
parametarized/pluggable, or a way to make it possible to plug in the
200187
site-specific one.
201188

Makefile

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,24 @@
1-
define nl
2-
3-
4-
endef
5-
6-
subtree-preflight:
7-
@if ! grep -q -e 'has_been_added' $$(PATH=$$(git --exec-path):$$PATH which git-subtree 2>/dev/null) /dev/null; then \
8-
printf '$(RED)Please upgrade your git-subtree:$(END)\n'; \
9-
printf '$(BLD) sudo curl -fL https://raw.githubusercontent.com/LukeShu/git/lukeshu/next/2021-05-15/contrib/subtree/git-subtree.sh -o $$(git --exec-path)/git-subtree && sudo chmod 755 $$(git --exec-path)/git-subtree$(END)\n'; \
10-
false; \
11-
else \
12-
printf '$(GRN)git-subtree OK$(END)\n'; \
1+
# Ensure that the telepresence remote is up-to-date.
2+
telepresence-remote:
3+
@if [ "$$(git remote | grep -E '^telepresence$$')" = 'telepresence' ]; then\
4+
git remote update telepresence;\
5+
else\
6+
git remote add -f telepresence git@github.com:telepresenceio/telepresence.git;\
137
fi
14-
git gc
15-
.PHONY: subtree-preflight
8+
.PHONY: telepresence-remote
169

17-
PULL_PREFIX ?=
18-
PUSH_PREFIX ?= $(USER)/from-telepresence.io-$(shell date +%Y-%m-%d)/
10+
# MATCH_TAGS is the regexp matching the tags that we expect will have docs.
11+
MATCH_TAGS ?= ^v2\.[2-9][0-9]+\.[0-9]+(-(rc|test)\.[0-9]+)$$
1912

20-
dir2branch = $(patsubst docs/%,release/%,$(subst pre-release,v2,$1))
13+
# EXCLUDE_TAGS is used when we want to exclude some of the matching tags from the telepresence repository
14+
EXCLUDE_TAGS ?=
2115

22-
# Used when syncing from telepresenceio since that repo doesn't
23-
# have docs for v1.
24-
EXCLUDE_DIR ?= ""
25-
pull-docs: ## Update ./docs from https://github.com/telepresenceio/docs
26-
pull-docs: subtree-preflight
27-
$(foreach subdir,$(shell find docs -mindepth 1 -maxdepth 1 -type d -not -name $(EXCLUDE_DIR)|sort -V),\
28-
git subtree pull --squash --prefix=$(subdir) https://github.com/telepresenceio/docs $(PULL_PREFIX)$(call dir2branch,$(subdir))$(nl))
16+
# Update the docs at docs/v<major>.<minor> from the found tags.
17+
pull-docs:
18+
$(foreach release,$(shell git tag -l | grep -E '$(MATCH_TAGS)' | (test -n '$(EXCLUDE_TAGS)' && grep -vE '$(EXCLUDE_TAGS)' || cat) | sort -V),\
19+
dir=$$(expr '$(release)' : '\(v[0-9]\.[0-9][0-9]*\)');\
20+
echo $$dir;\
21+
rm -rf docs/$$dir;\
22+
git add docs;\
23+
git read-tree --prefix docs/$$dir -u $(release):docs)
2924
.PHONY: pull-docs
30-
31-
PUSH_BRANCH ?= $(USER)/from-telepresence.io-$(shell date +%Y-%m-%d)
32-
push-docs: ## Publish ./ambassador to https://github.com/telepresenceio/docs
33-
push-docs: subtree-preflight
34-
@PS4=; set -x; { \
35-
git remote add --no-tags remote-docs https://github.com/telepresenceio/docs && \
36-
git remote set-url --push remote-docs git@github.com:telepresenceio/docs && \
37-
:; } || true
38-
git fetch --prune remote-docs
39-
$(foreach subdir,$(shell find docs -mindepth 1 -maxdepth 1 -type d|sort -V),\
40-
git subtree push --rejoin --squash --prefix=$(subdir) remote-docs $(PUSH_PREFIX)$(call dir2branch,$(subdir))$(nl))
41-
.PHONY: push-docs

bin/serve.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function matchesRedirect(forcefulOnly, requestURL, redirect) {
4242

4343
function doRedirect(requestURL, response, redirect) {
4444
let location = redirect.to;
45-
if (!url.parse(location).search) {
45+
if (!new URL(location).search) {
4646
location += (requestURL.search||'');
4747
}
4848
response.writeHead(redirect.status, {
@@ -54,8 +54,8 @@ function doRedirect(requestURL, response, redirect) {
5454

5555
server.on('request', async (request, response) => {
5656
console.log(request.method, request.url);
57-
const requestURL = url.parse(url.resolve('/', request.url));
58-
if (requestURL.protocol || requestURL.slashes || requestURL.host) {
57+
const requestURL = new URL(url.resolve('/', request.url));
58+
if (requestURL.protocol || requestURL.host) {
5959
response.writeHead(400);
6060
response.end('Bad request URL');
6161
}

docs-config.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ module.exports = {
1616
return '/docs/' + (node.relativePath
1717
.replaceAll(path.sep, path.posix.sep)
1818
.replace(/\/index\.md$/, '/')
19-
.replace(/\.md$/, '/')
20-
.replace(/releaseNotes\.yml$/, 'release-notes/'));
19+
.replace(/\.md$/, '/'));
2120
},
2221

2322
docrootURL: function(node) {
@@ -40,21 +39,15 @@ module.exports = {
4039
},
4140

4241
canonicalURL: function(node) {
43-
const urlpath = this.urlpath(node);
44-
const version = urlpath.split(path.posix.sep)[2];
45-
if (version === "v1") {
46-
// v1 docs aren't on getambassador.io
47-
return urlpath;
48-
}
49-
const relpath = urlpath.split(path.posix.sep).slice(3).join(path.posix.sep);
42+
const relpath = this.urlpath(node).split(path.posix.sep).slice(3).join(path.posix.sep);
5043
return `https://www.getambassador.io/docs/telepresence/latest/${relpath}`;
5144
},
5245

5346
githubURL: function(node) {
5447
const gitpath = 'docs/' + (node.relativePath
55-
.replace(/^latest/,'v2.5')
48+
.replace(/^latest\//,'')
5649
.replaceAll(path.sep, path.posix.sep));
57-
return `https://github.com/telepresenceio/telepresence.io/blob/master/${gitpath}`;
50+
return `https://github.com/telepresenceio/telepresence/blob/release/v2/${gitpath}`;
5851
},
5952

6053
// Don't show reading time for Telepresence.

docs/2.14/doc-links.yml

Lines changed: 0 additions & 83 deletions
This file was deleted.

docs/2.14/quick-start/TelepresenceQuickStartLanding.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)