mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-23 13:31:06 +08:00
site: fix codesandbox demo with extra deps
This commit is contained in:
parent
c0ba6ec088
commit
c1da705868
@ -50,12 +50,22 @@ app.use(naive);
|
||||
app.mount("#app");
|
||||
`
|
||||
|
||||
function getDeps (code) {
|
||||
return (code.match(/from '([^']+)'\n/g) || [])
|
||||
.map((v) => v.slice(6, v.length - 2))
|
||||
.reduce((prevV, dep) => {
|
||||
prevV[dep] = 'latest'
|
||||
return prevV
|
||||
}, {})
|
||||
}
|
||||
|
||||
export function getCodeSandboxParams (code) {
|
||||
return getParameters({
|
||||
files: {
|
||||
'package.json': {
|
||||
content: {
|
||||
dependencies: {
|
||||
...getDeps(code),
|
||||
vue: 'next',
|
||||
'naive-ui': 'latest'
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user