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

infra: update docs to docusaurus v3 #1864

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 16.16.0
node-version: 18
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image


- name: Installing Dependencies
run: sudo npm install
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ This library is <a href="http://openid.net/certification/#RPs">certified</a> by

You can use the schematics and `ng add` the library.

```
```shell
ng add angular-auth-oidc-client
```

Expand Down Expand Up @@ -122,19 +122,24 @@ export class AppComponent implements OnInit {
constructor(public oidcSecurityService: OidcSecurityService) {}

ngOnInit() {
this.oidcSecurityService.checkAuth().subscribe((loginResponse: LoginResponse) => {
const { isAuthenticated, userData, accessToken, idToken, configId } = loginResponse;

/*...*/
});
this.oidcSecurityService
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is prettier doing the formatting, I can revert if needed.

.checkAuth()
.subscribe((loginResponse: LoginResponse) => {
const { isAuthenticated, userData, accessToken, idToken, configId } =
loginResponse;

/*...*/
});
}

login() {
this.oidcSecurityService.authorize();
}

logout() {
this.oidcSecurityService.logoff().subscribe((result) => console.log(result));
this.oidcSecurityService
.logoff()
.subscribe((result) => console.log(result));
}
}
```
Expand Down
14 changes: 4 additions & 10 deletions docs/site/angular-auth-oidc-client/docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,18 @@ You can either use the schematics with `ng add` or install the lib and add the n

You can use the schematics and `ng add` the library.

```
```bash
ng add angular-auth-oidc-client
```

Step through the wizard and select the appropriate configuration options for you environment. Once the wizard is complete, a module will be created to encapsulate your OIDC configuration. Many of the configured values are placeholders and will need to be adjusted for your individual use case. Once you've confirmed your configuration, the library is ready to use.

### Npm / Yarn
### Npm / Yarn / pnpm

Navigate to the level of your `package.json` and type

```ts
npm install angular-auth-oidc-client
```

or with yarn

```ts
yarn add angular-auth-oidc-client
```bash npm2yarn
npm install angular-auth-oidc-client
```

After installing the library you can get started with the lib like below.
Expand Down
13 changes: 11 additions & 2 deletions docs/site/angular-auth-oidc-client/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = {
favicon: 'img/favicon.ico',
organizationName: 'damienbod', // Usually your GitHub org/user name.
projectName: 'Angular Auth OIDC Client', // Usually your repo name.
markdown: {
format: 'md',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default parses is now mdx2, due to this many compile errors are thrown.
Because we don't make use of it, I changed the default parser to just markdown.

For example, the header in public api forceRefreshSession(customParams?: { ... }, configId?: string) throws an error because it tries to parse the code between the brackets { ... }, because it thinks that this is a JSX block.

You can also verify this using the upgrade checker:

npx docusaurus-mdx-checker

},
themeConfig: {
navbar: {
title: 'Angular Auth OIDC Client Docs',
Expand Down Expand Up @@ -71,7 +74,7 @@ module.exports = {
copyright: `Copyright © ${new Date().getFullYear()} Angular Auth OIDC Client Docs, Inc. Built with Docusaurus.`,
},
prism: {
additionalLanguages: ['typescript'],
additionalLanguages: ['typescript', 'bash', 'json'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v3 removes some default languages. I added the ones that were used in the docs.

},
},
presets: [
Expand All @@ -81,7 +84,13 @@ module.exports = {
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Please change this to your repo.
editUrl: 'https://github.com/damienbod/angular-auth-oidc-client',
editUrl:
'https://github.com/damienbod/angular-auth-oidc-client/edit/main/docs/site/angular-auth-oidc-client',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the current edit functionally redirects the user to a 404, e.g. https://github.com/damienbod/angular-auth-oidc-client/docs/documentation/public-api.md

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

remarkPlugins: [
[require('@docusaurus/remark-plugin-npm2yarn'), { sync: true }],
],
showLastUpdateAuthor: true,
showLastUpdateTime: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I find it useful, I can also revert this if you want

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect, thanks!

},
blog: {
showReadingTime: true,
Expand Down
Loading
Loading