Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: state #9

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0e4a257
feat: use local docs folder instead of git repo
PatrickHeneise Jan 24, 2022
6099f9f
chore: package updates
PatrickHeneise Jan 24, 2022
9950ef5
fix: pkg-dir
PatrickHeneise Jan 24, 2022
d4cefab
feat: esm and improved re-usability for other projects
PatrickHeneise Feb 28, 2022
69f9523
fix: use page.title if set
PatrickHeneise Apr 5, 2022
13f1e2c
fix: another special case with README.md files
PatrickHeneise Apr 13, 2022
6313042
chore: disable broken tests
PatrickHeneise Apr 13, 2022
1f581d4
feat(relative-links): additional cases
PatrickHeneise Apr 26, 2022
9a3c8d2
fix: overhaul relative links lib and tests, fix variable scope
PatrickHeneise Apr 28, 2022
f4fb801
fix: relative links with target and trailing slash, closes #6
PatrickHeneise May 5, 2022
666f7e6
chore: local docs adjustments
PatrickHeneise Sep 12, 2022
df85ec6
chore: wip
PatrickHeneise Sep 12, 2022
401d838
chore: add pnpm link steps
PatrickHeneise Sep 12, 2022
2bdb994
fix: remove scroll-element and prefix
MoSattler Sep 14, 2022
5b6fb26
Merge pull request #7 from zentered/mosattler/wip
PatrickHeneise Sep 19, 2022
6ae5018
test: reactivate
MoSattler Sep 20, 2022
15f4fdb
Merge pull request #8 from zentered/mosattler/wip
PatrickHeneise Sep 20, 2022
31cbf77
chore: version
PatrickHeneise Sep 20, 2022
64a4422
2.0.1-0
PatrickHeneise Sep 20, 2022
777a538
chore: version
PatrickHeneise Sep 20, 2022
402eb70
2.0.0-dev.0
PatrickHeneise Sep 20, 2022
0985573
chore: version
PatrickHeneise Sep 20, 2022
97a7d1d
2.0.0-dev.1
PatrickHeneise Sep 20, 2022
7c80f5b
fix: next12 dynamic routing https://nextjs.org/docs/routing/dynamic-r…
PatrickHeneise Sep 20, 2022
9d5bf9b
2.0.0-dev.2
PatrickHeneise Sep 20, 2022
2160492
feat: use options instead of environment variables
PatrickHeneise Sep 21, 2022
1caa1b9
test: reactivate
MoSattler Sep 20, 2022
a883def
wip: state
MoSattler Sep 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
10 changes: 1 addition & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ jobs:
run: yarn install --frozen-lockfile

- 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: yarn lint

- name: Test
run: yarn 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
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.

61 changes: 51 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="assets/opstrace-docs.png">
<img src=".github/assets/opstrace-docs.png">
</p>

<p align="center">
Expand Down Expand Up @@ -68,14 +68,18 @@ or check out the

In your Next.js website repo, run:

yarn add @opstrace/next-product-docs
npm install @zentered/next-product-docs

or

npm install @opstrace/next-product-docs
yarn add @zentered/next-product-docs

The location of your product docs can be configured through environment
variables in your `.env` file:
variables in your `.env` file. There are two possible ways to retrieve docs:

### Retrieve docs from GitHub Repo

ie. `github.com/zentered/next-product-docs-example/main`

```
GITHUB_TOKEN=
Expand All @@ -84,9 +88,25 @@ DOCS_ORG=zentered
DOCS_REPO=next-product-docs-example
DOCS_BRANCH=main
DOCS_FALLBACK=README
DOCS_SKIP_PATH_PREFIX=false
ASSETS_DESTINATION=/assets
```

### Retrieve docs from local docs folder

ie. `./content/docs`:

```
DOCS_PATH=content
DOCS_FOLDER=docs
DOCS_FALLBACK=README
ASSETS_DESTINATION=
```

### Other options

- `DOCS_USE_MDX`

Create a new page `pages/docs/[[...slug]].jsx` which calls the provided
`staticPaths` and `pageProps` functions:

Expand Down Expand Up @@ -122,13 +142,21 @@ export async function getStaticProps(ctx) {

# Run Locally

## Setup

```bash
npm run watch
# or yarn watch
```
# build dist folder
pnpm build

# create system-wide link to project folder
pnpm link .

Read how to link component in
[next-product-docs-example](https://github.com/zentered/next-product-docs-example)
# in the website/next project folder
pnpm link @zentered/next-product-docs ../next-product-docs

# for continous monitoring in next-product-docs
pnpm watch
```

## Additional Components

Expand All @@ -145,6 +173,19 @@ using `react-scroll` to highlight the current section of the page in the table
of contents. In the sidebar you can easily integrate search for example with
[Algolia React InstantSearch](https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/react/).

### Code Import

You can import code from external files:

```js file=./examples/hello.js

```

This only works when working with a local folder, not by fetching the docs from
a remote repository. Check out
[remark-code-import](https://github.com/kevin940726/remark-code-import) for
further information.

## Contributing

Considering contributing to next-product-docs? We'd love to work with you!
Expand All @@ -156,7 +197,7 @@ on how to link/unlink the component in a Next.js project.
Please join us for
[discussions in our community](https://go.opstrace.com/community).

You can also ping us on Twitter [@opstrace](http://twitter.com/opstrace) or
You can also ping us on Twitter [@zentered](http://twitter.com/opstrace) or
[@zenteredco](http://twitter.com/zenteredco). The only workaround we have at the
moment is forking the repository, publish new package versions to GitHub and
install them in the Next.js project where we use the component.
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/index')
export * from './dist/index.js'
5 changes: 0 additions & 5 deletions jest.config.json

This file was deleted.

Loading