From f9f4a96f47c4e31c6f6a630676debb8375d6d2f9 Mon Sep 17 00:00:00 2001 From: tgreyuk Date: Fri, 20 Jan 2023 22:28:42 +0000 Subject: [PATCH 1/2] Preparing changesets --- .changeset/polite-planets-knock.md | 10 ++++ .changeset/twenty-moose-promise.md | 5 ++ .github/workflows/release.yml | 17 ++++-- package-lock.json | 54 +++---------------- package.json | 6 ++- .../docusaurus-plugin-typedoc/package.json | 3 -- .../specs/__snapshots__/plugin.spec.ts.snap | 14 ----- .../test/specs/plugin.spec.ts | 12 ++--- packages/typedoc-plugin-markdown/README.md | 12 ++--- ...ile-strategy.md => file-output-options.md} | 4 +- packages/typedoc-plugin-markdown/src/index.ts | 2 +- .../src/support/utils.ts | 4 +- .../__snapshots__/declarations.spec.ts.snap | 2 +- .../specs/__snapshots__/generics.spec.ts.snap | 2 +- .../specs/__snapshots__/types.spec.ts.snap | 2 +- scripts/changesets/changelog.js | 9 ++-- 16 files changed, 59 insertions(+), 99 deletions(-) create mode 100644 .changeset/polite-planets-knock.md create mode 100644 .changeset/twenty-moose-promise.md rename packages/typedoc-plugin-markdown/documentation/{output-file-strategy.md => file-output-options.md} (97%) diff --git a/.changeset/polite-planets-knock.md b/.changeset/polite-planets-knock.md new file mode 100644 index 000000000..b29f7cff9 --- /dev/null +++ b/.changeset/polite-planets-knock.md @@ -0,0 +1,10 @@ +--- +'typedoc-plugin-markdown': major +--- + +Initial release of next version. In summary includes: + +- Removal of handlebars as a dependency. +- MDX2 support as standard (#305, #252). +- Exposes additional output file options (#353, #338, #328, #307). +- Several UI improvements. diff --git a/.changeset/twenty-moose-promise.md b/.changeset/twenty-moose-promise.md new file mode 100644 index 000000000..62df69191 --- /dev/null +++ b/.changeset/twenty-moose-promise.md @@ -0,0 +1,5 @@ +--- +'docusaurus-plugin-typedoc': major +--- + +- Compatibility updates for typedoc-plugin-markdown diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 09b344111..3a8fbe023 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,8 @@ name: Release -on: [pull_request] +on: + push: + branches: + - next-release concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: release: @@ -8,13 +11,17 @@ jobs: steps: - name: Checkout Repo uses: actions/checkout@v3 - - name: Setup Node.js 16 + - name: Setup Node.js 16.x uses: actions/setup-node@v3 with: - node-version: 16 + node-version: 16.x - name: Install Dependencies - run: yarn - - name: Create Release Pull Request + run: npm install + - name: Create Release Pull Request or Publish to npm + id: changesets uses: changesets/action@v1 + with: + publish: npm run release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package-lock.json b/package-lock.json index 95c39eab4..e3b3d3519 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,7 +5,8 @@ "packages": { "": { "workspaces": [ - "packages/*" + "packages/typedoc-plugin-markdown", + "packages/docusaurus-plugin-typedoc" ], "devDependencies": { "@changesets/cli": "^2.26.0", @@ -6771,18 +6772,6 @@ "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x" } }, - "node_modules/typedoc-bitbucket-theme": { - "resolved": "packages/typedoc-bitbucket-theme", - "link": true - }, - "node_modules/typedoc-github-wiki-theme": { - "resolved": "packages/typedoc-github-wiki-theme", - "link": true - }, - "node_modules/typedoc-gitlab-wiki-theme": { - "resolved": "packages/typedoc-gitlab-wiki-theme", - "link": true - }, "node_modules/typedoc-plugin-markdown": { "resolved": "packages/typedoc-plugin-markdown", "link": true @@ -6925,10 +6914,6 @@ "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==" }, - "node_modules/vuepress-plugin-typedoc": { - "resolved": "packages/vuepress-plugin-typedoc", - "link": true - }, "node_modules/walker": { "version": "1.0.8", "dev": true, @@ -7133,9 +7118,6 @@ "packages/docusaurus-plugin-typedoc": { "version": "0.17.6", "license": "MIT", - "devDependencies": { - "typedoc-plugin-markdown": "^3.13.0" - }, "peerDependencies": { "typedoc": ">=0.23.0", "typedoc-plugin-markdown": ">=3.13.0" @@ -7143,6 +7125,7 @@ }, "packages/typedoc-bitbucket-theme": { "version": "1.0.0", + "extraneous": true, "license": "MIT", "devDependencies": { "typedoc-plugin-markdown": "^3.13.0" @@ -7154,6 +7137,7 @@ }, "packages/typedoc-github-wiki-theme": { "version": "1.0.1", + "extraneous": true, "license": "MIT", "devDependencies": { "typedoc-plugin-markdown": "^3.13.0" @@ -7165,6 +7149,7 @@ }, "packages/typedoc-gitlab-wiki-theme": { "version": "1.0.0", + "extraneous": true, "license": "MIT", "devDependencies": { "typedoc-plugin-markdown": "^3.13.0" @@ -7183,6 +7168,7 @@ }, "packages/vuepress-plugin-typedoc": { "version": "0.11.1", + "extraneous": true, "license": "MIT", "devDependencies": { "typedoc-plugin-markdown": ">=3.13.0" @@ -9216,9 +9202,7 @@ }, "docusaurus-plugin-typedoc": { "version": "file:packages/docusaurus-plugin-typedoc", - "requires": { - "typedoc-plugin-markdown": "^3.13.0" - } + "requires": {} }, "electron-to-chromium": { "version": "1.4.284", @@ -11744,24 +11728,6 @@ } } }, - "typedoc-bitbucket-theme": { - "version": "file:packages/typedoc-bitbucket-theme", - "requires": { - "typedoc-plugin-markdown": "^3.13.0" - } - }, - "typedoc-github-wiki-theme": { - "version": "file:packages/typedoc-github-wiki-theme", - "requires": { - "typedoc-plugin-markdown": "^3.13.0" - } - }, - "typedoc-gitlab-wiki-theme": { - "version": "file:packages/typedoc-gitlab-wiki-theme", - "requires": { - "typedoc-plugin-markdown": "^3.13.0" - } - }, "typedoc-plugin-markdown": { "version": "file:packages/typedoc-plugin-markdown", "requires": {} @@ -11844,12 +11810,6 @@ "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==" }, - "vuepress-plugin-typedoc": { - "version": "file:packages/vuepress-plugin-typedoc", - "requires": { - "typedoc-plugin-markdown": ">=3.13.0" - } - }, "walker": { "version": "1.0.8", "dev": true, diff --git a/package.json b/package.json index 283c88ffe..4da7fbaf6 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,14 @@ "private": true, "workspaces": [ "packages/typedoc-plugin-markdown", - "packages/typedoc-plugin-markdown" + "packages/docusaurus-plugin-typedoc" ], "scripts": { "lint": "npm run lint --workspaces", "build": "npm run build --workspaces", - "test": "npm run test --workspaces" + "test": "npm run test --workspaces", + "prerelease": "npm run build", + "release": "npx changeset publish" }, "devDependencies": { "@changesets/cli": "^2.26.0", diff --git a/packages/docusaurus-plugin-typedoc/package.json b/packages/docusaurus-plugin-typedoc/package.json index b14ae1bcd..407b2b67a 100644 --- a/packages/docusaurus-plugin-typedoc/package.json +++ b/packages/docusaurus-plugin-typedoc/package.json @@ -19,9 +19,6 @@ "typedoc": ">=0.23.0", "typedoc-plugin-markdown": ">=3.13.0" }, - "devDependencies": { - "typedoc-plugin-markdown": "^3.13.0" - }, "scripts": { "lint": "eslint ./src --ext .ts", "prepublishOnly": "npm run lint && npm run build && npm run test", diff --git a/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/plugin.spec.ts.snap b/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/plugin.spec.ts.snap index d3b2de2e3..460cc8bf0 100644 --- a/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/plugin.spec.ts.snap +++ b/packages/docusaurus-plugin-typedoc/test/specs/__snapshots__/plugin.spec.ts.snap @@ -1,19 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Plugin: (docs) should render 1`] = ` -[ - "_category_.yml", - "classes", - "enums", - "functions", - "index.md", - "interfaces", - "Modules.md", - "namespaces", - "variables", -] -`; - exports[`Plugin: (docs) should write category yaml 1`] = ` "label: "Classes" position: 3" diff --git a/packages/docusaurus-plugin-typedoc/test/specs/plugin.spec.ts b/packages/docusaurus-plugin-typedoc/test/specs/plugin.spec.ts index 683976e42..1167e13b2 100644 --- a/packages/docusaurus-plugin-typedoc/test/specs/plugin.spec.ts +++ b/packages/docusaurus-plugin-typedoc/test/specs/plugin.spec.ts @@ -33,21 +33,17 @@ describe(`Plugin:`, () => { tmpobj = tmp.dirSync(); await bootstrap(tmpobj); }); - test(`should render`, () => { - const files = fs.readdirSync(tmpobj.name + '/docs/api'); - expect(files.sort((a, b) => a.localeCompare(b))).toMatchSnapshot(); - }); test(`should write doc`, () => { - const sidebar = fs.readFileSync(tmpobj.name + '/docs/api/index.md'); - expect(sidebar.toString()).toMatchSnapshot(); + const indexDoc = fs.readFileSync(tmpobj.name + '/docs/api/index.md'); + expect(indexDoc.toString()).toMatchSnapshot(); }); test(`should write category yaml`, () => { - const sidebar = fs.readFileSync( + const categoryYaml = fs.readFileSync( tmpobj.name + '/docs/api/classes/_category_.yml', ); - expect(sidebar.toString()).toMatchSnapshot(); + expect(categoryYaml.toString()).toMatchSnapshot(); }); }); }); diff --git a/packages/typedoc-plugin-markdown/README.md b/packages/typedoc-plugin-markdown/README.md index e46dd7b40..357ebdc54 100644 --- a/packages/typedoc-plugin-markdown/README.md +++ b/packages/typedoc-plugin-markdown/README.md @@ -32,9 +32,9 @@ The `--plugin` arg is optional (all plugins are loaded by default), however if u The following options can be used in addition to relevant [TypeDoc options](https://typedoc.org/guides/options/) (please note that TypeDoc options specific to the HTML theme will be ignored). -Please read the [documentation](#documentation) for further configuration options. +### File output options -**File output options** +See [File output options](./documentation/file-output-options.md) for further documentation. - **`--entryDocument`**
The file name of the entry document. Defaults to `README.md`. @@ -43,7 +43,7 @@ Please read the [documentation](#documentation) for further configuration option - **`--fileStructure`**
Specifies how the files should be generated, grouped by modules or symbol types. Expected values [`modules`, `symbols`]. Defaults to `modules`. -**UI options** +### UI options - **`--hideBreadcrumbs`**
Do not print breadcrumbs header. Defaults to `false`. @@ -53,10 +53,8 @@ Please read the [documentation](#documentation) for further configuration option Do not print the page title. Defaults to `false`. - **`--hideHierarchy`**
Do not print reflection hierarchy. Defaults to `false`. -- **`--typeDeclarationStyle`**
- Specify the render style of type declarations. Expected values [`list`, `table`] Defaults to `list`. -**Utility options** +### Utility options - **`--namedAnchors`**
Use HTML named anchors tags for implementations that do not assign header ids. Defaults to `false`. @@ -65,7 +63,7 @@ Please read the [documentation](#documentation) for further configuration option ## Documentation -- [Output file strategy](./documentation/output-file-strategy.md) +- [File output options](./documentation/file-output-options.md) ## License diff --git a/packages/typedoc-plugin-markdown/documentation/output-file-strategy.md b/packages/typedoc-plugin-markdown/documentation/file-output-options.md similarity index 97% rename from packages/typedoc-plugin-markdown/documentation/output-file-strategy.md rename to packages/typedoc-plugin-markdown/documentation/file-output-options.md index c8fc8ec6d..8f98d6615 100644 --- a/packages/typedoc-plugin-markdown/documentation/output-file-strategy.md +++ b/packages/typedoc-plugin-markdown/documentation/file-output-options.md @@ -1,4 +1,4 @@ -# Output file strategy +# File output options TypeDoc creates documentation according to exports. The modules strucutre will be driven by the implemented an entry point config. https://typedoc.org/guides/options/#entrypointstrategy. @@ -41,7 +41,7 @@ _Note when definiting arrays using a json options file is less verbose:_ ## Configuring the output directory structure -### Default structure +### Default structure (by symbols) As per the HTML theme, by default the plugin groups exports in directories following the symbol type producing the following output. diff --git a/packages/typedoc-plugin-markdown/src/index.ts b/packages/typedoc-plugin-markdown/src/index.ts index 73326a344..2cd811aed 100644 --- a/packages/typedoc-plugin-markdown/src/index.ts +++ b/packages/typedoc-plugin-markdown/src/index.ts @@ -30,7 +30,7 @@ export function load(app: Application) { name: 'fileStructure', help: '[Markdown Plugin] Specifies how the filesystem should be standard. Hierarchical builds directories as per file system.', type: ParameterType.String, - defaultValue: 'modules', + defaultValue: 'symbols', validate: (option) => { const availableValues = ['modules', 'symbols']; if (!availableValues.includes(option)) { diff --git a/packages/typedoc-plugin-markdown/src/support/utils.ts b/packages/typedoc-plugin-markdown/src/support/utils.ts index a6a0a1905..cf2aa3ab7 100644 --- a/packages/typedoc-plugin-markdown/src/support/utils.ts +++ b/packages/typedoc-plugin-markdown/src/support/utils.ts @@ -12,8 +12,8 @@ export function formatContents(contents: string) { export function escapeChars(str: string) { return str - .replace(//g, '\\>') + .replace(/>/g, '\\<') + .replace(/{/g, '\\{') .replace(/_/g, '\\_') .replace(/`/g, '\\`') .replace(/\|/g, '\\|'); diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/declarations.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/declarations.spec.ts.snap index 467335f7e..3df676fde 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/declarations.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/declarations.spec.ts.snap @@ -54,7 +54,7 @@ AnyFunctionType: Function > > ### Returns > -> \`A\` +> [\`A\`](../types/AnyFunctionType.md#a) > > [partial: sources] > diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/generics.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/generics.spec.ts.snap index ffea81953..e3915ee67 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/generics.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/generics.spec.ts.snap @@ -7,7 +7,7 @@ exports[`Generics: should compile class with type params 1`] = ` [partial: comment] -# Type parameters +## Type parameters - \`T\` - \`V\` diff --git a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/types.spec.ts.snap b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/types.spec.ts.snap index cf4a0a059..f1b7e65c3 100644 --- a/packages/typedoc-plugin-markdown/test/specs/__snapshots__/types.spec.ts.snap +++ b/packages/typedoc-plugin-markdown/test/specs/__snapshots__/types.spec.ts.snap @@ -20,7 +20,7 @@ exports[`Types: should compile collapsed 'literal' type' 1`] = `"\`Object\`"`; exports[`Types: should compile collapsed 'objectLiteralType' type' 1`] = `"\`Object\`"`; -exports[`Types: should compile conditional type ' 1`] = `"\`T\` extends \`string\` ? \`"string"\` : \`T\` extends \`number\` ? \`"number"\` : \`T\` extends \`boolean\` ? \`"boolean"\` : \`T\` extends \`undefined\` ? \`"undefined"\` : \`"object"\`"`; +exports[`Types: should compile conditional type ' 1`] = `"[\`T\`](../types/ConditionalType.md#t) extends \`string\` ? \`"string"\` : [\`T\`](../types/ConditionalType.md#t) extends \`number\` ? \`"number"\` : [\`T\`](../types/ConditionalType.md#t) extends \`boolean\` ? \`"boolean"\` : [\`T\`](../types/ConditionalType.md#t) extends \`undefined\` ? \`"undefined"\` : \`"object"\`"`; exports[`Types: should compile expanded 'function' type ' 1`] = `""`; diff --git a/scripts/changesets/changelog.js b/scripts/changesets/changelog.js index 6f6899e41..b04edcbe6 100644 --- a/scripts/changesets/changelog.js +++ b/scripts/changesets/changelog.js @@ -1,15 +1,14 @@ const getReleaseLine = async (changeset, _type) => { - const [firstLine, ...futureLines] = changeset.summary + /*const [firstLine, ...futureLines] = changeset.summary .split('\n') .map((l) => l.trimRight()); - let returnVal = `- ${firstLine}`; + let returnVal = `- ${firstLine}`; if (futureLines.length > 0) { returnVal += `\n- ${futureLines.map((l) => ` ${l}`).join('\n')}`; - } - - return returnVal; + }*/ + return changeset.summary; }; const getDependencyReleaseLine = async (changesets, dependenciesUpdated) => { From d2cc673ff0e09d230ac847f7ff78100a34d2b94d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 22 Jan 2023 18:11:04 +0000 Subject: [PATCH 2/2] Version Packages (next) --- .changeset/pre.json | 8 ++++++-- packages/docusaurus-plugin-typedoc/CHANGELOG.md | 11 +++++++++++ packages/docusaurus-plugin-typedoc/package.json | 4 ++-- packages/typedoc-plugin-markdown/CHANGELOG.md | 11 +++++++++++ packages/typedoc-plugin-markdown/package.json | 2 +- 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/.changeset/pre.json b/.changeset/pre.json index 8b5a484dc..caf2d0038 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -2,7 +2,11 @@ "mode": "pre", "tag": "next", "initialVersions": { - "typedoc-plugin-markdown": "3.13.4" + "typedoc-plugin-markdown": "3.13.4", + "docusaurus-plugin-typedoc": "0.17.6" }, - "changesets": [] + "changesets": [ + "polite-planets-knock", + "twenty-moose-promise" + ] } diff --git a/packages/docusaurus-plugin-typedoc/CHANGELOG.md b/packages/docusaurus-plugin-typedoc/CHANGELOG.md index 41f4ac4ba..70f36372d 100644 --- a/packages/docusaurus-plugin-typedoc/CHANGELOG.md +++ b/packages/docusaurus-plugin-typedoc/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 1.0.0-next.0 + +### Major Changes + +- Compatibility updates for typedoc-plugin-markdown + +### Patch Changes + +- Updated peer dependencies + - typedoc-plugin-markdown@4.0.0-next.0 + ## [0.17.6](https://github.com/tgreyuk/typedoc-plugin-markdown/compare/docusaurus-plugin-typedoc@0.17.5...docusaurus-plugin-typedoc@0.17.6) (2022-06-27) **Note:** Version bump only for package docusaurus-plugin-typedoc diff --git a/packages/docusaurus-plugin-typedoc/package.json b/packages/docusaurus-plugin-typedoc/package.json index 407b2b67a..cb052dba1 100644 --- a/packages/docusaurus-plugin-typedoc/package.json +++ b/packages/docusaurus-plugin-typedoc/package.json @@ -1,6 +1,6 @@ { "name": "docusaurus-plugin-typedoc", - "version": "0.17.6", + "version": "1.0.0-next.0", "description": "A Docusaurus v2 plugin to build API documentation with TypeDoc.", "main": "dist/index.js", "files": [ @@ -17,7 +17,7 @@ "homepage": "https://github.com/tgreyuk/typedoc-plugin-markdown/tree/master/packages/docusaurus-plugin-typedoc", "peerDependencies": { "typedoc": ">=0.23.0", - "typedoc-plugin-markdown": ">=3.13.0" + "typedoc-plugin-markdown": ">=4.0.0-next.0" }, "scripts": { "lint": "eslint ./src --ext .ts", diff --git a/packages/typedoc-plugin-markdown/CHANGELOG.md b/packages/typedoc-plugin-markdown/CHANGELOG.md index 85512ba75..eb419cf92 100644 --- a/packages/typedoc-plugin-markdown/CHANGELOG.md +++ b/packages/typedoc-plugin-markdown/CHANGELOG.md @@ -1,5 +1,16 @@ # Changelog +## 4.0.0-next.0 + +### Major Changes + +Initial release of next version. In summary includes: + +- Removal of handlebars as a dependency. +- MDX2 support as standard (#305, #252). +- Exposes additional output file options (#353, #338, #328, #307). +- Several UI improvements. + ## [3.13.4](https://github.com/tgreyuk/typedoc-plugin-markdown/compare/typedoc-plugin-markdown@3.13.3...typedoc-plugin-markdown@3.13.4) (2022-07-20) ### Fixes diff --git a/packages/typedoc-plugin-markdown/package.json b/packages/typedoc-plugin-markdown/package.json index 315cee30c..d93a42d43 100644 --- a/packages/typedoc-plugin-markdown/package.json +++ b/packages/typedoc-plugin-markdown/package.json @@ -1,6 +1,6 @@ { "name": "typedoc-plugin-markdown", - "version": "3.13.4", + "version": "4.0.0-next.0", "description": "A plugin for TypeDoc that enables TypeScript API documentation to be generated in Markdown.", "main": "dist/index.js", "files": [