├── README.md
├── .prettierignore
├── .husky
└── pre-commit
├── .gitignore
├── .npmrc
├── website
├── tailwind.config.cjs
├── postcss.config.js
├── src
│ ├── pages
│ │ ├── docs
│ │ │ ├── import.mdx
│ │ │ ├── meta.json
│ │ │ ├── mermaid.mdx
│ │ │ ├── remote.mdx
│ │ │ └── index.mdx
│ │ ├── 404.mdx
│ │ ├── 500.mdx
│ │ ├── meta.json
│ │ ├── _app.tsx
│ │ └── index.mdx
│ └── reused.mdx
├── public
│ └── assets
│ │ ├── subheader-logo.png
│ │ └── subheader-logo.svg
├── next.config.mjs
├── next-env.d.ts
├── tsconfig.json
├── package.json
└── theme.config.tsx
├── packages
├── docs
│ ├── src
│ │ ├── index.ts
│ │ ├── env.d.ts
│ │ ├── types.ts
│ │ ├── style.css
│ │ ├── mermaid.tsx
│ │ ├── utils.ts
│ │ ├── next.config.ts
│ │ ├── underscore-redirects.ts
│ │ ├── giscus.tsx
│ │ ├── google-analytics.tsx
│ │ ├── remark-mermaid.ts
│ │ ├── next-nprogress.tsx
│ │ └── npm.ts
│ ├── package.json
│ └── CHANGELOG.md
└── algolia
│ ├── src
│ ├── types.ts
│ └── index.ts
│ ├── CHANGELOG.md
│ └── package.json
├── prettier.config.cjs
├── .vscode
└── settings.json
├── renovate.json
├── .github
└── workflows
│ ├── release.yaml
│ ├── pr.yaml
│ ├── test.yaml
│ └── nextjs_bundle_analysis.yml
├── scripts
└── copy-files.mjs
├── .changeset
├── README.md
└── config.json
├── tsconfig.json
├── package.json
└── .eslintrc.cjs
/README.md:
--------------------------------------------------------------------------------
1 | # guild-docs
2 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | .husky/_/
2 | dist/
3 | .next/
4 | .bob/
5 |
--------------------------------------------------------------------------------
/.husky/pre-commit:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | . "$(dirname "$0")/_/husky.sh"
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | *.log
3 | .next/
4 | dist
5 | .env
6 | .idea/
7 | .bob/
8 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | workspace-concurrency=Infinity
2 | stream=true
3 | node-linker=hoisted
4 |
--------------------------------------------------------------------------------
/website/tailwind.config.cjs:
--------------------------------------------------------------------------------
1 | module.exports = require('@theguild/tailwind-config');
2 |
--------------------------------------------------------------------------------
/packages/docs/src/index.ts:
--------------------------------------------------------------------------------
1 | export * from './google-analytics.js';
2 | export * from './utils.js';
3 |
--------------------------------------------------------------------------------
/website/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = require('@theguild/tailwind-config/postcss.config');
2 |
--------------------------------------------------------------------------------
/prettier.config.cjs:
--------------------------------------------------------------------------------
1 | /* eslint-env node */
2 | module.exports = require('@theguild/prettier-config');
3 |
--------------------------------------------------------------------------------
/website/src/pages/docs/import.mdx:
--------------------------------------------------------------------------------
1 | import ReusedContent from '../../reused.mdx'
2 |
3 | # Import Support
4 |
5 |
6 |
--------------------------------------------------------------------------------
/website/public/assets/subheader-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/the-guild-org/the-guild-docs/HEAD/website/public/assets/subheader-logo.png
--------------------------------------------------------------------------------
/website/src/pages/404.mdx:
--------------------------------------------------------------------------------
1 | import { NotFoundPage } from '@theguild/components'
2 |
3 | # 404 - This page could not be found
4 |
5 |
6 |
--------------------------------------------------------------------------------
/website/src/pages/docs/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "index": "Installation",
3 | "import": "Import",
4 | "mermaid": "Mermaid",
5 | "remote": "Remote MDX"
6 | }
7 |
--------------------------------------------------------------------------------
/website/src/pages/500.mdx:
--------------------------------------------------------------------------------
1 | import { ServerSideErrorPage } from '@theguild/components'
2 |
3 | # 500 - Internal Server Error
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "typescript.tsdk": "node_modules/typescript/lib",
3 | "editor.formatOnSave": true,
4 | "editor.defaultFormatter": "esbenp.prettier-vscode"
5 | }
6 |
--------------------------------------------------------------------------------
/website/next.config.mjs:
--------------------------------------------------------------------------------
1 | import { withGuildDocs } from 'guild-docs/next.config';
2 |
3 | export default withGuildDocs({
4 | eslint: {
5 | ignoreDuringBuilds: true,
6 | },
7 | });
8 |
--------------------------------------------------------------------------------
/packages/docs/src/env.d.ts:
--------------------------------------------------------------------------------
1 | declare module '@next/bundle-analyzer' {
2 | import type { NextConfig } from 'next';
3 | export default function nextBundleAnalyzer(config: { enabled: boolean }): (nextConfig: NextConfig) => NextConfig;
4 | }
5 |
--------------------------------------------------------------------------------
/website/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
4 | // NOTE: This file should not be edited
5 | // see https://nextjs.org/docs/basic-features/typescript for more information.
6 |
--------------------------------------------------------------------------------
/packages/docs/src/types.ts:
--------------------------------------------------------------------------------
1 | import type { DefaultSeoProps, OpenGraphMedia } from 'next-seo/lib/types';
2 |
3 | export interface AppSeoProps extends DefaultSeoProps {
4 | title: string;
5 | description: string;
6 | logo: OpenGraphMedia;
7 | }
8 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "extends": ["github>the-guild-org/shared-config:renovate"],
4 | "rangeStrategy": "bump",
5 | "ignoreDeps": ["mermaid", "mdx-mermaid"],
6 | "ignorePaths": ["**/node_modules/**"]
7 | }
8 |
--------------------------------------------------------------------------------
/website/src/reused.mdx:
--------------------------------------------------------------------------------
1 | Some reused content
2 |
3 | ```ts
4 | console.log('Hello world')
5 | ```
6 |
7 | ## Reused table
8 |
9 | | Beep | No. | Boop |
10 | | :--- | :----: | -----: |
11 | | beep | 1024 | xyz |
12 | | boop | 338845 | tuv |
13 | | foo | 10106 | qrstuv |
14 | | bar | 45 | lmno |
15 |
--------------------------------------------------------------------------------
/packages/docs/src/style.css:
--------------------------------------------------------------------------------
1 | @import 'nextra-theme-docs/style.css';
2 | @import 'tailwindcss/components';
3 | @import 'tailwindcss/utilities';
4 | @import '@algolia/autocomplete-theme-classic';
5 | @import '@theguild/components/dist/search-bar-v2.css';
6 |
7 | /* quick fix for menu on mobile */
8 | div[class='hidden md:inline-block min-w-[200px]'] {
9 | position: absolute;
10 | }
11 |
--------------------------------------------------------------------------------
/.github/workflows/release.yaml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - 'examples/**'
7 | - '.vscode/**'
8 | - '.husky/**'
9 | branches:
10 | - main
11 |
12 | jobs:
13 | stable:
14 | uses: the-guild-org/shared-config/.github/workflows/release-stable.yml@main
15 | with:
16 | releaseScript: release
17 | nodeVersion: 18
18 | secrets:
19 | githubToken: ${{ secrets.GITHUB_TOKEN }}
20 | npmToken: ${{ secrets.NPM_TOKEN }}
21 |
--------------------------------------------------------------------------------
/scripts/copy-files.mjs:
--------------------------------------------------------------------------------
1 | import path from 'node:path';
2 | import fs from 'node:fs/promises';
3 |
4 | const CWD = process.cwd();
5 |
6 | const promises = [path.join(CWD, 'packages/docs/src/style.css')].map(async filePath => {
7 | const content = await fs.readFile(filePath);
8 | const newFilePath = filePath.replace('/src/', '/dist/');
9 |
10 | await fs.writeFile(newFilePath, content);
11 | console.log('✅', path.relative(CWD, newFilePath), 'copied!');
12 | });
13 |
14 | await Promise.all(promises);
15 |
--------------------------------------------------------------------------------
/.changeset/README.md:
--------------------------------------------------------------------------------
1 | # Changesets
2 |
3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4 | with multi-package repos, or single-package repos to help you version and publish your code. You can
5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6 |
7 | We have a quick list of common questions to get you started engaging with this project in
8 | [our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)
9 |
--------------------------------------------------------------------------------
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@2.1.0/schema.json",
3 | "changelog": ["@changesets/changelog-github", { "repo": "the-guild-org/the-guild-docs" }],
4 | "commit": false,
5 | "access": "public",
6 | "baseBranch": "main",
7 | "updateInternalDependencies": "patch",
8 | "ignore": ["website"],
9 | "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
10 | "onlyUpdatePeerDependentsWhenOutOfRange": true
11 | },
12 | "snapshot": {
13 | "useCalculatedVersion": true,
14 | "prereleaseTemplate": "{tag}-{datetime}-{commit}"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.github/workflows/pr.yaml:
--------------------------------------------------------------------------------
1 | name: PR
2 |
3 | on:
4 | pull_request:
5 | branches:
6 | - main
7 |
8 | jobs:
9 | dependencies:
10 | uses: the-guild-org/shared-config/.github/workflows/changesets-dependencies.yaml@main
11 | secrets:
12 | githubToken: ${{ secrets.GITHUB_TOKEN }}
13 |
14 | canary:
15 | uses: the-guild-org/shared-config/.github/workflows/release-snapshot.yml@main
16 | with:
17 | npmTag: alpha
18 | buildScript: build
19 | nodeVersion: 18
20 | secrets:
21 | githubToken: ${{ secrets.GITHUB_TOKEN }}
22 | npmToken: ${{ secrets.NPM_TOKEN }}
23 |
--------------------------------------------------------------------------------
/website/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es2019",
4 | "module": "commonjs",
5 | "strict": true,
6 | "esModuleInterop": true,
7 | "skipLibCheck": true,
8 | "forceConsistentCasingInFileNames": true,
9 | "lib": ["dom", "dom.iterable", "esnext"],
10 | "allowJs": true,
11 | "noEmit": true,
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "incremental": true
17 | },
18 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
19 | "exclude": ["node_modules"]
20 | }
21 |
--------------------------------------------------------------------------------
/website/src/pages/meta.json:
--------------------------------------------------------------------------------
1 | {
2 | "index": {
3 | "title": "Home",
4 | "type": "page",
5 | "theme": {
6 | "layout": "raw"
7 | }
8 | },
9 | "docs": {
10 | "title": "Docs",
11 | "type": "page",
12 | "theme": {
13 | "toc": true
14 | }
15 | },
16 | "contact-us-link": {
17 | "title": "Contact Us",
18 | "type": "page",
19 | "href": "https://the-guild.dev/contact",
20 | "newWindow": true
21 | },
22 | "404": {
23 | "type": "page",
24 | "theme": {
25 | "layout": "full"
26 | }
27 | },
28 | "500": {
29 | "type": "page",
30 | "theme": {
31 | "layout": "full"
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/website/src/pages/docs/mermaid.mdx:
--------------------------------------------------------------------------------
1 | # Mermaid Support
2 |
3 | ```mermaid
4 | graph TD;
5 | subgraph AA [Consumers]
6 | A[Mobile app];
7 | B[Web app];
8 | C[Node.js client];
9 | end
10 | subgraph BB [Services]
11 | E[REST API];
12 | F[GraphQL API];
13 | G[SOAP API];
14 | end
15 | Z[GraphQL API];
16 | A --> Z;
17 | B --> Z;
18 | C --> Z;
19 | Z --> E;
20 | Z --> F;
21 | Z --> G;
22 | ```
23 |
24 | ### How to use
25 |
26 | ````mdx filename="my-page.mdx"
27 | ```mermaid
28 | graph TD;
29 | subgraph AA [Consumers]
30 | A[Mobile app];
31 | B[Web app];
32 | C[Node.js client];
33 | end
34 | subgraph BB [Services]
35 | E[REST API];
36 | F[GraphQL API];
37 | G[SOAP API];
38 | end
39 | Z[GraphQL API];
40 | A --> Z;
41 | B --> Z;
42 | C --> Z;
43 | Z --> E;
44 | Z --> F;
45 | Z --> G;
46 | ```
47 | ````
48 |
--------------------------------------------------------------------------------
/website/src/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | import type { ReactElement } from 'react';
2 | import type { AppProps } from 'next/app';
3 | import { Header, Footer, ThemeProvider } from '@theguild/components';
4 | import 'guild-docs/style.css';
5 |
6 | export default function App({ Component, pageProps }: AppProps): ReactElement {
7 | return (
8 |
9 |
10 |
11 |
12 |
13 | );
14 | }
15 |
16 | // const defaultSeo: AppSeoProps = {
17 | // title: 'Guild Docs',
18 | // description: 'Guild Docs Example',
19 | // logo: {
20 | // url: 'https://the-guild-docs.vercel.app/assets/subheader-logo.png',
21 | // width: 50,
22 | // height: 54,
23 | // },
24 | // };
25 |
--------------------------------------------------------------------------------
/website/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "website",
3 | "version": "0.0.0",
4 | "private": true,
5 | "license": "MIT",
6 | "bob": false,
7 | "scripts": {
8 | "analyze": "cross-env ANALYZE=true next build",
9 | "build": "next build",
10 | "dev": "next dev",
11 | "next": "next",
12 | "start": "next start"
13 | },
14 | "dependencies": {
15 | "@theguild/components": "3.0.0",
16 | "guild-docs": "4.1.0",
17 | "markdown-to-jsx": "7.1.7",
18 | "next": "12.2.5",
19 | "react": "18.2.0",
20 | "react-dom": "18.2.0"
21 | },
22 | "devDependencies": {
23 | "@theguild/tailwind-config": "0.0.2",
24 | "@types/react": "18.0.17",
25 | "cross-env": "7.0.3",
26 | "typescript": "4.7.4"
27 | },
28 | "nextBundleAnalysis": {
29 | "budget": null,
30 | "budgetPercentIncreaseRed": 20,
31 | "showDetails": true
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/packages/docs/src/mermaid.tsx:
--------------------------------------------------------------------------------
1 | import React, { ReactElement, useEffect, useState } from 'react';
2 | import mermaid from 'mermaid';
3 | import type mermaidAPI from 'mermaid/mermaidAPI';
4 | import { useTheme } from '@theguild/components';
5 |
6 | /**
7 | * Assign a unique ID to each mermaid svg as per requirements of `mermaid.render`.
8 | */
9 | let id = 0;
10 |
11 | export const Mermaid = ({ chart }: { chart: string }): ReactElement => {
12 | const { theme } = useTheme();
13 | const [svg, setSVG] = useState('');
14 |
15 | useEffect(() => {
16 | mermaid.initialize({ startOnLoad: true, theme: theme as mermaidAPI.Theme });
17 | mermaid.render(`mermaid-svg-${id}`, chart, renderedSvg => {
18 | setSVG(renderedSvg);
19 | });
20 | id++;
21 | }, [theme, chart]);
22 |
23 | return
;
24 | };
25 |
--------------------------------------------------------------------------------
/.github/workflows/test.yaml:
--------------------------------------------------------------------------------
1 | name: Install
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | install:
7 | name: Install
8 | runs-on: ubuntu-latest
9 | steps:
10 | - name: Checkout Repo
11 | uses: actions/checkout@v3
12 | with:
13 | fetch-depth: 0
14 |
15 | - name: Setup Node.js 16
16 | uses: actions/setup-node@v3
17 | with:
18 | node-version: 16
19 |
20 | - name: Cache Yarn
21 | uses: actions/cache@v3
22 | with:
23 | path: '**/node_modules'
24 | key: ${{runner.os}}-16-${{hashFiles('yarn.lock')}}
25 | restore-keys: |
26 | ${{runner.os}}-16-
27 |
28 | - name: Install Dependencies
29 | run: yarn
30 |
31 | - name: Build
32 | run: yarn build
33 |
34 | - name: Test ESM & CJS integrity
35 | run: yarn bob check
36 |
37 | - name: Lint
38 | run: yarn lint
39 |
--------------------------------------------------------------------------------
/packages/docs/src/utils.ts:
--------------------------------------------------------------------------------
1 | import type { MouseEvent } from 'react';
2 | import RouterImport from 'next/router.js';
3 |
4 | export function withoutTrailingSlash(v: string) {
5 | if (v === '/') return v;
6 | if (v.endsWith('/')) return v.slice(0, v.length - 1);
7 | return v;
8 | }
9 |
10 | export function withStartingSlash(v: string) {
11 | if (v.startsWith('/')) return v;
12 | return '/' + v;
13 | }
14 |
15 | export function withoutStartingSlash(v: string) {
16 | if (v === '/') return v;
17 | if (v.startsWith('/')) return v.slice(1, v.length);
18 | return v;
19 | }
20 |
21 | export function getDefault(module: T & { default?: T }): T {
22 | return module.default || module;
23 | }
24 |
25 | const Router = getDefault(RouterImport);
26 |
27 | export const handlePushRoute = (path: string, e: Pick): void => {
28 | e.preventDefault();
29 | if (path) {
30 | Router.push(path);
31 | }
32 | };
33 |
--------------------------------------------------------------------------------
/packages/algolia/src/types.ts:
--------------------------------------------------------------------------------
1 | export type AlgoliaRecordSource =
2 | | 'Hive'
3 | | 'Yoga'
4 | | 'Envelop'
5 | | 'Inspector'
6 | | 'Code Generator'
7 | | 'Mesh'
8 | | 'Tools'
9 | | 'Modules'
10 | | 'ESLint'
11 | | 'Config'
12 | | 'Scalars'
13 | | 'Helix'
14 | | 'Shield'
15 | | 'Swift'
16 | | 'CLI'
17 | | 'SOFA'
18 | | 'Stencil'
19 | | 'Angular'
20 | | 'WhatsApp'
21 | | 'KitQL';
22 |
23 | export interface AlgoliaRecord {
24 | objectID: string;
25 | hierarchy: string[];
26 | headings: string[];
27 | toc: AlgoliaSearchItemTOC[];
28 | title: string;
29 | content: string;
30 | source: string;
31 | type: string;
32 | url: string;
33 | domain: string;
34 | }
35 |
36 | export interface AlgoliaSearchItemTOC {
37 | children: AlgoliaSearchItemTOC[];
38 | title: string;
39 | anchor: string;
40 | }
41 |
42 | export type IRoutes = {
43 | $routes?: ([href: string, name: string, sidebar?: string] | string)[];
44 | $name?: string;
45 | $sidebar?: string;
46 | _?: Record;
47 | };
48 |
--------------------------------------------------------------------------------
/packages/docs/src/next.config.ts:
--------------------------------------------------------------------------------
1 | import type { NextConfig } from 'next';
2 | import nextBundleAnalyzer from '@next/bundle-analyzer';
3 | import nextra from 'nextra';
4 | import { remarkMermaid } from './remark-mermaid.js';
5 |
6 | export const withGuildDocs = ({
7 | themeConfig = './theme.config.tsx',
8 | ...nextConfig
9 | }: NextConfig & { themeConfig: string }) => {
10 | const withBundleAnalyzer = nextBundleAnalyzer({
11 | enabled: process.env.ANALYZE === 'true',
12 | });
13 | const withNextra = nextra({
14 | themeConfig,
15 | theme: '@theguild/components',
16 | unstable_staticImage: true,
17 | mdxOptions: {
18 | remarkPlugins: [remarkMermaid],
19 | },
20 | });
21 |
22 | return withBundleAnalyzer(
23 | withNextra({
24 | reactStrictMode: true,
25 | swcMinify: true,
26 | ...nextConfig,
27 | experimental: {
28 | newNextLinkBehavior: true,
29 | images: {
30 | allowFutureImage: true, // next/future/image
31 | ...nextConfig.experimental?.images,
32 | },
33 | ...nextConfig.experimental,
34 | },
35 | })
36 | );
37 | };
38 |
--------------------------------------------------------------------------------
/website/src/pages/docs/remote.mdx:
--------------------------------------------------------------------------------
1 | import { useSSG } from 'nextra/data'
2 | import Markdown from 'markdown-to-jsx'
3 | import { getPackagesData } from 'guild-docs/npm'
4 | import { PackageCmd } from '@theguild/components'
5 |
6 | export const getStaticProps = async () => {
7 | const packagesData = await getPackagesData({
8 | packageList: [
9 | {
10 | identifier: 'envelop',
11 | npmPackage: '@envelop/core',
12 | tags: [],
13 | title: 'Envelop'
14 | }
15 | ]
16 | })
17 | return {
18 | props: {
19 | // We add an `ssg` field to the page props,
20 | // which will be provided to the Nextra's `useSSG` hook.
21 | ssg: packagesData[0]
22 | },
23 | // Revalidate at most once every 1 hour
24 | revalidate: 60 * 60
25 | }
26 | }
27 |
28 | export const PackageApiDocs = () => {
29 | // Get the data from SSG, and render it as a component.
30 | const packageData = useSSG()
31 | return (
32 | <>
33 |
34 | {packageData.readme}
35 | >
36 | )
37 | }
38 |
39 | # Remote MDX Support
40 |
41 |
42 |
--------------------------------------------------------------------------------
/website/src/pages/index.mdx:
--------------------------------------------------------------------------------
1 | ---
2 | title: Home
3 | ---
4 |
5 | import { HeroGradient, InfoList, NPMBadge } from '@theguild/components'
6 | import { handlePushRoute } from 'guild-docs'
7 |
8 | handlePushRoute('/docs', e)
16 | }}
17 | version={}
18 | colors={['#000', '#1cc8ee']}
19 | />
20 |
21 |
38 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "rootDir": "packages",
4 | "baseUrl": ".",
5 | "outDir": "dist",
6 | "paths": {
7 | "@guild-docs/algolia": ["packages/algolia/src/index.ts"],
8 | "guild-docs": ["packages/docs/src/index.ts"]
9 | },
10 | "declaration": true,
11 | "target": "es2019" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
12 | "module": "esnext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
13 | "strict": true /* Enable all strict type-checking options. */,
14 | "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
15 | "skipLibCheck": true /* Skip type checking of declaration files. */,
16 | "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
17 | "lib": ["dom", "dom.iterable", "esnext"],
18 | "allowJs": true,
19 | "moduleResolution": "node",
20 | "resolveJsonModule": true,
21 | "isolatedModules": true,
22 | "jsx": "react",
23 | "incremental": true,
24 | "noUnusedLocals": true,
25 | "importsNotUsedAsValues": "error"
26 | },
27 | "include": ["**/*.ts", "**/*.tsx"],
28 | "exclude": ["node_modules", "website"]
29 | }
30 |
--------------------------------------------------------------------------------
/packages/docs/src/underscore-redirects.ts:
--------------------------------------------------------------------------------
1 | import { writeFile } from 'fs/promises';
2 | import { join } from 'path';
3 |
4 | class RunPromiseWebpackPlugin {
5 | asyncHook;
6 |
7 | constructor(asyncHook: () => Promise) {
8 | this.asyncHook = asyncHook;
9 | }
10 |
11 | apply(compiler: any) {
12 | compiler.hooks.beforeCompile.tapPromise('RunPromiseWebpackPlugin', this.asyncHook);
13 | }
14 | }
15 |
16 | export function applyUnderscoreRedirects(config: any, meta: any) {
17 | config.plugins.push(
18 | new RunPromiseWebpackPlugin(async () => {
19 | const outDir = meta.dir;
20 | const outFile = join(outDir, './public/_redirects');
21 |
22 | try {
23 | const redirects: any[] = meta.config.redirects
24 | ? Array.isArray(typeof meta.config.redirects)
25 | ? typeof meta.config.redirects
26 | : await meta.config.redirects()
27 | : [];
28 |
29 | if (redirects.length > 0) {
30 | const redirectsTxt = redirects
31 | .map(r => `${r.source} ${r.destination} ${r.permanent ? '301' : '302'}`)
32 | .join('\n');
33 | await writeFile(outFile, redirectsTxt);
34 | } else {
35 | console.warn(`No redirects defined, no "_redirect" file is created!`);
36 | }
37 | } catch (e) {
38 | console.error('Error while generating redirects file: ', e);
39 | throw new Error(`Failed to generate "_redirects" file during build: ${(e as Error).message}`);
40 | }
41 | })
42 | );
43 | }
44 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "homepage": "https://github.com/the-guild-org/the-guild-docs#readme",
4 | "bugs": {
5 | "url": "https://github.com/the-guild-org/the-guild-docs/issues"
6 | },
7 | "repository": {
8 | "type": "git",
9 | "url": "git+https://github.com/the-guild-org/the-guild-docs.git"
10 | },
11 | "license": "MIT",
12 | "scripts": {
13 | "prerelease": "yarn build",
14 | "release": "changeset publish",
15 | "clean": "rimraf \"{,!(node_modules)/*/}node_modules/\"",
16 | "prebuild": "rimraf packages/*/dist .bob/",
17 | "build": "bob build",
18 | "lint": "eslint --ignore-path .gitignore .",
19 | "postbuild": "node scripts/copy-files.mjs && yarn workspace website build",
20 | "postinstall": "husky install",
21 | "prettier": "prettier --write --list-different ."
22 | },
23 | "workspaces": [
24 | "packages/*",
25 | "website"
26 | ],
27 | "devDependencies": {
28 | "@changesets/changelog-github": "0.4.6",
29 | "@changesets/cli": "2.24.4",
30 | "@theguild/prettier-config": "0.0.3",
31 | "@types/node": "18.7.11",
32 | "@types/react": "18.0.17",
33 | "@typescript-eslint/eslint-plugin": "5.34.0",
34 | "@typescript-eslint/parser": "5.34.0",
35 | "bob-the-bundler": "4.0.0",
36 | "eslint": "8.22.0",
37 | "eslint-config-prettier": "8.5.0",
38 | "eslint-plugin-import": "2.26.0",
39 | "eslint-plugin-jsx-a11y": "6.6.1",
40 | "eslint-plugin-react": "7.30.1",
41 | "eslint-plugin-react-hooks": "4.6.0",
42 | "husky": "8.0.1",
43 | "patch-package": "6.4.7",
44 | "prettier": "2.7.1",
45 | "rimraf": "3.0.2",
46 | "typescript": "4.7.4"
47 | },
48 | "engines": {
49 | "yarn": ">=1.22.17"
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | /* eslint-env node */
2 | module.exports = {
3 | reportUnusedDisableDirectives: true,
4 | overrides: [
5 | {
6 | files: '*.{js,jsx,cjs,mjs,ts,tsx,cts,mts}',
7 | extends: [
8 | 'eslint:recommended',
9 | 'plugin:@typescript-eslint/recommended',
10 | 'plugin:react/recommended',
11 | 'plugin:react-hooks/recommended',
12 | 'plugin:jsx-a11y/recommended',
13 | 'plugin:import/recommended',
14 | 'plugin:import/typescript',
15 | 'prettier',
16 | ],
17 | parser: '@typescript-eslint/parser',
18 | rules: {
19 | 'object-shorthand': ['error', 'always'],
20 | 'no-else-return': ['error', { allowElseIf: false }],
21 | 'react/jsx-curly-brace-presence': ['error', 'never'],
22 | 'react/jsx-filename-extension': ['error', { extensions: ['.tsx'] }],
23 | // eslint has wrong import path resolution and also doesn't seem to find regular dependencies
24 | 'import/no-unresolved': 'off',
25 | // There are legitimate reasons some types are set as "any" for easier usage
26 | '@typescript-eslint/no-explicit-any': 'off',
27 | // This is an arbitrary and useless rule
28 | 'react/no-children-prop': 'off',
29 | 'react/react-in-jsx-scope': 'off',
30 | },
31 | settings: {
32 | react: {
33 | version: 'detect',
34 | },
35 | },
36 | },
37 | {
38 | files: ['.eslintrc.js', 'scripts/*', 'next.config.mjs', 'postcss.config.{js,cjs}', 'tailwind.config.cjs'],
39 | env: {
40 | node: true,
41 | },
42 | },
43 | {
44 | files: 'examples/**/*',
45 | rules: {
46 | 'react/react-in-jsx-scope': 'off', // no need for NextJS
47 | },
48 | },
49 | ],
50 | };
51 |
--------------------------------------------------------------------------------
/packages/algolia/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # @guild-docs/algolia
2 |
3 | ## 0.2.2
4 |
5 | ### Patch Changes
6 |
7 | - [#660](https://github.com/the-guild-org/the-guild-docs/pull/660) [`5dbc5c1`](https://github.com/the-guild-org/the-guild-docs/commit/5dbc5c1c4002e52056f6757e42538788d08e10b1) Thanks [@charlypoly](https://github.com/charlypoly)! - feat(algolia): hash content for lockfile to trigger reindexing on content change
8 |
9 | ## 0.2.1
10 |
11 | ### Patch Changes
12 |
13 | - [#658](https://github.com/the-guild-org/the-guild-docs/pull/658) [`287e657`](https://github.com/the-guild-org/the-guild-docs/commit/287e657881fc2744c457700b002f7a979b2b0b5c) Thanks [@charlypoly](https://github.com/charlypoly)! - fix(algolia): remove `import` and `export` from records content
14 |
15 | ## 0.2.0
16 |
17 | ### Minor Changes
18 |
19 | - bf6f52b: Support TypeScript ESM modules (`"module": "node16"` and `"moduleResolution": "node16"`).
20 |
21 | [More information on the TypeScript Release Notes.](https://devblogs.microsoft.com/typescript/announcing-typescript-4-7/#ecmascript-module-support-in-node-js)
22 |
23 | ## 0.1.1
24 |
25 | ### Patch Changes
26 |
27 | - 1f42861: fix releasing
28 |
29 | ## 0.1.0
30 |
31 | ### Minor Changes
32 |
33 | - 792d6e6: t(algolia): support for Nextra docs
34 |
35 | ### Patch Changes
36 |
37 | - 0fb3da6: switch to yarn from pnpm
38 |
39 | ## 0.0.6
40 |
41 | ### Patch Changes
42 |
43 | - 6091678: feat(algolia): Docusaurus routes support
44 |
45 | ## 0.0.5
46 |
47 | ### Patch Changes
48 |
49 | - 373c9b9: adding kitql
50 |
51 | ## 0.0.4
52 |
53 | ### Patch Changes
54 |
55 | - 2d12616: fix(algolia): typo in lockfile diffing
56 |
57 | ## 0.0.3
58 |
59 | ### Patch Changes
60 |
61 | - d344e53: fix(algolia): fix diffing on repos with formatting
62 |
63 | ## 0.0.2
64 |
65 | ### Patch Changes
66 |
67 | - fb755f0: `@guild-docs/algolia`
68 |
--------------------------------------------------------------------------------
/packages/algolia/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@guild-docs/algolia",
3 | "version": "0.2.2",
4 | "repository": {
5 | "type": "git",
6 | "url": "git+https://github.com/the-guild-org/the-guild-docs.git"
7 | },
8 | "license": "MIT",
9 | "dependencies": {
10 | "algoliasearch": "^4.13.1",
11 | "github-slugger": "^1.4.0",
12 | "glob": "^8.0.3",
13 | "gray-matter": "^4.0.3",
14 | "lodash": "^4.17.21",
15 | "remove-markdown": "0.5.0"
16 | },
17 | "devDependencies": {
18 | "@types/github-slugger": "1.3.0",
19 | "@types/glob": "7.2.0",
20 | "@types/lodash": "^4.14.184",
21 | "@types/remove-markdown": "0.3.1"
22 | },
23 | "main": "dist/cjs/index.js",
24 | "module": "dist/esm/index.js",
25 | "typings": "dist/typings/index.d.ts",
26 | "typescript": {
27 | "definition": "dist/typings/index.d.ts"
28 | },
29 | "exports": {
30 | ".": {
31 | "require": {
32 | "types": "./dist/typings/index.d.cts",
33 | "default": "./dist/cjs/index.js"
34 | },
35 | "import": {
36 | "types": "./dist/typings/index.d.ts",
37 | "default": "./dist/esm/index.js"
38 | },
39 | "default": {
40 | "types": "./dist/typings/index.d.ts",
41 | "default": "./dist/esm/index.js"
42 | }
43 | },
44 | "./*": {
45 | "require": {
46 | "types": "./dist/typings/*.d.cts",
47 | "default": "./dist/cjs/*.js"
48 | },
49 | "import": {
50 | "types": "./dist/typings/*.d.ts",
51 | "default": "./dist/esm/*.js"
52 | },
53 | "default": {
54 | "types": "./dist/typings/*.d.ts",
55 | "default": "./dist/esm/*.js"
56 | }
57 | },
58 | "./package.json": "./package.json"
59 | },
60 | "buildOptions": {
61 | "input": "./src/index.ts"
62 | },
63 | "publishConfig": {
64 | "directory": "dist",
65 | "access": "public"
66 | },
67 | "type": "module"
68 | }
69 |
--------------------------------------------------------------------------------
/packages/docs/src/giscus.tsx:
--------------------------------------------------------------------------------
1 | import React, { ReactElement, useEffect, useMemo, useState } from 'react';
2 | import { useRouter } from 'next/router.js';
3 | import Script from 'next/script.js';
4 | import { useTheme } from '@theguild/components';
5 |
6 | export interface GiscusProps {
7 | repo: string;
8 | repoId: string;
9 | category: string;
10 | categoryId: string;
11 | }
12 |
13 | let GiscusKeyInc = 0;
14 |
15 | export const Giscus = ({ category, categoryId, repo, repoId }: GiscusProps): ReactElement | null => {
16 | const { asPath } = useRouter();
17 | const [loaded, setLoaded] = useState(false);
18 |
19 | useEffect(() => {
20 | if (!loaded) return;
21 |
22 | const iframe = document.querySelector('iframe.giscus-frame');
23 | iframe?.contentWindow?.postMessage(
24 | {
25 | giscus: {
26 | setConfig: {
27 | term: asPath.split('?')[0],
28 | },
29 | },
30 | },
31 | window.location.origin
32 | );
33 | }, [asPath, loaded]);
34 |
35 | const { theme } = useTheme();
36 |
37 | const scriptKey = useMemo(() => `${theme}${asPath}${++GiscusKeyInc}`.replace(/\//g, '_'), [theme, asPath]);
38 |
39 | if (typeof window === 'undefined') return null;
40 |
41 | return (
42 | <>
43 |