Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Commit

Permalink
add github npm scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvin committed May 10, 2023
1 parent 7f38f23 commit 4ec1a88
Show file tree
Hide file tree
Showing 18 changed files with 107 additions and 68 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# swagger-ui-plugins-monorepo

This repo consists of an [demo app](/apps/web), and the following npm packages:
1. swagger-ui-plugin-otp-auth: [source](/packages/swagger-ui-plugin-otp-auth), [npm](https://www.npmjs.com/package/swagger-ui-plugin-otp-auth)
2. swagger-ui-plugin-saml-auth: [source](/packages/swagger-ui-plugin-saml-auth), [npm](https://www.npmjs.com/package/swagger-ui-plugin-saml-auth)
3. swagger-ui-custom-layout: [source](/packages/swagger-ui-custom-layout), [npm](https://www.npmjs.com/package/swagger-ui-custom-layout)
4. chain-wrap-components: [source](/packages/chain-wrap-components), [npm](https://www.npmjs.com/package/chain-wrap-components)
1. @dsaidgovsg/swagger-ui-plugin-otp-auth: [source](/packages/swagger-ui-plugin-otp-auth), [npm](https://github.com/dsaidgovsg/lswagger-ui-preset/pkgs/npm/swagger-ui-plugin-otp-auth)
2. @dsaidgovsg/swagger-ui-plugin-saml-auth: [source](/packages/swagger-ui-plugin-saml-auth), [npm](https://github.com/dsaidgovsg/lswagger-ui-preset/pkgs/npm/swagger-ui-plugin-saml-auth)
3. @dsaidgovsg/swagger-ui-custom-layout: [source](/packages/swagger-ui-custom-layout), [npm](https://github.com/dsaidgovsg/lswagger-ui-preset/pkgs/npm/swagger-ui-custom-layout)
4. @dsaidgovsg/chain-wrap-components: [source](/packages/chain-wrap-components), [npm](https://github.com/dsaidgovsg/lswagger-ui-preset/pkgs/npm/chain-wrap-components)

## Prerequisites

Expand Down
8 changes: 4 additions & 4 deletions apps/web/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# next-swagger-ui-plugins-demo

This repo demostrates use of swagger-ui plugins for:
1. swagger-ui-plugin-otp-auth: [source](/packages/swagger-ui-plugin-otp-auth), [npm](https://www.npmjs.com/package/swagger-ui-plugin-otp-auth)
2. swagger-ui-plugin-saml-auth: [source](/packages/swagger-ui-plugin-saml-auth), [npm](https://www.npmjs.com/package/swagger-ui-plugin-saml-auth)
3. swagger-ui-custom-layout: [source](/packages/swagger-ui-custom-layout), [npm](https://www.npmjs.com/package/swagger-ui-custom-layout)
4. chain-wrap-components: [source](/packages/chain-wrap-components), [npm](https://www.npmjs.com/package/chain-wrap-components)
1. @dsaidgovsg/swagger-ui-plugin-otp-auth: [source](/packages/swagger-ui-plugin-otp-auth), [npm](https://github.com/dsaidgovsg/lswagger-ui-preset/pkgs/npm/swagger-ui-plugin-otp-auth)
2. @dsaidgovsg/swagger-ui-plugin-saml-auth: [source](/packages/swagger-ui-plugin-saml-auth), [npm](https://github.com/dsaidgovsg/lswagger-ui-preset/pkgs/npm/swagger-ui-plugin-saml-auth)
3. @dsaidgovsg/swagger-ui-custom-layout: [source](/packages/swagger-ui-custom-layout), [npm](https://github.com/dsaidgovsg/lswagger-ui-preset/pkgs/npm/swagger-ui-custom-layout)
4. @dsaidgovsg/chain-wrap-components: [source](/packages/chain-wrap-components), [npm](https://github.com/dsaidgovsg/lswagger-ui-preset/pkgs/npm/chain-wrap-components)

It also consists the following mock APIs:
- [Mock SAML API](/apps/web/src/pages/api/auth/saml) implemetation with [MockSaml](https://mocksaml.com/).
Expand Down
8 changes: 4 additions & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"lint": "next lint"
},
"dependencies": {
"swagger-ui-plugin-otp-auth": "*",
"swagger-ui-plugin-saml-auth": "*",
"swagger-ui-custom-layout": "*",
"chain-wrap-components": "*",
"@dsaidgovsg/swagger-ui-plugin-otp-auth": "*",
"@dsaidgovsg/swagger-ui-plugin-saml-auth": "*",
"@dsaidgovsg/swagger-ui-custom-layout": "*",
"@dsaidgovsg/chain-wrap-components": "*",
"@authenio/samlify-node-xmllint": "^2.0.0",
"@types/jsonwebtoken": "^9.0.1",
"@types/node": "18.15.11",
Expand Down
8 changes: 4 additions & 4 deletions apps/web/src/pages/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

import dynamic from 'next/dynamic'
import otpJwtAuthPlugin from 'swagger-ui-plugin-otp-auth'
import productLayoutPlugin from 'swagger-ui-custom-layout'
import samlAuthPlugin from 'swagger-ui-plugin-saml-auth'
import chainWrapComponents from 'chain-wrap-components'
import otpJwtAuthPlugin from '@dsaidgovsg/swagger-ui-plugin-otp-auth'
import productLayoutPlugin from '@dsaidgovsg/swagger-ui-custom-layout'
import samlAuthPlugin from '@dsaidgovsg/swagger-ui-plugin-saml-auth'
import chainWrapComponents from '@dsaidgovsg/chain-wrap-components'

// swagger-ui-react is not SSR compatible
const SwaggerUI = dynamic(import('swagger-ui-react'), { ssr: false })
Expand Down
17 changes: 8 additions & 9 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,26 @@
margin: 0;
background: #fafafa;
}

</style>
<script type="importmap">
{
"imports": {
"react": "https://unpkg.com/@esm-bundle/react/esm/react.production.min.js",
"react/jsx-runtime": "./react-jsx-runtime.js",
"swagger-ui-custom-layout": "/packages/swagger-ui-custom-layout/dist/index.mjs",
"swagger-ui-plugin-otp-auth": "/packages/swagger-ui-plugin-otp-auth/dist/index.mjs",
"swagger-ui-plugin-saml-auth": "/packages/swagger-ui-plugin-saml-auth/dist/index.mjs",
"chain-wrap-components": "/packages/chain-wrap-components/dist/index.mjs"
"@dsaidgovsg/swagger-ui-custom-layout": "/packages/swagger-ui-custom-layout/dist/index.mjs",
"@dsaidgovsg/swagger-ui-plugin-otp-auth": "/packages/swagger-ui-plugin-otp-auth/dist/index.mjs",
"@dsaidgovsg/swagger-ui-plugin-saml-auth": "/packages/swagger-ui-plugin-saml-auth/dist/index.mjs",
"@dsaidgovsg/chain-wrap-components": "/packages/chain-wrap-components/dist/index.mjs"
}
}
</script>
<script crossorigin src="https://unpkg.com/[email protected]/swagger-ui-bundle.js"> </script>

<script type="module">
import productLayoutPlugin from "swagger-ui-custom-layout";
import otpJwtAuthPlugin from 'swagger-ui-plugin-otp-auth';
import samlAuthPlugin from 'swagger-ui-plugin-saml-auth';
import chainWrapComponents from 'chain-wrap-components';
import productLayoutPlugin from "@dsaidgovsg/swagger-ui-custom-layout";
import otpJwtAuthPlugin from '@dsaidgovsg/swagger-ui-plugin-otp-auth';
import samlAuthPlugin from '@dsaidgovsg/swagger-ui-plugin-saml-auth';
import chainWrapComponents from '@dsaidgovsg/chain-wrap-components';

window.onload = function () {

Expand Down
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/chain-wrap-components/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# chain-wrap-components
# @dsaidgovsg/chain-wrap-components

## 0.0.3

Expand Down
20 changes: 15 additions & 5 deletions packages/chain-wrap-components/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# chain-wrap-components [![npm version](https://badge.fury.io/js/@dsaid%2Fchain-wrap-components.svg)](https://badge.fury.io/js/@dsaid%2Fchain-wrap-components)
# @dsaidgovsg/chain-wrap-components

This provides a helper function for [Swagger UI](https://swagger.io/docs/open-source-tools/swagger-ui/customization/plugin-api/), it allows:

Expand All @@ -13,16 +13,26 @@ This provides a helper function for [Swagger UI](https://swagger.io/docs/open-so

## Install

Add github npm registry to `.npmrc`,

```sh
# .npmrc
always-auth = true
@dsaidgovsg:registry=https://npm.pkg.github.com
```

Install the package,

```sh
$ npm install chain-wrap-components
$ npm install @dsaidgovsg/chain-wrap-components
```

## Usage

```javascript
import otpAuthPlugin from 'swagger-ui-plugin-otp-auth'
import samlAuthPlugin from 'swagger-ui-plugin-saml-auth'
import chainWrapComponents from 'chain-wrap-components'
import otpAuthPlugin from '@dsaidgovsg/swagger-ui-plugin-otp-auth'
import samlAuthPlugin from '@dsaidgovsg/swagger-ui-plugin-saml-auth'
import chainWrapComponents from '@dsaidgovsg/chain-wrap-components'

// swagger-ui initialization
SwaggerUI({
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-wrap-components/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "chain-wrap-components",
"name": "@dsaidgovsg/chain-wrap-components",
"version": "0.0.3",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/swagger-ui-custom-layout/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# swagger-ui-custom-layout
# @dsaidgovsg/swagger-ui-custom-layout

## 0.0.3

Expand Down
16 changes: 13 additions & 3 deletions packages/swagger-ui-custom-layout/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# swagger-ui-custom-layout [![npm version](https://badge.fury.io/js/@dsaid%2Fswagger-ui-custom-layout.svg)](https://badge.fury.io/js/@dsaid%2Fswagger-ui-custom-layout)
# @dsaidgovsg/swagger-ui-custom-layout

This is a custom layout plugin for [Swagger UI](https://swagger.io/docs/open-source-tools/swagger-ui/customization/plugin-api/).

Expand All @@ -10,14 +10,24 @@ This is a custom layout plugin for [Swagger UI](https://swagger.io/docs/open-sou

## Install

Add github npm registry to `.npmrc`,

```sh
# .npmrc
always-auth = true
@dsaidgovsg:registry=https://npm.pkg.github.com
```

Install the package,

```sh
$ npm install swagger-ui-custom-layout
$ npm install @dsaidgovsg/swagger-ui-custom-layout
```

## Usage

```javascript
import customLayoutPlugin from 'swagger-ui-custom-layout'
import customLayoutPlugin from '@dsaidgovsg/swagger-ui-custom-layout'

// swagger-ui initialization
SwaggerUI({
Expand Down
2 changes: 1 addition & 1 deletion packages/swagger-ui-custom-layout/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "swagger-ui-custom-layout",
"name": "@dsaidgovsg/swagger-ui-custom-layout",
"version": "0.0.3",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/swagger-ui-plugin-otp-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# swagger-ui-plugin-otp-auth
# @dsaidgovsg/swagger-ui-plugin-otp-auth

## 0.0.3

Expand Down
16 changes: 13 additions & 3 deletions packages/swagger-ui-plugin-otp-auth/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# swagger-ui-plugin-otp-auth [![npm version](https://badge.fury.io/js/@dsaid%2Fswagger-ui-plugin-otp-auth.svg)](https://badge.fury.io/js/@dsaid%2Fswagger-ui-plugin-otp-auth)
# @dsaidgovsg/swagger-ui-plugin-otp-auth

This is a OTP authentication plugin for [Swagger UI](https://swagger.io/docs/open-source-tools/swagger-ui/customization/plugin-api/).

Expand All @@ -10,14 +10,24 @@ This is a OTP authentication plugin for [Swagger UI](https://swagger.io/docs/ope

## Install

Add github npm registry to `.npmrc`,

```sh
# .npmrc
always-auth = true
@dsaidgovsg:registry=https://npm.pkg.github.com
```

Install the package,

```sh
$ npm install swagger-ui-plugin-otp-auth
$ npm install @dsaidgovsg/swagger-ui-plugin-otp-auth
```

## Usage

```javascript
import OtpAuthPlugin from 'swagger-ui-plugin-otp-auth'
import OtpAuthPlugin from '@dsaidgovsg/swagger-ui-plugin-otp-auth'

// swagger-ui initialization
SwaggerUI({
Expand Down
2 changes: 1 addition & 1 deletion packages/swagger-ui-plugin-otp-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "swagger-ui-plugin-otp-auth",
"name": "@dsaidgovsg/swagger-ui-plugin-otp-auth",
"version": "0.0.3",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/swagger-ui-plugin-saml-auth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# swagger-ui-plugin-saml-auth
# @dsaidgovsg/swagger-ui-plugin-saml-auth

## 0.0.3

Expand Down
Loading

0 comments on commit 4ec1a88

Please sign in to comment.