Skip to content

Commit

Permalink
Merge pull request #466 from Web3Auth/lint-checks
Browse files Browse the repository at this point in the history
Lint checks and Husky
  • Loading branch information
yashovardhan authored Sep 18, 2023
2 parents 877616e + 33f506a commit f283b5b
Show file tree
Hide file tree
Showing 13 changed files with 923 additions and 143 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/linkcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Check External links

on: push

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
file-extension: .mdx
check-modified-files-only: "yes"
4 changes: 4 additions & 0 deletions .husky/post-merge
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run install
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Website
# Web3Auth Documentation

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.

Expand Down
7 changes: 4 additions & 3 deletions docs/sdk/core-kit/tkey-android/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,12 @@ activity.appKey.deleteShare(shareIndex, result -> {});
## Using Modules for Further Operations

To perform advanced operations and manipulate keys, tKey offers modules that can be utilized. As previously stated in the
[initialization](./initialize) section, modules need to be configured beforehand to function properly with tKey. After configuration, the respective
module's instance is accessible within your tKey instance and can be utilized for additional operations.
[initialization](/docs/sdk/core-kit/tkey-android/initialize) section, modules need to be configured beforehand to function properly with tKey. After
configuration, the respective module's instance is accessible within your tKey instance and can be utilized for additional operations.

:::info Modules

Please visit the [**Modules**](./modules) section to view a comprehensive list of available modules and their respective functions.
Please visit the [**Modules**](/docs/sdk/core-kit/tkey-android/modules) section to view a comprehensive list of available modules and their respective
functions.

:::
202 changes: 91 additions & 111 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
const path = require("path");
require('dotenv').config()
require("dotenv").config();
const githubOrg = "web3auth";
const githubRepo = "web3auth-docs";
const githubOrgUrl = `https://github.com/${githubOrg}`;
const githubRepoUrl = `${githubOrgUrl}/${githubRepo}`;
const githubEditUrl = `${githubRepoUrl}/edit/master`;
const remarkMath = require("remark-math");
const rehypeKatex = require("rehype-katex");
const fs = require('fs');
const fs = require("fs");
const baseUrl = process.env.REACT_APP_BASE_URL || "/docs/";

const resourcesDropdown = fs.readFileSync('./src/components/navDropdown/resources.html', 'utf-8');
const helpDropdown = fs.readFileSync('./src/components/navDropdown/help.html', 'utf-8');
const sdkDropdown = fs.readFileSync('./src/components/navDropdown/sdk.html', 'utf-8');
const contentHubDropdown = fs.readFileSync('./src/components/navDropdown/content-hub.html', 'utf-8');
const resourcesDropdown = fs.readFileSync("./src/components/navDropdown/resources.html", "utf-8");
const helpDropdown = fs.readFileSync("./src/components/navDropdown/help.html", "utf-8");
const sdkDropdown = fs.readFileSync("./src/components/navDropdown/sdk.html", "utf-8");
const contentHubDropdown = fs.readFileSync("./src/components/navDropdown/content-hub.html", "utf-8");

/** @type {import('@docusaurus/types').DocusaurusConfig} */
const config = {
Expand All @@ -35,9 +35,8 @@ const config = {
},
},
announcementBar: {
id: 'sign_up_for_wallets_ux_unconference',
content:
'<a href="https://lu.ma/l8at7q5b" target="_blank">Secure your spot for Wallets & UX Unconference at token 2049! Sign up now →</a>',
id: "sign_up_for_wallets_ux_unconference",
content: '<a href="https://lu.ma/l8at7q5b" target="_blank">Secure your spot for Wallets & UX Unconference at token 2049! Sign up now →</a>',
isCloseable: true,
},
colorMode: {
Expand All @@ -58,24 +57,24 @@ const config = {
},
items: [
{
label: 'SDKs',
type: 'dropdown',
label: "SDKs",
type: "dropdown",
to: "/sdk",
position: "left",
items: [
{
type: 'html',
type: "html",
value: sdkDropdown,
},
],
},
{
label: 'Resources',
type: 'dropdown',
label: "Resources",
type: "dropdown",
position: "left",
items: [
{
type: 'html',
type: "html",
value: resourcesDropdown,
},
],
Expand All @@ -86,24 +85,24 @@ const config = {
position: "left",
},
{
label: 'Content Hub',
type: 'dropdown',
label: "Content Hub",
type: "dropdown",
to: "/content-hub",
position: "left",
items: [
{
type: 'html',
type: "html",
value: contentHubDropdown,
},
],
},
{
label: 'Help',
type: 'dropdown',
label: "Help",
type: "dropdown",
position: "left",
items: [
{
type: 'html',
type: "html",
value: helpDropdown,
},
],
Expand Down Expand Up @@ -139,14 +138,15 @@ const config = {
},
customFields: {
baseUrl,
}
},
},
scripts: [
{
src: baseUrl + 'js/fix-trailing-slash.js',
src: baseUrl + "js/fix-trailing-slash.js",
async: false,
defer: false,
},],
},
],
presets: [
[
"@docusaurus/preset-classic",
Expand All @@ -166,23 +166,18 @@ const config = {
trackingID: "GTM-ML3T5M6",
},
pages: {
path: 'src/pages',
path: "src/pages",
routeBasePath: "/",
include: ['**/**.{js,jsx,ts,tsx,md,mdx}'],
exclude: [
'**/_*.{js,jsx,ts,tsx,md,mdx}',
'**/_*/**',
'**/*.test.{js,jsx,ts,tsx}',
'**/__tests__/**',
],
mdxPageComponent: '@theme/MDXPage',
include: ["**/**.{js,jsx,ts,tsx,md,mdx}"],
exclude: ["**/_*.{js,jsx,ts,tsx,md,mdx}", "**/_*/**", "**/*.test.{js,jsx,ts,tsx}", "**/__tests__/**"],
mdxPageComponent: "@theme/MDXPage",
remarkPlugins: [remarkMath, [require("@docusaurus/remark-plugin-npm2yarn"), { sync: true }]],
rehypePlugins: [[rehypeKatex, { strict: false }]],
beforeDefaultRemarkPlugins: [],
beforeDefaultRehypePlugins: [],
},
sitemap: {
changefreq: 'weekly',
changefreq: "weekly",
priority: 0.8,
},
},
Expand All @@ -192,15 +187,18 @@ const config = {
path.resolve(__dirname, "plugins", "docusaurus-plugin-content-hub"),
[path.resolve(__dirname, "plugins", "docusaurus-plugin-virtual-files"), { rootDir: "files" }],
path.resolve(__dirname, "plugins", "node-polyfills"),
[path.resolve(__dirname, "plugins", "plugin-dynamic-route"), {
routes: [
{
path: `${baseUrl}content-hub/blog/`,
exact: false,
component: '@site/src/components/BlogLayout/index',
},
],
}],
[
path.resolve(__dirname, "plugins", "plugin-dynamic-route"),
{
routes: [
{
path: `${baseUrl}content-hub/blog/`,
exact: false,
component: "@site/src/components/BlogLayout/index",
},
],
},
],
[
"@docusaurus/plugin-client-redirects",
{
Expand Down Expand Up @@ -419,84 +417,67 @@ const config = {
},
],
createRedirects(existingPath) {
if (existingPath.includes('/content-hub')) {
if (existingPath.includes("/content-hub")) {
return [
existingPath.replace('/content-hub/guides', '/guides'),
existingPath.replace('/content-hub/guides', '/guide'),
existingPath.replace('/content-hub/blog', '/blogs'),
existingPath.replace('/content-hub/blog', '/blog'),
existingPath.replace('/content-hub/guides/auth0', '/customauth/auth0'),
existingPath.replace('/content-hub/guides/tkey', '/guides/selfhost'),
existingPath.replace('/content-hub/guides/single-factor-auth', '/guides/one-key-flow'),
existingPath.replace("/content-hub/guides", "/guides"),
existingPath.replace("/content-hub/guides", "/guide"),
existingPath.replace("/content-hub/blog", "/blogs"),
existingPath.replace("/content-hub/blog", "/blog"),
existingPath.replace("/content-hub/guides/auth0", "/customauth/auth0"),
existingPath.replace("/content-hub/guides/tkey", "/guides/selfhost"),
existingPath.replace("/content-hub/guides/single-factor-auth", "/guides/one-key-flow"),
];
}
if (existingPath.includes('/sdk')) {
return [
existingPath.replace('/sdk', '/api-reference'),
existingPath.replace('/sdk', '/sdk-reference'),
];
if (existingPath.includes("/sdk")) {
return [existingPath.replace("/sdk", "/api-reference"), existingPath.replace("/sdk", "/sdk-reference")];
}
if (existingPath.includes('/sdk')) {
if (existingPath.includes("/sdk")) {
return [
existingPath.replace('/migration-guide/', '/migration-guides/no-modal-v5-to-v6'),
existingPath.replace('/migration-guide/migrating-to-v6-from-v5', '/migration-guides/no-modal-v5-to-v6'),
existingPath.replace("/migration-guide/", "/migration-guides/no-modal-v5-to-v6"),
existingPath.replace("/migration-guide/migrating-to-v6-from-v5", "/migration-guides/no-modal-v5-to-v6"),
];
}
if (existingPath.includes('/auth-provider-setup')) {
return [
existingPath.replace('/auth-provider-setup', '/custom-authentication'),
];
if (existingPath.includes("/auth-provider-setup")) {
return [existingPath.replace("/auth-provider-setup", "/custom-authentication")];
}
if (existingPath.includes('/sdk/web/no-modal')) {
return [
existingPath.replace('/sdk/web/no-modal', '/sdk/web/core'),
existingPath.replace('/sdk/web/no-modal', '/sdk/web/customloginui'),
];
if (existingPath.includes("/sdk/web/no-modal")) {
return [existingPath.replace("/sdk/web/no-modal", "/sdk/web/core"), existingPath.replace("/sdk/web/no-modal", "/sdk/web/customloginui")];
}
if (existingPath.includes('/sdk/web/modal')) {
return [
existingPath.replace('/sdk/web/modal', '/sdk/web/web3auth'),
existingPath.replace('/sdk/web/modal', '/sdk/web/plugnplay'),
];
if (existingPath.includes("/sdk/web/modal")) {
return [existingPath.replace("/sdk/web/modal", "/sdk/web/web3auth"), existingPath.replace("/sdk/web/modal", "/sdk/web/plugnplay")];
}
if (existingPath.includes('/sdk/tkey')) {
return [
existingPath.replace('/sdk/tkey', '/sdk/self-host'),
];
if (existingPath.includes("/sdk/tkey")) {
return [existingPath.replace("/sdk/tkey", "/sdk/self-host")];
}
if (existingPath.includes('/helper-sdks/providers')) {
return [
existingPath.replace('/helper-sdks/providers', '/web/providers'),
];
if (existingPath.includes("/helper-sdks/providers")) {
return [existingPath.replace("/helper-sdks/providers", "/web/providers")];
}
if (existingPath.includes('/helper-sdks/plugins')) {
return [
existingPath.replace('/helper-sdks/plugins', '/web/plugins'),
];
if (existingPath.includes("/helper-sdks/plugins")) {
return [existingPath.replace("/helper-sdks/plugins", "/web/plugins")];
}
if (existingPath.includes('/pnp')) {
if (existingPath.includes("/pnp")) {
return [
existingPath.replace('/pnp/web', '/web'),
existingPath.replace('/pnp/android', '/android'),
existingPath.replace('/pnp/ios', '/ios'),
existingPath.replace('/pnp/react-native', '/react-native'),
existingPath.replace('/pnp/flutter', '/flutter'),
existingPath.replace('/pnp/unity', '/unity'),
existingPath.replace('/pnp/unreal', '/unreal'),
existingPath.replace("/pnp/web", "/web"),
existingPath.replace("/pnp/android", "/android"),
existingPath.replace("/pnp/ios", "/ios"),
existingPath.replace("/pnp/react-native", "/react-native"),
existingPath.replace("/pnp/flutter", "/flutter"),
existingPath.replace("/pnp/unity", "/unity"),
existingPath.replace("/pnp/unreal", "/unreal"),
];
}
if (existingPath.includes('/core-kit')) {
if (existingPath.includes("/core-kit")) {
return [
existingPath.replace('/core-kit/sfa-node', '/node'),
existingPath.replace('/core-kit/sfa-node', '/core-kit/node'),
existingPath.replace('/core-kit/sfa-web', '/single-factor-auth'),
existingPath.replace('/core-kit/sfa-web', '/core-kit/single-factor-auth'),
existingPath.replace('/core-kit/sfa-android', '/single-factor-auth-android'),
existingPath.replace('/core-kit/sfa-android', '/core-kit/single-factor-auth-android'),
existingPath.replace('/core-kit/tkey', '/tkey'),
existingPath.replace('/core-kit/mpc-core-kit', '/mpc-core-kit'),
existingPath.replace('/core-kit/introduction', '/self-host/'),
existingPath.replace('/core-kit/introduction', '/self-hosting'),
existingPath.replace("/core-kit/sfa-node", "/node"),
existingPath.replace("/core-kit/sfa-node", "/core-kit/node"),
existingPath.replace("/core-kit/sfa-web", "/single-factor-auth"),
existingPath.replace("/core-kit/sfa-web", "/core-kit/single-factor-auth"),
existingPath.replace("/core-kit/sfa-android", "/single-factor-auth-android"),
existingPath.replace("/core-kit/sfa-android", "/core-kit/single-factor-auth-android"),
existingPath.replace("/core-kit/tkey", "/tkey"),
existingPath.replace("/core-kit/mpc-core-kit", "/mpc-core-kit"),
existingPath.replace("/core-kit/introduction", "/self-host/"),
existingPath.replace("/core-kit/introduction", "/self-hosting"),
];
}
return undefined; // Return a falsy value: no redirect created
Expand All @@ -506,17 +487,16 @@ const config = {
],
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
type: 'text/css',
integrity:
'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
crossorigin: 'anonymous',
href: "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css",
type: "text/css",
integrity: "sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM",
crossorigin: "anonymous",
},
],
customFields: {
// 'REACT_HYGRAPHCMS_ENDPOINT': process.env.REACT_HYGRAPHCMS_ENDPOINT,
'REACT_CONTENTFUL_SPACE': process.env.REACT_CONTENTFUL_SPACE,
'REACT_CONTENTFUL_TOKEN': process.env.REACT_CONTENTFUL_TOKEN,
REACT_CONTENTFUL_SPACE: process.env.REACT_CONTENTFUL_SPACE,
REACT_CONTENTFUL_TOKEN: process.env.REACT_CONTENTFUL_TOKEN,
},
};

Expand Down
Loading

1 comment on commit f283b5b

@vercel
Copy link

@vercel vercel bot commented on f283b5b Sep 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web3auth-docs – ./

web3auth-docs-web3auth.vercel.app
web3auth-docs-git-master-web3auth.vercel.app
w3a-docs.vercel.app

Please sign in to comment.