Skip to content

Commit

Permalink
feat!: next12, local docs, md/mdx support (#13)
Browse files Browse the repository at this point in the history
This has been a few months in the works and there may be a few new issues here and there, but overall we're very happy to finally release the next major version of the Next Product Docs for Next.js.

The biggest change is the support for "local" docs, in the same repository as the website and/or product itself. This was a requirement for the [Cert-Manager](https://cert-manager.io) docs, where the website and docs are coupled. It also allows a range of combinations. We added support to skip the `root path` to support pure `docs` repositories.

Another breaking change is the move from environment variables to options/props. This was getting a bit out of hand, so we switched to a set of options to configure both the path and props functions. Please see the readme for further information.

We've done our best to test this with previous docs versions, if we missed anything please [open an issue](https://github.com/zentered/next-product-docs/issues/new) and describe the problem.

* feat: use local docs folder
* refactor: esm and improved re-usability for other projects
* fix: overhaul relative links lib and tests, fix variable scope
* fix: relative links with target and trailing slash
* fix: local docs adjustments
* feat: add pnpm link steps
* fix: remove scroll-element and prefix
* fix!: next12 dynamic routing https://nextjs.org/docs/routing/dynamic-routes\#catch-all-routes
* feat!: use options instead of environment variables
* feat: re-add sections
* feat: re-add tabs
* fix: serialization + tests
* chore: update dependencies
* chore: readme adjustments

Co-authored-by: Mo Sattler <[email protected]>

BREAKING CHANGE: the entire library has been refactored to ESM and updated to the latest libraries. Please update with caution.
  • Loading branch information
PatrickHeneise committed Sep 29, 2022
1 parent e342a3f commit cfcb9af
Show file tree
Hide file tree
Showing 44 changed files with 9,234 additions and 9,203 deletions.
10 changes: 6 additions & 4 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"presets": [
["@babel/preset-env", { "targets": { "node": "current" } }],
[
"@babel/preset-react",
"@babel/preset-env",
{
"runtime": "automatic"
"targets": {
"node": "current"
}
}
]
],
"@babel/preset-react"
]
}
8 changes: 2 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
"env": {
"browser": true,
"es2021": true,
"node": true,
"jest": true
},
"globals": {
"jest": true
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:mdx/recommended",
"plugin:jest/recommended"
"plugin:react-hooks/recommended"
],
"parserOptions": {
"ecmaFeatures": {
Expand Down
File renamed without changes
15 changes: 0 additions & 15 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
version: 2
updates:
# Fetch and update latest `npm` packages
- package-ecosystem: npm
directory: '/'
schedule:
interval: monthly
open-pull-requests-limit: 10
commit-message:
prefix: fix
prefix-development: chore
include: scope
# Fetch and update latest `github-actions` pkgs
- package-ecosystem: github-actions
directory: '/'
schedule:
interval: monthly
open-pull-requests-limit: 10
commit-message:
prefix: fix
prefix-development: chore
include: scope
20 changes: 11 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,22 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/[email protected]
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
node-version: 14

version: '${{ inputs.pnpm-version }}'
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
cache: 'pnpm'
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: pnpm install

- name: Test
run: yarn test
# - name: Test
# run: pnpm test

- name: Build
run: yarn build
run: pnpm build

- name: Semantic Release
run: npx semantic-release
Expand Down
29 changes: 10 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,19 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
- uses: actions/checkout@v3
- uses: pnpm/[email protected]
with:
fetch-depth: 0
- uses: actions/setup-node@v2.1.4
version: '${{ inputs.pnpm-version }}'
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://npm.pkg.github.com/
scope: '@opstrace'

node-version: ${{ inputs.node-version }}
cache: 'pnpm'
- name: Install Dependencies
run: yarn install --frozen-lockfile
run: pnpm install

- name: Lint Code Base
uses: github/[email protected]
env:
LINTER_RULES_PATH: /
LOG_LEVEL: 'WARN'
JAVASCRIPT_ES_CONFIG_FILE: .eslintrc.json
VALIDATE_JAVASCRIPT_STANDARD: false
FILTER_REGEX_EXCLUDE: .*husky.*|README.md
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm lint

- name: Test
run: yarn test
# - name: Test
# run: pnpm test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.pnp.js

# testing
/coverage
coverage

# next.js
/.next/
Expand Down
2 changes: 1 addition & 1 deletion .husky/post-merge
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep package.json && yarn install
git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep package.json && pnpm install
12 changes: 12 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
test
.prettierrc
.babelrc
src
.eslint*
.github
coverage
setupTests.js
assets
.husky
.stylelintrc.json
rollup.config.js
3 changes: 0 additions & 3 deletions .stylelintrc.json

This file was deleted.

80 changes: 0 additions & 80 deletions CODE_OF_CONDUCT.md

This file was deleted.

Loading

0 comments on commit cfcb9af

Please sign in to comment.