Skip to content

Commit

Permalink
chore: Implemented nextra and further refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tgreyuk committed Dec 29, 2023
1 parent 8f0fe9c commit e9899c5
Show file tree
Hide file tree
Showing 172 changed files with 11,120 additions and 17,893 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
"changelog": [
"../scripts/changesets/changelog.js",
"./changelog.js",
{ "repo": "tgreyuk/typedoc-plugin-markdown" }
],
"commit": false,
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/ci.typedoc-plugin-frontmatter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI [typedoc-plugin-frontmatter]
on:
push:
paths:
- packages/typedoc-plugin-frontmatter/**
pull_request:
paths:
- packages/typedoc-plugin-frontmatter/**
jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18']
name: Node ${{ matrix.node }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install
run: npm install
- name: Lint
run: npm run lint --workspace typedoc-plugin-frontmatter
- name: Build
run: npm run build --workspace typedoc-plugin-markdown --workspace typedoc-plugin-frontmatter
- name: Test
run: npm run test --workspace typedoc-plugin-frontmatter
31 changes: 31 additions & 0 deletions .github/workflows/ci.typedoc-plugin-remark.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI [typedoc-plugin-remark]
on:
push:
paths:
- packages/typedoc-plugin-remark/**
pull_request:
paths:
- packages/typedoc-plugin-remark/**
jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18']
name: Node ${{ matrix.node }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install
run: npm install
- name: Lint
run: npm run lint --workspace typedoc-plugin-remark
- name: Build
run: npm run build --workspace typedoc-plugin-markdown --workspace typedoc-plugin-remark
- name: Test
run: npm run test --workspace typedoc-plugin-remark
17 changes: 12 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
name: CI
on: [push, pull_request]
on:
push:
paths:
- packages/typedoc-plugin-markdown/**
pull_request:
paths:
- packages/typedoc-plugin-markdown/**
jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['16']
node: ['18']
name: Node ${{ matrix.node }}
steps:
- name: Checkout repository
Expand All @@ -14,11 +20,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install
run: npm install
- name: Lint
run: npm run lint
run: npm run lint --workspacs --if-present
- name: Build
run: npm run build
run: npm run build --workspaces --if-present
- name: Test
run: npm run test
run: npm run test --workspaces --if-present
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Packages

| Package | Version | Downloads | Changelog |
| :---| :---| :--- | --- |
[typedoc-plugin-markdown](./packages/typedoc-plugin-markdown#readme) | ![npm](https://img.shields.io/npm/v/typedoc-plugin-markdown%2Fnext?style=flat-square&logo=npm) | ![Downloads](https://img.shields.io/npm/dm/typedoc-plugin-markdown) | [Changelog](./packages/typedoc-plugin-markdown/CHANGELOG.md) |
[docusaurus-plugin-typedoc](./packages/docusaurus-plugin-typedoc#readme) | ![npm](https://img.shields.io/npm/v/docusaurus-plugin-typedoc%2Fnext?style=flat-square&logo=npm) | ![Downloads](https://img.shields.io/npm/dm/docusaurus-plugin-typedoc) | [Changelog](./packages/docusaurus-plugin-typedoc/CHANGELOG.md) |
[typedoc-github-wiki-theme](./packages/typedoc-github-wiki-theme#readme) | ![npm](https://img.shields.io/npm/v/typedoc-github-wiki-theme%2Fnext?style=flat-square&logo=npm) | ![Downloads](https://img.shields.io/npm/dm/typedoc-github-wiki-theme) | [Changelog](./packages/typedoc-github-wiki-theme/CHANGELOG.md) |
[typedoc-gitlab-wiki-theme](./packages/typedoc-gitlab-wiki-theme#readme) | ![npm](https://img.shields.io/npm/v/typedoc-gitlab-wiki-theme%2Fnext?style=flat-square&logo=npm) | ![Downloads](https://img.shields.io/npm/dm/typedoc-gitlab-wiki-theme) | [Changelog](./packages/typedoc-gitlab-wiki-theme/CHANGELOG.md) |
[typedoc-vitepress-theme](./packages/typedoc-vitepress-theme#readme) | ![npm](https://img.shields.io/npm/v/typedoc-vitepress-theme%2Fnext?style=flat-square&logo=npm) | ![Downloads](https://img.shields.io/npm/dm/typedoc-vitepress-theme) | [Changelog](./packages/typedoc-vitepress-theme/CHANGELOG.md) |
| Package | Description |
| :---| :---|
[typedoc-plugin-markdown](./packages/typedoc-plugin-markdown#readme) | A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown. |
[typedoc-plugin-frontmatter](./packages/typedoc-plugin-frontmatter#readme) | A plugin for TypeDoc that prepends configurable frontmatter to page content. |
[typedoc-plugin-remark](./packages/typedoc-plugin-remark#readme) | A plugin for TypeDoc that enables additional markdown transformations with remark. |
[typedoc-github-wiki-theme](./packages/typedoc-github-wiki-theme#readme) | A TypeDoc theme that publishes Markdown pages compatible with Github Wiki. |
[typedoc-gitlab-wiki-theme](./packages/typedoc-gitlab-wiki-theme#readme) | A TypeDoc theme that publishes Markdown pages compatible with Gitlab Wiki. |
[typedoc-vitepress-theme](./packages/typedoc-vitepress-theme#readme) | A TypeDoc theme that publishes Markdown pages compatible with VitePress. |
[docusaurus-plugin-typedoc](./packages/docusaurus-plugin-typedoc#readme) | A Docusaurus plugin to integrate API docs generated by TypeDoc into a Docusaurus project. |
83 changes: 83 additions & 0 deletions dev-packages/generate-readmes/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env ts-node

import { DOCS_CONFIG } from '@dev-packages/helpers';
import { consola } from 'consola';
import * as fs from 'fs';

main();

async function main() {
const packagesPromises = [
'typedoc-plugin-markdown',
'typedoc-plugin-frontmatter',
'typedoc-plugin-remark',
'typedoc-github-wiki-theme',
'typedoc-gitlab-wiki-theme',
'typedoc-vitepress-theme',
'docusaurus-plugin-typedoc',
].map(async (packageName) => {
const packageJson = await import(
`../../packages/${packageName}/package.json`
);
return {
name: packageName,
description: packageJson.description,
};
});
const packages = await Promise.all(packagesPromises);

writeRepositoryReadme(packages);
packages.forEach((packageItem) => writePackageReadme(packageItem));
consola.success(`Generate readmes complete`);
}

function writeRepositoryReadme(packages: any) {
const readme = ['# Packages\n'];
const headers: string[] = [];
headers.push('| Package | Description | ');
headers.push('| :---| :---|');

const rows = packages.map((packageItem) => {
return (
[
`[${packageItem.name}](./packages/${packageItem.name}#readme)`,
packageItem.description,
].join(' | ') + ' | '
);
});

readme.push(...headers, ...rows);

fs.writeFileSync('README.md', readme.join('\n'));
}

function writePackageReadme(packageItem: any) {
const readme = [`# ${packageItem.name}`];
const badges = [
`![npm](https://img.shields.io/npm/v/${packageItem.name}%2Fnext?\&logo=npm)`,
`![Downloads](https://img.shields.io/npm/dm/${packageItem.name})`,
`[![Build Status](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml/badge.svg?branch=next)](https://github.com/tgreyuk/typedoc-plugin-markdown/actions/workflows/ci.yml)`,
];

readme.push(badges.join(' '));
readme.push(`${packageItem.description}`);
const docLink = `https://typedoc-plugin-markdown.org${
DOCS_CONFIG[packageItem.name].docsPath
}`;

readme.push('## Installation');
readme.push(`\`\`\`shell
npm install ${packageItem.name} --save-dev
\`\`\``);

readme.push('## Documentation');
const resources = [`Please visit ${docLink}.`];
readme.push(resources.join('\n'));
readme.push('## License');
readme.push(`Released under the [MIT License](./CHANGELOG.md).`);

fs.writeFileSync(
`./packages/${packageItem.name}/README.md`,
readme.join('\n\n'),
);
}
10 changes: 10 additions & 0 deletions dev-packages/generate-readmes/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@dev-packages/generate-readmes",
"private": true,
"files": [
"/"
],
"bin": {
"generate-readmes": "cli.ts"
}
}
8 changes: 8 additions & 0 deletions dev-packages/helpers/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "@dev-packages/helpers",
"private": true,
"main": "src/index.ts",
"files": [
"/"
]
}
50 changes: 50 additions & 0 deletions dev-packages/helpers/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { DocsConfig } from './models';

export const DECLARATIONS_PATH = `${process.cwd()}/src/options/declarations.ts`;

export const PRESETS_PATH = `${process.cwd()}/src/options/presets.ts`;

export const DOCS_CONFIG: Record<string, DocsConfig> = {
['typedoc-plugin-markdown']: {
optionsPath: 'options',
docsPath: '',
declarations: true,
presets: false,
},
['typedoc-plugin-frontmatter']: {
optionsPath: 'utilities/frontmatter',
docsPath: '/utilities/frontmatter',
declarations: true,
presets: false,
},
['typedoc-plugin-remark']: {
optionsPath: 'utilities/remark',
docsPath: '/utilities/remark',
declarations: true,
presets: false,
},
['typedoc-github-wiki-theme']: {
optionsPath: 'themes/github-wiki',
docsPath: '/themes/github-wiki',
declarations: false,
presets: true,
},
['typedoc-gitlab-wiki-theme']: {
optionsPath: 'themes/gitlab-wiki',
docsPath: '/themes/gitlab-wiki',
declarations: false,
presets: true,
},
['typedoc-vitepress-theme']: {
optionsPath: 'themes/vitepress',
docsPath: '/themes/vitepress',
declarations: true,
presets: false,
},
['docusaurus-plugin-typedoc']: {
optionsPath: '/integrations/docusaurus/options',
docsPath: '/integrations/docusaurus',
declarations: false,
presets: false,
},
};
3 changes: 3 additions & 0 deletions dev-packages/helpers/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './constants';
export * from './methods';
export * from './models';
6 changes: 6 additions & 0 deletions dev-packages/helpers/src/methods.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import * as path from 'path';

export function getPackageName() {
const cwdParts = process.cwd().split(path.sep);
return cwdParts[cwdParts.length - 1];
}
15 changes: 15 additions & 0 deletions dev-packages/helpers/src/models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export interface DocsConfig {
optionsPath: string;
docsPath: string;
declarations: boolean;
presets: boolean;
}

export interface OptionDocument {
name: string;
comments: string;
tags: { name: string; comments: string }[];
example: string;
category: string;
help: string;
}
17 changes: 17 additions & 0 deletions dev-packages/prebuild-options/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env ts-node

import { DOCS_CONFIG, DocsConfig, getPackageName } from '@dev-packages/helpers';
import { consola } from 'consola';
import { generateDocs } from './tasks/generate-docs';
import { generateModels } from './tasks/generate-models';

main();

async function main() {
const docsConfig: DocsConfig = DOCS_CONFIG[getPackageName()];
if (docsConfig.declarations) {
await generateModels();
}
await generateDocs(docsConfig);
consola.success(`[${getPackageName()}] Prebuild options complete`);
}
10 changes: 10 additions & 0 deletions dev-packages/prebuild-options/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "@dev-packages/prebuild-options",
"private": true,
"files": [
"/"
],
"bin": {
"prebuild-options": "cli.ts"
}
}
Loading

0 comments on commit e9899c5

Please sign in to comment.