mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 04:26:30 +08:00
feat: support auto gen and support alias
This commit is contained in:
parent
1e127df4ab
commit
7a2e951474
@ -12,6 +12,8 @@ import GotoAnything from '@/app/components/goto-anything'
|
|||||||
import Zendesk from '@/app/components/base/zendesk'
|
import Zendesk from '@/app/components/base/zendesk'
|
||||||
import Splash from '../components/splash'
|
import Splash from '../components/splash'
|
||||||
import Test from '@edition/test'
|
import Test from '@edition/test'
|
||||||
|
import SubSubIndex from '@edition/sub/sub-sub/index'
|
||||||
|
import SubSub from '@edition/sub/sub-sub'
|
||||||
|
|
||||||
const Layout = ({ children }: { children: ReactNode }) => {
|
const Layout = ({ children }: { children: ReactNode }) => {
|
||||||
return (
|
return (
|
||||||
@ -23,6 +25,8 @@ const Layout = ({ children }: { children: ReactNode }) => {
|
|||||||
<ProviderContextProvider>
|
<ProviderContextProvider>
|
||||||
<ModalContextProvider>
|
<ModalContextProvider>
|
||||||
<Test />
|
<Test />
|
||||||
|
<SubSubIndex />
|
||||||
|
<SubSub />
|
||||||
<HeaderWrapper>
|
<HeaderWrapper>
|
||||||
<Header />
|
<Header />
|
||||||
</HeaderWrapper>
|
</HeaderWrapper>
|
||||||
|
|||||||
0
web/app/edition/saas/sub/sub-c.css
Normal file
0
web/app/edition/saas/sub/sub-c.css
Normal file
12
web/app/edition/saas/sub/sub-sub/index.tsx
Normal file
12
web/app/edition/saas/sub/sub-sub/index.tsx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
'use client'
|
||||||
|
import type { FC } from 'react'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
const SubSub: FC = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
Sub Sub
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default React.memo(SubSub)
|
||||||
0
web/app/edition/saas/sub/sub-sub/sss.tsx
Normal file
0
web/app/edition/saas/sub/sub-sub/sss.tsx
Normal file
0
web/app/edition/saas/sub/sub.ts
Normal file
0
web/app/edition/saas/sub/sub.ts
Normal file
@ -1,4 +1,5 @@
|
|||||||
const { codeInspectorPlugin } = require('code-inspector-plugin')
|
const { codeInspectorPlugin } = require('code-inspector-plugin')
|
||||||
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const withPWA = require('next-pwa')({
|
const withPWA = require('next-pwa')({
|
||||||
dest: 'public',
|
dest: 'public',
|
||||||
@ -88,12 +89,42 @@ const hasSetWebPrefix = process.env.NEXT_PUBLIC_WEB_PREFIX
|
|||||||
const port = process.env.PORT || 3000
|
const port = process.env.PORT || 3000
|
||||||
const locImageURLs = !hasSetWebPrefix ? [new URL(`http://localhost:${port}/**`), new URL(`http://127.0.0.1:${port}/**`)] : []
|
const locImageURLs = !hasSetWebPrefix ? [new URL(`http://localhost:${port}/**`), new URL(`http://127.0.0.1:${port}/**`)] : []
|
||||||
const remoteImageURLs = [hasSetWebPrefix ? new URL(`${process.env.NEXT_PUBLIC_WEB_PREFIX}/**`) : '', ...locImageURLs].filter(item => !!item)
|
const remoteImageURLs = [hasSetWebPrefix ? new URL(`${process.env.NEXT_PUBLIC_WEB_PREFIX}/**`) : '', ...locImageURLs].filter(item => !!item)
|
||||||
const editionPath =
|
|
||||||
process.env.NEXT_PUBLIC_EDITION === 'CLOUD'
|
const isSaaS = process.env.NEXT_PUBLIC_EDITION === 'CLOUD'
|
||||||
? './app/edition/saas/test.tsx'
|
const supportPostfixReg = /\.(ts|tsx|css|svg|jpg|jpeg|png)$/
|
||||||
: './app/edition/community/test.tsx'
|
const editionPaths = (() => {
|
||||||
path.resolve(__dirname, editionPath, '*')
|
const editionDir = `./app/edition/${isSaaS ? 'saas' : 'community'}`
|
||||||
console.log(editionPath)
|
|
||||||
|
const result = {}
|
||||||
|
|
||||||
|
function walk(dir) {
|
||||||
|
const files = fs.readdirSync(dir)
|
||||||
|
for (const file of files) {
|
||||||
|
const fullPath = path.join(dir, file)
|
||||||
|
const stat = fs.statSync(fullPath)
|
||||||
|
if (stat.isDirectory()) {
|
||||||
|
walk(fullPath)
|
||||||
|
} else if (supportPostfixReg.test(file)) {
|
||||||
|
const relPath = path.relative(editionDir, fullPath)
|
||||||
|
const key = `@edition/${relPath.replace(/\\/g, '/')}`.replace(/\.(ts|tsx|css)$/, '')
|
||||||
|
const fullPathWithoutPrefix = `./${fullPath.replace(supportPostfixReg, '')}`
|
||||||
|
result[key] = fullPathWithoutPrefix
|
||||||
|
if (key.endsWith('/index')) {
|
||||||
|
const dirKey = key.replace(/\/index$/, '')
|
||||||
|
result[dirKey] = fullPathWithoutPrefix
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fs.existsSync(editionDir)) {
|
||||||
|
walk(editionDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
})()
|
||||||
|
|
||||||
|
console.log(JSON.stringify(editionPaths, null, 2))
|
||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
@ -103,9 +134,9 @@ const nextConfig = {
|
|||||||
rules: codeInspectorPlugin({
|
rules: codeInspectorPlugin({
|
||||||
bundler: 'turbopack'
|
bundler: 'turbopack'
|
||||||
}),
|
}),
|
||||||
// resolveAlias: {
|
resolveAlias: {
|
||||||
// '@edition/test': editionPath,
|
...editionPaths,
|
||||||
// }
|
}
|
||||||
},
|
},
|
||||||
productionBrowserSourceMaps: false, // enable browser source map generation during the production build
|
productionBrowserSourceMaps: false, // enable browser source map generation during the production build
|
||||||
// Configure pageExtensions to include md and mdx
|
// Configure pageExtensions to include md and mdx
|
||||||
|
|||||||
@ -31,7 +31,8 @@
|
|||||||
"./*"
|
"./*"
|
||||||
],
|
],
|
||||||
"@edition/*": [
|
"@edition/*": [
|
||||||
"./app/edition/community/*"
|
"./app/edition/saas/*",
|
||||||
|
"./app/edition/community/*",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user