forked from jd-opensource/nutui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
363ff1c
commit 0f8b2ca
Showing
9 changed files
with
259 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ node_modules | |
yarn.lock | ||
package-lock.json | ||
/cache | ||
/src/nutui.ts | ||
|
||
|
||
# local env files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const package = require('../package.json'); | ||
const config = require('../src/config.json'); | ||
const path = require('path'); | ||
const fs = require('fs'); | ||
let importStr = ''; | ||
const packages = []; | ||
config.nav.map(item => { | ||
item.packages.forEach(element => { | ||
let { name, show } = element; | ||
if (show) { | ||
importStr += `import ${name} from '/src/packages/${name.toLowerCase()}/index.vue';\n`; | ||
packages.push(name); | ||
} | ||
}); | ||
}); | ||
let installFunction = ` | ||
function install(app: any) { | ||
const packages = [${packages.join(',')}]; | ||
packages.forEach((item:any) => { | ||
if (item.install) { | ||
app.use(item); | ||
} else if (item.name) { | ||
app.component(item.name, item); | ||
} | ||
}); | ||
} | ||
`; | ||
let fileStr = ` | ||
${importStr} | ||
${installFunction} | ||
export { ${packages.join(',')} }; | ||
export default { install, version:'${package.version}'};`; | ||
fs.writeFile( | ||
path.resolve(__dirname, '../src/nutui.ts'), | ||
fileStr, | ||
'utf8', | ||
error => { | ||
// logger.success(`${package_config_path} 文件写入成功`); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,115 @@ | ||
import { version } from '../package.json'; | ||
const modules = import.meta.globEager('/src/packages/**/index.vue'); | ||
function install(app: any) { | ||
/** webpack */ | ||
// const files = require.context('@/packages', true, /index\.vue$/); | ||
// files.keys().forEach(component => { | ||
// const componentEntity = files(component).default; | ||
// app.component(componentEntity.name, componentEntity); | ||
// }); | ||
import Button from '/src/packages/button/index.vue'; | ||
import Collapse from '/src/packages/collapse/index.vue'; | ||
import Layout from '/src/packages/layout/index.vue'; | ||
import BackTop from '/src/packages/backtop/index.vue'; | ||
import ActionSheet from '/src/packages/actionsheet/index.vue'; | ||
import Toast from '/src/packages/toast/index.vue'; | ||
import Notify from '/src/packages/notify/index.vue'; | ||
import Picker from '/src/packages/picker/index.vue'; | ||
import Cell from '/src/packages/cell/index.vue'; | ||
import Uploader from '/src/packages/uploader/index.vue'; | ||
import Icon from '/src/packages/icon/index.vue'; | ||
import Price from '/src/packages/price/index.vue'; | ||
import Checkbox from '/src/packages/checkbox/index.vue'; | ||
import Swiper from '/src/packages/swiper/index.vue'; | ||
import Avatar from '/src/packages/avatar/index.vue'; | ||
import Popup from '/src/packages/popup/index.vue'; | ||
import Dialog from '/src/packages/dialog/index.vue'; | ||
import Radio from '/src/packages/radio/index.vue'; | ||
import OverLay from '/src/packages/overlay/index.vue'; | ||
import InfiniteLoading from '/src/packages/infiniteloading/index.vue'; | ||
import Range from '/src/packages/range/index.vue'; | ||
import PullRefresh from '/src/packages/pullrefresh/index.vue'; | ||
import Navbar from '/src/packages/navbar/index.vue'; | ||
import Tab from '/src/packages/tab/index.vue'; | ||
import Menu from '/src/packages/menu/index.vue'; | ||
import Tabbar from '/src/packages/tabbar/index.vue'; | ||
import InputNumber from '/src/packages/inputnumber/index.vue'; | ||
import Input from '/src/packages/input/index.vue'; | ||
import Switch from '/src/packages/switch/index.vue'; | ||
import Rate from '/src/packages/rate/index.vue'; | ||
import Calendar from '/src/packages/calendar/index.vue'; | ||
import ShortPassword from '/src/packages/shortpassword/index.vue'; | ||
import Address from '/src/packages/address/index.vue'; | ||
|
||
/** vite */ | ||
for (const key in modules) { | ||
const componentEntity = modules[key]?.default; | ||
app.component(componentEntity.name, componentEntity); | ||
} | ||
function install(app: any) { | ||
const packages = [ | ||
Button, | ||
Collapse, | ||
Layout, | ||
BackTop, | ||
ActionSheet, | ||
Toast, | ||
Notify, | ||
Picker, | ||
Cell, | ||
Uploader, | ||
Icon, | ||
Price, | ||
Checkbox, | ||
Swiper, | ||
Avatar, | ||
Popup, | ||
Dialog, | ||
Radio, | ||
OverLay, | ||
InfiniteLoading, | ||
Range, | ||
PullRefresh, | ||
Navbar, | ||
Tab, | ||
Menu, | ||
Tabbar, | ||
InputNumber, | ||
Input, | ||
Switch, | ||
Rate, | ||
Calendar, | ||
ShortPassword, | ||
Address | ||
]; | ||
packages.forEach((item: any) => { | ||
if (item.install) { | ||
app.use(item); | ||
} else if (item.name) { | ||
app.component(item.name, item); | ||
} | ||
}); | ||
} | ||
export default { install, version }; | ||
|
||
export { | ||
Button, | ||
Collapse, | ||
Layout, | ||
BackTop, | ||
ActionSheet, | ||
Toast, | ||
Notify, | ||
Picker, | ||
Cell, | ||
Uploader, | ||
Icon, | ||
Price, | ||
Checkbox, | ||
Swiper, | ||
Avatar, | ||
Popup, | ||
Dialog, | ||
Radio, | ||
OverLay, | ||
InfiniteLoading, | ||
Range, | ||
PullRefresh, | ||
Navbar, | ||
Tab, | ||
Menu, | ||
Tabbar, | ||
InputNumber, | ||
Input, | ||
Switch, | ||
Rate, | ||
Calendar, | ||
ShortPassword, | ||
Address | ||
}; | ||
export default { install, version: '3.0.0-beta.3' }; |
Oops, something went wrong.