Skip to content

Commit

Permalink
style change to hero and remove unused repeated h3
Browse files Browse the repository at this point in the history
docs: added dashboard (apache#221)

fix: pull request in place of apache#214 (apache#222)

fix: changes to title style on landing page and doc addition

Co-authored-by: Amit Wani <[email protected]>

docs: added dashboard (apache#225)

docs: added blog `Get Front-End Test Coverage with Cypress`  (apache#227)

fix: Wrong doc url (apache#231)

fix: some url path can't replace by absolute url path (apache#237)

Co-authored-by: coolsoul <[email protected]>
Co-authored-by: 琚致远 <[email protected]>

feat: support edit this page & update styles (apache#235)

chore: fix release guide since doc layout changed (apache#238)

docs: added Integrate with Projects documentations (apache#234)

Co-authored-by: 琚致远 <[email protected]>

added latest styles

feat: algolia docSearch apache#226 (apache#241)

docs: use getting-started for ingress-controller (apache#242)

feat: upgrade APISIX version (apache#244)

fix: add <!--truncate--> to the blog markdown files apache#240 (apache#247)

fix: rectify the index doc page for apisix ingress controller (apache#249)

fix: fix the version number in mobile size overflow (apache#245)

fix: apache#220 (apache#239)

docs: added event about releasing APISIX 2.4 (apache#248)

docs: fixed broken powered-by.md link (apache#251)

docs: update navbar for apisix (apache#252)

fix: improved the description for users to join slack (apache#253)

chore: Add new committer jinchen in committer list (apache#254)

docs: add docs for ingress 0.4.0 (apache#258)

* docs: add docs for ingress 0.4.0

* docs: modify ingress downloads

* fix: lint

fix: update sync-docs.js (apache#257)

feat: improve documents synchronize (apache#262)

feat: sync user wall data (apache#260)

feat: support toggle sidebar (apache#269)

chore: move Chao Zhang from Committers to PMCs (apache#267)

feat: apache#216 add helm-chart project (apache#273)

fix: add a bundle of good first issues links to homepage  (apache#274)

feat: support apisix-docker (apache#275)

feat: broken link checker script (apache#263)

Co-authored-by: 琚致远 <[email protected]>

feat: apache#266 speed up static file (apache#270)

feat: upgrade APISIX Dashboard version (apache#276)

feat: support to load other projects (apache#277)

chore(deps): bump peaceiris/actions-gh-pages from v3 to v3.8.0 (apache#271)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

chore: upgrade APISIX 2.5 (apache#279)

chore: remove downloads for docker & helm chart (apache#284)

feat: APISIX 2.5 event (apache#283)

docs: added a new blog "Traffic Split in Apache APISIX Ingress Controller" (apache#286)

chore: support dark mode and switch (apache#289)

chore: support hide navbar on scroll down (apache#290)

fix: page not found for apisix docker and apisix helm chart (apache#282)

Co-authored-by: Ayush das <[email protected]>

fix: add truncate and source to newly added blog (apache#296)

* update traffic-split-in-ingress-controller.md

* Update website/blog/2021-03-27-traffic-split-in-apache-apisix-ingress-controller.md

Co-authored-by: John Bampton <[email protected]>

Co-authored-by: John Bampton <[email protected]>

fix: disable version switch button in sidebar, as website doesn't support it (apache#299)

fix: padding to arrow inside collapse sidebar button, and fit button to sidebar width (apache#300)

fix: darkMode enhanced (apache#297)

chore: release ingress controller 0.5.0 (apache#305)

* chore: release ingress controller 0.5.0

* feat: add event

fix: broken link in  release guide (apache#306)

docs: update the architecture diagram (apache#309)

chore: add alpha channel to showcase image for dark mode (apache#303)

Signed-off-by: yiyiyimu <[email protected]>

chore: Fix GitHub-icon sizes in team page  (apache#313)

docs: update logo wall (apache#315)

chore: upgrade APISIX Dashboard version to 2.6 (apache#317)

docs: update logo wall (apache#316)

docs: update download link (apache#320)

docs: update integration page (apache#327)

chore: Test Docusaurus webpack 5 support (apache#318)

feat: added last updated time (apache#331)

docs: fix broken links in Run Ingress on Amazon EKS blog (apache#333)

update docusaurus.config.json (apache#334)

feat: darkmode added to download-dropdown (apache#336)

Co-authored-by: 琚致远 <[email protected]>

chore(deps): bump actions/setup-python from 2 to 2.2.2 (apache#339)

Signed-off-by: dependabot[bot] <[email protected]>

chore(deps): bump actions/checkout from 2 to 2.3.4 (apache#337)

Signed-off-by: dependabot[bot] <[email protected]>

chore(deps): bump actions/setup-node from 2 to 2.1.5 (apache#338)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

release ingress 0.6.0 (apache#343)

docs: include  Helm charts and Docker to documents page (apache#342)

feat: added meta image (apache#345)

squashing: merge history commits on docs and landing page
  • Loading branch information
1502shivam-singh committed May 20, 2021
1 parent bf98283 commit f5491e4
Show file tree
Hide file tree
Showing 88 changed files with 3,565 additions and 3,261 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v2.3.4
- uses: actions/setup-node@v2.1.5
with:
node-version: "12"

Expand All @@ -38,7 +38,7 @@ jobs:
cp ../.asf.yaml ./build
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v3.8.0
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This is a basic workflow to help you get started with Actions

name: Check broken links

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
# Run everyday at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
- cron: "0 5 * * *"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
check:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: "12"

- name: Pull Docs
run: |
node sync-docs.js && git status
- name: Check Links
run: |
node link-checker.js && git status
- name: Archive Broken Links List
uses: actions/upload-artifact@v2
if: always()
with:
name: broken-links.json
path: brokenLinks.json
retention-days: 5
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
name: 🍇 Markdown
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2.3.4
- name: 🚀 Use Node.js
uses: actions/[email protected]
with:
Expand All @@ -18,8 +18,8 @@ jobs:
name: 🍏 YAML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v2.3.4
- uses: actions/setup-python@v2.2.2
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
Expand Down
17 changes: 17 additions & 0 deletions common.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const projects = ["apisix-ingress-controller", "apisix", "apisix-dashboard", "apisix-docker", "apisix-helm-chart"];
const languages = ["en", "zh", "es"];

module.exports = {
projects,
languages,
projectPaths: () => projects.map((project) => {
return {
project: project,
pluginId: `docs-${project}`,
paths: {
en: `./website/docs/${project}`,
zh: `./website/i18n/zh/docusaurus-plugin-content-docs-docs-${project}/current`,
},
};
})
}
180 changes: 180 additions & 0 deletions link-checker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
const fs = require("fs");
const path = require("path");
const childProcess = require("child_process");
const common = require("./common.js");

const scanFolder = (tarDir) => {
let filePaths = [];
let files = fs.readdirSync(tarDir);
files.forEach((file) => {
const tarPath = path.join(tarDir, file);
let stats = fs.statSync(tarPath);
if (stats.isDirectory()) {
filePaths.push(...scanFolder(tarPath));
} else {
filePaths.push(tarPath);
}
});

return filePaths;
}

const scanLinkInMDFile = (filePath, project) => {
const fileContent = fs.readFileSync(filePath, 'utf-8');
const regex = /\[[\s\S]*?\]\([\s\S]*?\)/g;
if (fileContent.match(regex)) {
const arrayOfLinks = fileContent.match(regex);
const links = arrayOfLinks.map((item) => {
const textHrefDivide = item.split('](');
const text = textHrefDivide[0].replace('[', '');
const url = textHrefDivide[1].replace(')', '');
return ({url, text, file: filePath});
});

// filter out links to other Markdown files
const filteredList = []; // local files
const unfilteredList = links.filter((link) => { // web links
let url = link.url.trim();
if (url.startsWith("http://") || url.startsWith("https://")) {
link.url = url;
return true;
}

// url preprocess
if (url.startsWith("#") || url.indexOf("#") > 0) { // such as "#abcd"
let split = url.split("#").filter(item => item !== "");
if (split.length > 1) {
link.anchor = "#" + split[1];
url = path.normalize(path.dirname(filePath) + path.sep + link.url);
} else {
link.anchor = link.url;
url = filePath;
}
} else if (url === "LICENSE" || url === 'logos/apache-apisix.png') {
url = "https://github.com/apache/" + project + "/blob/master/" + url;
} else if (!url.endsWith(".md")) { // not end with ".md"
console.log(filePath, link.url, filePath.startsWith("website\\docs"));
let lang = filePath.startsWith("website" + path.sep + "docs") ? "en" : filePath.split("i18n" + path.sep)[1].split(path.sep)[0];
let subPath = filePath.startsWith("website" + path.sep + "docs") ? path.dirname(filePath.split("docs" + path.sep + project + path.sep)[1]) : path.dirname(filePath.split("docs-" + project + path.sep + "current" + path.sep)[1]);
subPath = subPath !== "." ? subPath + path.sep : "";
let originPath = path.normalize("docs" + path.sep + lang + path.sep + "latest" + path.sep + subPath + url).replace(/\\/g, '/');

url = "https://github.com/apache/" + project + "/blob/master/" + originPath;
} else { // such as "./abcd", "../abcd", "../../../abcd"
url = path.normalize(path.dirname(filePath) + path.sep + url);
}

// set url
let originLink = link.url;
link.url = url;

// url postprocess
if (!url.startsWith("http://") && !url.startsWith("https://")) {
filteredList.push(link);
return false;
}

// replace the converted link with the original document
let documentContent = fs.readFileSync(filePath, 'utf8');
documentContent = documentContent.replace(new RegExp(originLink, "g"), link.url);
fs.writeFileSync(filePath, documentContent, 'utf8');

return true;
});
return {
links: unfilteredList,
filteredLinks: filteredList,
};
} else {
return {
links: [],
filteredLinks: [],
};
}
}

const linkValidate = (link) => {
return new Promise((resolve) => {
const axios = require("axios");
axios.get(link.url)
.then((res) => {
console.log(`[Link Checker] check "${link.url}", result is ${res.statusText}`)
resolve({
...link,
status: res.status,
statusText: res.statusText,
});
})
.catch((err) => {
console.log(`[Link Checker] check "${link.url}", result is FAIL`);
resolve({
...link,
status: 0,
statusText: 'FAIL',
});
});
});
}

(async function main() {
console.log("Start link-checker.js");
console.log("Install dependencies");
childProcess.execSync("npm i --save axios");

console.log("[Document Scanner] Scan all documents");
let allDocuments = [];
common.projectPaths().map((projectInfo) => {
Object.values(projectInfo.paths).forEach((path) => {
if (!fs.existsSync(path)) return;
allDocuments.push({
files: scanFolder(path),
path,
project: projectInfo.project,
})
});
});

console.log("[Link Scanner] Scan all links");
let externalLinks = []; // links to other sites
let internalLinks = []; // links to other Markdown files or anchor
for (const documents of allDocuments) {
documents.files.forEach((file) => {
const scanResult = scanLinkInMDFile(file, documents.project);
externalLinks.push(...scanResult.links);
internalLinks.push(...scanResult.filteredLinks);
});
}

//console.log(`[Link Scanner] External Links\n`, externalLinks.map(item => item.url).join("\n"));
//console.log(`[Link Scanner] Internal Links\n`, internalLinks.map(item => item.url).join("\n"));
console.log(`[Link Scanner] Scan result: ${externalLinks.length} external links, ${internalLinks.length} internal links`)

console.log(`[Link Checker] Start external link check`);
let externalBrokenList = [];
let externalLinkCheckPromises = [];
externalLinks.forEach((link) => {
externalLinkCheckPromises.push(linkValidate(link));
});

let result = await Promise.all(externalLinkCheckPromises);
externalBrokenList.push(...result.filter((item) => item.status !== 200));
console.log(`[Link Checker] External link check finished`);

console.log(`[Link Checker] Start internal link check`);
let internalBrokenList = [];
internalLinks.forEach((link) => {
let exist = true;
if (!fs.existsSync(link.url)) {
internalBrokenList.push(link);
exist = false;
}
console.log(`[Link Checker] check "${link.url}", result is ${exist}`)
});
console.log(`[Link Checker] Internal link check finished`);

console.log("[Finish] Write broken list to file");
fs.writeFileSync('./brokenLinks.json', JSON.stringify({
external: externalBrokenList,
internal: internalBrokenList,
}));
})();
Loading

0 comments on commit f5491e4

Please sign in to comment.