Skip to content

Commit

Permalink
chore(core): make common configure is sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
NWYLZW committed Aug 20, 2023
1 parent 3bad472 commit cb98374
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 52 deletions.
12 changes: 8 additions & 4 deletions .ppd.client.configure.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { defineConfigure } from '@power-playground/core'
import { HeaderTitle } from './src/components/HeaderTitle'
import { mergeAll } from 'ramda'

export default defineConfigure({
HeaderTitle: HeaderTitle
})
import sharePpdClientConfigure from './.share.ppd.client.configure.ts'

export default mergeAll([
defineConfigure({
}),
sharePpdClientConfigure
])
37 changes: 37 additions & 0 deletions .share.ppd.client.configure.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { defineConfigure } from '@power-playground/core'

import { HeaderTitle } from './src/components/HeaderTitle'
import coverLight from './resources/PP_cover_light.svg'
import coverDark from './resources/PP_cover_dark.svg'

// TODO make picture select by web app inner theme variable
const aboutMDContent = `
<picture>
<source media='(prefers-color-scheme: dark)' srcset='${coverDark}'>
<img alt='Preview Power Playground cover' src='${coverLight}' style='margin: -4px'>
</picture>
## 这是什么?
基于
[<img src='https://microsoft.github.io/monaco-editor/9a60a3b3c5fcf6a9d2de2c28e5eaa986.svg' width='16px' height='16px'> Monaco Editor](https://microsoft.github.io/monaco-editor/) 和
[Chii](https://github.com/liriliri/chii)
构建的代码演练场,在这里你可以编写代码并实时查看运行结果。
通过分享的 URL 的方式将你的代码分享给他人查看,通过这种方式你可以让别人更好的理解你的问题,或者你可以将你的代码分享到社交网络上,让更多的人看到你的作品。
## 想要了解更多?
该 Playground 的源码托管在 [GitHub](https://github.com/power-playground/app) 上,你可以在这里查看源码并提出你的[建议](https://github.com/power-playground/app/issues)。
通过项目中的文档很快的部署好你自己的 Playground ,并且通过自定义插件的方式来扩展与配置你的 Playground 。
`.trim()

export default defineConfigure({
HeaderTitle: HeaderTitle,
plugins: {
about: {
mdContent: aboutMDContent
}
}
})
72 changes: 24 additions & 48 deletions mock/.ppd.client.configure.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { defineConfigure } from '@power-playground/core'
import { mergeAll } from 'ramda'

import sharePpdClientConfigure from '../.share.ppd.client.configure'

import babelVar2const from './babel-plugins/var2const'
import { HeaderTitle } from '../src/components/HeaderTitle'
import coverLight from '../resources/PP_cover_light.svg'
import coverDark from '../resources/PP_cover_dark.svg'

const aTestInitPackage = Object.entries(import.meta.glob([
'./a-test-init-package/**/*'
Expand All @@ -12,50 +12,26 @@ const aTestInitPackage = Object.entries(import.meta.glob([
eager: true
}))

// TODO make picture select by web app inner theme variable
const aboutMDContent = `
<picture>
<source media='(prefers-color-scheme: dark)' srcset='${coverDark}'>
<img alt='Preview Power Playground cover' src='${coverLight}' style='margin: -4px'>
</picture>
## 这是什么?
基于
[<img src='https://microsoft.github.io/monaco-editor/9a60a3b3c5fcf6a9d2de2c28e5eaa986.svg' width='16px' height='16px'> Monaco Editor](https://microsoft.github.io/monaco-editor/) 和
[Chii](https://github.com/liriliri/chii)
构建的代码演练场,在这里你可以编写代码并实时查看运行结果。
通过分享的 URL 的方式将你的代码分享给他人查看,通过这种方式你可以让别人更好的理解你的问题,或者你可以将你的代码分享到社交网络上,让更多的人看到你的作品。
## 想要了解更多?
该 Playground 的源码托管在 [GitHub](https://github.com/power-playground/app) 上,你可以在这里查看源码并提出你的[建议](https://github.com/power-playground/app/issues)。
通过项目中的文档很快的部署好你自己的 Playground ,并且通过自定义插件的方式来扩展与配置你的 Playground 。
`.trim()

export default defineConfigure({
HeaderTitle: HeaderTitle,
plugins: {
about: {
mdContent: aboutMDContent
},
outputs: {
babelTransformOptions: {
presets: ['es2016'],
plugins: [babelVar2const]
export default mergeAll([
defineConfigure({
plugins: {
outputs: {
babelTransformOptions: {
presets: ['es2016'],
plugins: [babelVar2const]
}
},
typescript: {
extraFiles: aTestInitPackage.map(([filePath, content]) => ({
filePath: `file:///${filePath.slice(2)}`,
content
})),
extraModules: aTestInitPackage.map(([filePath, content]) => ({
filePath: filePath.slice(2),
content
}))
}
},
typescript: {
extraFiles: aTestInitPackage.map(([filePath, content]) => ({
filePath: `file:///${filePath.slice(2)}`,
content
})),
extraModules: aTestInitPackage.map(([filePath, content]) => ({
filePath: filePath.slice(2),
content
}))
}
}
})
}),
sharePpdClientConfigure
])
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
"src",
"core",
"mock/.ppd.client.configure.ts",
".ppd.client.configure.ts",
".share.ppd.client.configure.ts",
"vite.config.ts"
]
}

0 comments on commit cb98374

Please sign in to comment.