Skip to content

Commit

Permalink
chore: prepare patternhub to use static assets provided by react show…
Browse files Browse the repository at this point in the history
…case (#2342)
  • Loading branch information
nmerget authored Apr 11, 2024
1 parent cbab6b1 commit 945cc18
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 30 deletions.
4 changes: 3 additions & 1 deletion showcases/patternhub/components/default-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ const DefaultPage = ({ children }: any) => {
onToggle={setDrawerOpen}
slotBrand={
<DBBrand
imgSrc="https://db-ui.github.io/images/db_logo.svg"
imgSrc={`${
process.env.NEXT_PUBLIC_BASE_PATH ?? ''
}/assets/images/db_logo.svg`}
title={process.env.NEXT_PUBLIC_APP_NAME}
anchorChildren>
{process.env.NEXT_PUBLIC_APP_NAME}
Expand Down
27 changes: 0 additions & 27 deletions showcases/patternhub/components/src/tsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion showcases/patternhub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"compile:03_copy-docs": "cpr ../../docs ./public/docs -o",
"compile:04_components": "node scripts/esbuild-generate.mjs",
"compile:05_run": "node generated.js",
"compile:06_replace_base": "node scripts/fix-base-path.js",
"dev": "cross-env NEXT_PUBLIC_BASE_PATH=/mono/sub npm-run-all compile -p open next:dev",
"lint": "next lint",
"next:dev": "next dev",
"next:start": "next start",
"open": "open-cli http://localhost:3000/mono/sub",
"prebuild:app": "cpr ../../node_modules/iframe-resizer/js/ public/iframe-resizer -o",
"start": "cross-env NEXT_PUBLIC_BASE_PATH=/mono/sub npm-run-all compile next:dev"
Expand Down
2 changes: 1 addition & 1 deletion showcases/patternhub/public/site.webmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "",
"icons": [
{
"src": "/images/db_logo.svg",
"src": "/assets/images/db_logo.svg",
"type": "image/svg",
"sizes": "192x192"
}
Expand Down
8 changes: 8 additions & 0 deletions showcases/patternhub/scripts/fix-base-path.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Replace from 'replace-in-file';

const option = {
files: './pages/components/**/*.tsx',
from: 'import.meta.env.BASE_URL',
to: 'process.env.NEXT_PUBLIC_BASE_PATH'
};
Replace.replaceInFileSync(option);

0 comments on commit 945cc18

Please sign in to comment.