diff --git a/README.md b/README.md
index badad7e..aec1cd7 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,6 @@ This repo consists of an [demo app](/apps/web), and the following npm packages:
3. @dsaid/swagger-ui-custom-layout: [source](/packages/swagger-ui-custom-layout), [npm](https://www.npmjs.com/package/@dsaid/swagger-ui-custom-layout)
4. @dsaid/chain-wrap-components: [source](/packages/chain-wrap-components), [npm](https://www.npmjs.com/package/@dsaid/chain-wrap-components)
-
## Prerequisites
- Node.js v18
@@ -26,10 +25,11 @@ $ npm install
Managing the monorepo is done by [turbo](https://turbo.build/repo/docs)
```
-$ turbo run dev # boot up instance, e.g. http://localhost:8090
+$ turbo run dev # boot up instance, e.g. http://localhost:3000
$ turbo run test # run tests for all packages
$ turbo run lint # run lint for all packages
$ turbo run test:watch # run tests in watch mode
+$ turbo run build # run build script for all packages and apps
```
Change logs is managed by [changesets](https://github.com/changesets/changesets).
diff --git a/apps/web/package.json b/apps/web/package.json
index 84d55d1..fe2bb81 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
- "dev": "next dev -- -p 8090",
+ "dev": "next dev -- -p 3000",
"build": "next build",
"start": "next start",
"lint": "next lint"
@@ -12,6 +12,7 @@
"@dsaid/swagger-ui-plugin-otp-auth": "*",
"@dsaid/swagger-ui-plugin-saml-auth": "*",
"@dsaid/swagger-ui-custom-layout": "*",
+ "@dsaid/chain-wrap-components": "*",
"@authenio/samlify-node-xmllint": "^2.0.0",
"@types/jsonwebtoken": "^9.0.1",
"@types/node": "18.15.11",
diff --git a/apps/web/src/pages/index.jsx b/apps/web/src/pages/index.jsx
index 7c9ebda..f9a6e20 100644
--- a/apps/web/src/pages/index.jsx
+++ b/apps/web/src/pages/index.jsx
@@ -3,7 +3,7 @@ import dynamic from 'next/dynamic'
import otpJwtAuthPlugin from '@dsaid/swagger-ui-plugin-otp-auth'
import productLayoutPlugin from '@dsaid/swagger-ui-custom-layout'
import samlAuthPlugin from '@dsaid/swagger-ui-plugin-saml-auth'
-import deepMerge from 'deepmerge'
+import chainWrapComponents from '@dsaid/chain-wrap-components'
// swagger-ui-react is not SSR compatible
const SwaggerUI = dynamic(import('swagger-ui-react'), { ssr: false })
@@ -25,35 +25,3 @@ export default function Home() {
>
)
}
-
-export const chainWrapComponents = (first, ...plugins) => (system) =>
- plugins.reduce((ori, plugin) => {
- const { wrapComponents, ...pluginConfig } = plugin(system)
- const { wrapComponents: oriWrapComponents, ...oriPluginConfig } = ori
-
- return {
-
- wrapComponents: Object.entries(wrapComponents).reduce((merged, [key, wrapComponent]) => {
- const chained = oriWrapComponents?.[key] ?
- (ori, sys) => function Chained(props) {
-
- const First = wrapComponent(ori, sys)
- const Second = oriWrapComponents?.[key](ori, sys)
-
- return <>
- {First && }
- {Second && }
- >
- } : wrapComponent
-
- return {
- ...merged,
- [key]: chained
- }
- }, oriWrapComponents || {}),
-
-
- ...deepMerge(oriPluginConfig, pluginConfig)
- }
- }, first(system))
-
diff --git a/package-lock.json b/package-lock.json
index 665125c..9870af5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -34,6 +34,7 @@
"version": "0.1.0",
"dependencies": {
"@authenio/samlify-node-xmllint": "^2.0.0",
+ "@dsaid/chain-wrap-components": "*",
"@dsaid/swagger-ui-custom-layout": "*",
"@dsaid/swagger-ui-plugin-otp-auth": "*",
"@dsaid/swagger-ui-plugin-saml-auth": "*",
@@ -13405,6 +13406,7 @@
}
},
"packages/swagger-ui-plugin-otp-auth": {
+ "name": "@dsaid/swagger-ui-plugin-otp-auth",
"version": "0.0.1",
"license": "MIT",
"devDependencies": {