Skip to content

Commit

Permalink
Merge pull request #1801 from intuit/toc
Browse files Browse the repository at this point in the history
add automated TOC to hooks documentation
  • Loading branch information
hipstersmoothie committed Feb 11, 2021
2 parents 39620b9 + 9d61a5e commit 978d6b5
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 55 deletions.
6 changes: 5 additions & 1 deletion docs/css/syntax-highlighting-overrides.css
Expand Up @@ -8,4 +8,8 @@

* {
text-shadow: none !important;
}
}

#ignite .toc ol li {
list-style-type: disc;
}
11 changes: 11 additions & 0 deletions docs/next.config.js
@@ -0,0 +1,11 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const toc = require("@atomictech/rehype-toc");

const withIgnite = require("next-ignite/next")({
repo: "intuit/auto",
name: "auto",
url: "https://intuit.github.io/auto",
rehypePlugins: [[toc, { placeholder: "{{TOC}}" }]],
});

module.exports = withIgnite();
10 changes: 1 addition & 9 deletions docs/pages/docs/plugins/changelog-hooks.mdx
Expand Up @@ -6,15 +6,7 @@ One of the main outputs from `auto` is the changelogs it produces.
The changelog is created from a set of commits that has been parsed using the [log parser](./log-parse-hooks).
The hooks it provides allow you to customize everything about how the changelog renders.

- [onCreateChangelog](#oncreatechangelog)
- [addToBody](#addtobody)
- [renderChangelogLine](#renderchangelogline)
- [sortChangelogLines](#sortchangeloglines)
- [renderChangelogTitle](#renderchangelogtitle)
- [renderChangelogAuthor](#renderchangelogauthor)
- [renderChangelogAuthorLine](#renderchangelogauthorline)
- [createChangelogTitle](#createchangelogtitle)
- [omitReleaseNotes](#omitreleasenotes)
{{TOC}}

## onCreateChangelog

Expand Down
7 changes: 1 addition & 6 deletions docs/pages/docs/plugins/configuration-hooks.mdx
Expand Up @@ -4,12 +4,7 @@ title: Configuration Hooks

All of the following hooks in some way deal with detecting, modifying and validating `auto`'s configuration.

- [beforeRun](#beforerun)
- [modifyConfig](#modifyconfig)
- [getAuthor](#getauthor)
- [getPreviousVersion](#getpreviousversion)
- [getRepository](#getrepository)
- [validateConfig](#validateconfig)
{{TOC}}

## beforeRun

Expand Down
6 changes: 1 addition & 5 deletions docs/pages/docs/plugins/init-hooks.mdx
Expand Up @@ -6,11 +6,7 @@ The `auto init` command provides an easy way to create an `.autorc` without read
It exposes hooks to get the basic information auto needs to function ([getRepo](#getrepo) and [getAuthor](#getauthor)).
It also provides hooks the set up your plugin quicker ([configurePlugin](#configureplugin) and [createEnv](#createenv)).

- [writeRcFile](#writercfile)
- [getRepo](#getrepo)
- [getAuthor](#getauthor)
- [configurePlugin](#configureplugin)
- [createEnv](#createenv)
{{TOC}}

## writeRcFile

Expand Down
4 changes: 1 addition & 3 deletions docs/pages/docs/plugins/log-parse-hooks.mdx
Expand Up @@ -9,9 +9,7 @@ The construct that does that work is the `LogParse` class.
The `LogParse` class is involved in any command that interacts with the git log.
You can use its hooks to attach information to the commit object ([parseCommit](#parsecommit)) or make `auto` ignore commits entirely ([omitCommit](#omitcommit)).

- [onCreateLogParse](#oncreatelogparse)
- [parseCommit](#parsecommit)
- [omitCommit](#omitcommit)
{{TOC}}

## onCreateLogParse

Expand Down
14 changes: 1 addition & 13 deletions docs/pages/docs/plugins/release-lifecycle-hooks.mdx
Expand Up @@ -5,19 +5,7 @@ title: Release Lifecycle Hooks
The following hooks are all called during various release commands (ex: `latest`, `next`, `canary`, `shipit`).
These hooks is where the publishing of your package actually happens.

- [prCheck](#prCheck)
- [beforeShipIt](#beforeshipit)
- [beforeCommitChangelog](#beforecommitchangelog)
- [afterChangelog](#afterchangelog)
- [version](#version)
- [afterVersion](#afterversion)
- [publish](#publish)
- [afterPublish](#afterpublish)
- [canary](#canary)
- [next](#next)
- [makeRelease](#makerelease)
- [afterRelease](#afterrelease)
- [afterShipIt](#aftershipit)
{{TOC}}

## prCheck

Expand Down
12 changes: 5 additions & 7 deletions package.json
Expand Up @@ -36,9 +36,11 @@
"docs:build": "yarn docs:generate && ignite build",
"create:plugin": "./scripts/create-plugin.js",
"create:package": "./scripts/create-package.js",
"install-mac": "yarn lerna run bundle --scope=auto && gunzip -c ./packages/cli/binary/auto-macos.gz > /usr/local/bin/auto"
"install-mac": "yarn lerna run bundle --scope=auto && gunzip -c ./packages/cli/binary/auto-macos.gz > /usr/local/bin/auto",
"postinstall": "patch-package"
},
"devDependencies": {
"@atomictech/rehype-toc": "^3.1.2",
"@fortawesome/fontawesome-svg-core": "^1.2.27",
"@fortawesome/free-solid-svg-icons": "^5.12.1",
"@fortawesome/react-fontawesome": "^0.1.9",
Expand Down Expand Up @@ -66,7 +68,8 @@
"jest-snapshot-serializer-ansi": "^1.0.0",
"lerna": "^3.13.4",
"lint-staged": "^10.0.7",
"next-ignite": "^0.9.16",
"next-ignite": "^0.9.20",
"patch-package": "^6.2.2",
"prettier": "^2.0.1",
"prism-react-renderer": "^1.1.1",
"push-dir": "^0.4.1",
Expand Down Expand Up @@ -128,11 +131,6 @@
}
}
},
"ignite": {
"repo": "intuit/auto",
"name": "auto",
"url": "https://intuit.github.io/auto"
},
"auto": {
"plugins": [
[
Expand Down
13 changes: 13 additions & 0 deletions patches/@atomictech+rehype-toc+3.1.2.patch
@@ -0,0 +1,13 @@
diff --git a/node_modules/@atomictech/rehype-toc/lib/create-toc.js b/node_modules/@atomictech/rehype-toc/lib/create-toc.js
index b576955..fbec54f 100644
--- a/node_modules/@atomictech/rehype-toc/lib/create-toc.js
+++ b/node_modules/@atomictech/rehype-toc/lib/create-toc.js
@@ -120,7 +120,7 @@ function createListItem(heading, options) {
properties: {
className: options_1.buildClass(options.cssClasses.link, heading.tagName),
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- href: `#${heading.properties?.id || ""}`,
+ href: `#${(heading.properties && heading.properties.id) || ""}`,
},
children: [
{
83 changes: 72 additions & 11 deletions yarn.lock
Expand Up @@ -53,16 +53,21 @@
dependencies:
cross-fetch "3.0.6"

"@atomictech/rehype-toc@^3.1.2":
version "3.1.2"
resolved "https://registry.yarnpkg.com/@atomictech/rehype-toc/-/rehype-toc-3.1.2.tgz#62ec993528be26dbf304e1ec0db75ae074d459df"
integrity sha512-ZLqzgBo9WUgXmLpCF8e2rYeHZjJbvWk/3R+mmpKBMDmjYRTb6/Fk6SSGFv0x1aorPwg0OLfg6ZvjAaRbndRPcA==

"@atomist/slack-messages@~1.2.0":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@atomist/slack-messages/-/slack-messages-1.2.1.tgz#74e9499ae2b017cbb0e4f047033b9434cb42c1d7"
integrity sha512-TYiuOxy5Pf9ORn94X/ujl7PY9opIh+l6NzRAV8EBLpIv3IC9gmEoev4wmmyP7Q33J0/nGjqxAaZcq/n2SZrYaQ==

"@auto-it/bot-list@link:packages/bot-list":
version "10.16.1"
version "10.16.2"

"@auto-it/core@link:packages/core":
version "10.16.1"
version "10.16.2"
dependencies:
"@auto-it/bot-list" "link:packages/bot-list"
"@octokit/plugin-enterprise-compatibility" "^1.2.2"
Expand Down Expand Up @@ -102,7 +107,7 @@
url-join "^4.0.0"

"@auto-it/npm@link:plugins/npm":
version "10.16.1"
version "10.16.2"
dependencies:
"@auto-it/core" "link:packages/core"
"@auto-it/package-json-utils" "link:packages/package-json-utils"
Expand All @@ -119,13 +124,13 @@
user-home "^2.0.0"

"@auto-it/package-json-utils@link:packages/package-json-utils":
version "10.16.1"
version "10.16.2"
dependencies:
parse-author "^2.0.0"
parse-github-url "1.0.2"

"@auto-it/released@link:plugins/released":
version "10.16.1"
version "10.16.2"
dependencies:
"@auto-it/bot-list" "link:packages/bot-list"
"@auto-it/core" "link:packages/core"
Expand All @@ -135,7 +140,7 @@
tslib "2.0.3"

"@auto-it/slack@link:plugins/slack":
version "10.16.1"
version "10.16.2"
dependencies:
"@atomist/slack-messages" "~1.2.0"
"@auto-it/core" "link:packages/core"
Expand Down Expand Up @@ -3622,6 +3627,11 @@
resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==

"@yarnpkg/lockfile@^1.1.0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==

"@zkochan/cmd-shim@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@zkochan/cmd-shim/-/cmd-shim-3.1.0.tgz#2ab8ed81f5bb5452a85f25758eb9b8681982fd2e"
Expand Down Expand Up @@ -5849,7 +5859,7 @@ cross-spawn@^5.0.1:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^6.0.0:
cross-spawn@^6.0.0, cross-spawn@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==
Expand Down Expand Up @@ -7517,6 +7527,14 @@ find-versions@^4.0.0:
dependencies:
semver-regex "^3.1.2"

find-yarn-workspace-root@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/find-yarn-workspace-root/-/find-yarn-workspace-root-1.2.1.tgz#40eb8e6e7c2502ddfaa2577c176f221422f860db"
integrity sha512-dVtfb0WuQG+8Ag2uWkbG79hOUzEsRrhBzgfn86g2sJPkzmcpGdghbNTfUKGTxymFrY/tLIodDzLoW9nOJ4FY8Q==
dependencies:
fs-extra "^4.0.3"
micromatch "^3.1.4"

flat-cache@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11"
Expand Down Expand Up @@ -7627,6 +7645,24 @@ fs-constants@^1.0.0:
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==

fs-extra@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-4.0.3.tgz#0d852122e5bc5beb453fb028e9c0c9bf36340c94"
integrity sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9"
integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==
dependencies:
graceful-fs "^4.1.2"
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
Expand Down Expand Up @@ -9908,6 +9944,13 @@ kind-of@^6.0.3:
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd"
integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==

klaw-sync@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/klaw-sync/-/klaw-sync-6.0.0.tgz#1fd2cfd56ebb6250181114f0a581167099c2b28c"
integrity sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==
dependencies:
graceful-fs "^4.1.11"

kleur@^3.0.2:
version "3.0.3"
resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e"
Expand Down Expand Up @@ -10984,10 +11027,10 @@ neo-async@^2.6.2:
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==

next-ignite@^0.9.16:
version "0.9.16"
resolved "https://registry.yarnpkg.com/next-ignite/-/next-ignite-0.9.16.tgz#737c552002ebea283c62c7201a278533a03b5e27"
integrity sha512-8qHcapEUOoFXciXAkIjEI6eWJhkRjNFcbzuEAwpm8+rhGVC1sFrLlb5Ha6aAIKRNgVYFbNtmgRgn5RwsYM8zSA==
next-ignite@^0.9.20:
version "0.9.20"
resolved "https://registry.yarnpkg.com/next-ignite/-/next-ignite-0.9.20.tgz#f8a4f17a87a469f434a26b121e10a0de7322f326"
integrity sha512-BCXYFrCskLli1ILgA5FcKxAaLE2C0BDGhzAsLLWK8enBH4Dq9fkbt11FTbR+nvTFbEUs9nl/zGYQv2k0UAAyFA==
dependencies:
"@babel/helper-call-delegate" "^7.12.1"
"@mapbox/rehype-prism" "^0.4.0"
Expand Down Expand Up @@ -12011,6 +12054,24 @@ pascalcase@^0.1.1:
resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14"
integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=

patch-package@^6.2.2:
version "6.2.2"
resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.2.2.tgz#71d170d650c65c26556f0d0fbbb48d92b6cc5f39"
integrity sha512-YqScVYkVcClUY0v8fF0kWOjDYopzIM8e3bj/RU1DPeEF14+dCGm6UeOYm4jvCyxqIEQ5/eJzmbWfDWnUleFNMg==
dependencies:
"@yarnpkg/lockfile" "^1.1.0"
chalk "^2.4.2"
cross-spawn "^6.0.5"
find-yarn-workspace-root "^1.2.1"
fs-extra "^7.0.1"
is-ci "^2.0.0"
klaw-sync "^6.0.0"
minimist "^1.2.0"
rimraf "^2.6.3"
semver "^5.6.0"
slash "^2.0.0"
tmp "^0.0.33"

path-browserify@0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a"
Expand Down

0 comments on commit 978d6b5

Please sign in to comment.