Compare commits

...

6 Commits

Author SHA1 Message Date
Joel
bc691464a2 feat: new tsconfig switch 2025-11-14 14:57:56 +08:00
Joel
d444fa1c70 just add 2025-11-14 10:53:34 +08:00
Joel
b3a4721815 feat: support import img by alias 2025-11-13 18:13:28 +08:00
Joel
4637435e42 feat: test is support css 2025-11-13 17:23:22 +08:00
Joel
7a2e951474 feat: support auto gen and support alias 2025-11-13 17:14:01 +08:00
Joel
1e127df4ab chore 2025-11-13 14:53:41 +08:00
16 changed files with 172 additions and 2 deletions

View File

@@ -11,6 +11,9 @@ import { ModalContextProvider } from '@/context/modal-context'
import GotoAnything from '@/app/components/goto-anything'
import Zendesk from '@/app/components/base/zendesk'
import Splash from '../components/splash'
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 }) => {
return (
@@ -21,6 +24,9 @@ const Layout = ({ children }: { children: ReactNode }) => {
<EventEmitterContextProvider>
<ProviderContextProvider>
<ModalContextProvider>
<Test />
<SubSubIndex />
<SubSub />
<HeaderWrapper>
<Header />
</HeaderWrapper>

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.6665 2.66683C11.2865 2.66683 11.5965 2.66683 11.8508 2.73498C12.541 2.91991 13.0801 3.45901 13.265 4.14919C13.3332 4.40352 13.3332 4.71352 13.3332 5.3335V11.4668C13.3332 12.5869 13.3332 13.147 13.1152 13.5748C12.9234 13.9511 12.6175 14.2571 12.2412 14.4488C11.8133 14.6668 11.2533 14.6668 10.1332 14.6668H5.8665C4.7464 14.6668 4.18635 14.6668 3.75852 14.4488C3.3822 14.2571 3.07624 13.9511 2.88449 13.5748C2.6665 13.147 2.6665 12.5869 2.6665 11.4668V5.3335C2.6665 4.71352 2.6665 4.40352 2.73465 4.14919C2.91959 3.45901 3.45868 2.91991 4.14887 2.73498C4.4032 2.66683 4.71319 2.66683 5.33317 2.66683M5.99984 10.0002L7.33317 11.3335L10.3332 8.3335M6.39984 4.00016H9.59984C9.9732 4.00016 10.1599 4.00016 10.3025 3.9275C10.4279 3.86359 10.5299 3.7616 10.5938 3.63616C10.6665 3.49355 10.6665 3.30686 10.6665 2.9335V2.40016C10.6665 2.02679 10.6665 1.84011 10.5938 1.6975C10.5299 1.57206 10.4279 1.47007 10.3025 1.40616C10.1599 1.3335 9.97321 1.3335 9.59984 1.3335H6.39984C6.02647 1.3335 5.83978 1.3335 5.69718 1.40616C5.57174 1.47007 5.46975 1.57206 5.40583 1.6975C5.33317 1.84011 5.33317 2.02679 5.33317 2.40016V2.9335C5.33317 3.30686 5.33317 3.49355 5.40583 3.63616C5.46975 3.7616 5.57174 3.86359 5.69718 3.9275C5.83978 4.00016 6.02647 4.00016 6.39984 4.00016Z" stroke="#1D2939" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,21 @@
.bg {
background-color: red;
}
.bgImg {
background-repeat: no-repeat;
background-repeat: left center;
background-image: url(~@/app/components/develop/secret-key/assets/play.svg);
}
.bgCopied {
background-repeat: no-repeat;
background-repeat: left center;
background-image: url(../copied.svg);
}
.bgCopied2 {
background-repeat: no-repeat;
background-repeat: left center;
background-image: url(~@edition/copied.svg);
}

View File

@@ -0,0 +1,13 @@
'use client'
import type { FC } from 'react'
import React from 'react'
import s from '../sub-c.module.css'
const SubSub: FC = () => {
return (
<div className={s.bg}>
Sub Sub
</div>
)
}
export default React.memo(SubSub)

View File

View File

@@ -0,0 +1,10 @@
'use client'
import type { FC } from 'react'
import React from 'react'
const Test: FC = () => {
return (
<div>Community</div>
)
}
export default React.memo(Test)

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.6665 2.66683C11.2865 2.66683 11.5965 2.66683 11.8508 2.73498C12.541 2.91991 13.0801 3.45901 13.265 4.14919C13.3332 4.40352 13.3332 4.71352 13.3332 5.3335V11.4668C13.3332 12.5869 13.3332 13.147 13.1152 13.5748C12.9234 13.9511 12.6175 14.2571 12.2412 14.4488C11.8133 14.6668 11.2533 14.6668 10.1332 14.6668H5.8665C4.7464 14.6668 4.18635 14.6668 3.75852 14.4488C3.3822 14.2571 3.07624 13.9511 2.88449 13.5748C2.6665 13.147 2.6665 12.5869 2.6665 11.4668V5.3335C2.6665 4.71352 2.6665 4.40352 2.73465 4.14919C2.91959 3.45901 3.45868 2.91991 4.14887 2.73498C4.4032 2.66683 4.71319 2.66683 5.33317 2.66683M5.99984 10.0002L7.33317 11.3335L10.3332 8.3335M6.39984 4.00016H9.59984C9.9732 4.00016 10.1599 4.00016 10.3025 3.9275C10.4279 3.86359 10.5299 3.7616 10.5938 3.63616C10.6665 3.49355 10.6665 3.30686 10.6665 2.9335V2.40016C10.6665 2.02679 10.6665 1.84011 10.5938 1.6975C10.5299 1.57206 10.4279 1.47007 10.3025 1.40616C10.1599 1.3335 9.97321 1.3335 9.59984 1.3335H6.39984C6.02647 1.3335 5.83978 1.3335 5.69718 1.40616C5.57174 1.47007 5.46975 1.57206 5.40583 1.6975C5.33317 1.84011 5.33317 2.02679 5.33317 2.40016V2.9335C5.33317 3.30686 5.33317 3.49355 5.40583 3.63616C5.46975 3.7616 5.57174 3.86359 5.69718 3.9275C5.83978 4.00016 6.02647 4.00016 6.39984 4.00016Z" stroke="#1D2939" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,21 @@
.bg {
background-color: red;
}
.bgImg {
background-repeat: no-repeat;
background-repeat: left center;
background-image: url(~@/app/components/develop/secret-key/assets/play.svg);
}
.bgCopied {
background-repeat: no-repeat;
background-repeat: left center;
background-image: url(../copied.svg);
}
.bgCopied2 {
background-repeat: no-repeat;
background-repeat: left center;
background-image: url(~@edition/copied.svg);
}

View File

@@ -0,0 +1,13 @@
'use client'
import type { FC } from 'react'
import React from 'react'
import s from '../sub-c.module.css'
const SubSub: FC = () => {
return (
<div className={s.bg}>
Sub Sub
</div>
)
}
export default React.memo(SubSub)

View File

View File

View File

@@ -0,0 +1,16 @@
'use client'
import type { FC } from 'react'
import React from 'react'
import s from '@edition/sub/sub-c.module.css'
import cn from '@/utils/classnames'
const Test: FC = () => {
return (
<>
<div className={cn(s.bgImg, 'pl-4')}>SaaS</div>
<div className={cn(s.bgCopied, 'pl-4')}>Copied</div>
<div className={cn(s.bgCopied2, 'pl-4')}>Import svg use alias</div>
</>
)
}
export default React.memo(Test)

View File

@@ -1,4 +1,6 @@
const { codeInspectorPlugin } = require('code-inspector-plugin')
const fs = require('fs')
const path = require('path')
const withPWA = require('next-pwa')({
dest: 'public',
register: true,
@@ -88,6 +90,43 @@ const port = process.env.PORT || 3000
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 isSaaS = process.env.NEXT_PUBLIC_EDITION === 'CLOUD'
console.log(isSaaS)
const supportPostfixReg = /\.(ts|tsx|css|svg|jpg|jpeg|png)$/
const editionPaths = (() => {
const editionDir = `./app/edition/${isSaaS ? 'saas' : 'community'}`
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(supportPostfixReg, '')
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} */
const nextConfig = {
basePath: process.env.NEXT_PUBLIC_BASE_PATH || '',
@@ -95,7 +134,10 @@ const nextConfig = {
turbopack: {
rules: codeInspectorPlugin({
bundler: 'turbopack'
})
}),
// resolveAlias: {
// ...editionPaths,
// }
},
productionBrowserSourceMaps: false, // enable browser source map generation during the production build
// Configure pageExtensions to include md and mdx
@@ -125,6 +167,7 @@ const nextConfig = {
typescript: {
// https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
ignoreBuildErrors: true,
tsconfigPath: isSaaS ? 'tsconfig.json' : 'tsconfig.ce.json',
},
reactStrictMode: true,
async redirects() {

13
web/tsconfig.ce.json Normal file
View File

@@ -0,0 +1,13 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"paths": {
"@edition/*": [
"./app/edition/community/*"
],
"~@edition/*": [
"./app/edition/community/*"
]
}
}
}

View File

@@ -29,7 +29,15 @@
],
"~@/*": [
"./*"
]
],
"@edition/*": [
"./app/edition/saas/*",
"./app/edition/community/*",
],
"~@edition/*": [
"./app/edition/saas/*",
"./app/edition/community/*",
],
}
},
"include": [