diff --git a/README-zh_CN.md b/README-zh_CN.md index f0b823e854..ad101e0786 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -10,6 +10,7 @@ ## 特性 * 全新的架构 +* 40+ 高质量组件 * 30+ 京东移动端项目正在使用 * 参照京东APP 7.0 视觉规范 * 支持按需加载 diff --git a/README.md b/README.md index 164cfed81f..a5b7eb9ac2 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ English | [简体中文](./README-zh_CN.md) ## Features * New structure +* 40+ Reusable components * Used by 30+ JD mobile projects * Refer to JD APP 7.0 visual specification * On-demand loading Support diff --git a/docs/intro.md b/docs/intro.md index 3064f699a3..b92d8527f5 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -14,6 +14,7 @@ NutUI是一套京东风格的移动端Vue组件库,开发和服务于移动Web ## 特性 +* 40+ 高质量组件 * 30+ 京东移动端项目正在使用 * 基于京东APP 7.0 视觉规范 * 支持按需加载 diff --git a/package.json b/package.json index 75d95854ca..54f783166d 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "vue": "^2.6.10", "vue-i18n": "8.1.0", "vue-jest": "2.6.0", - "vue-lazyload": "1.3.3", + "vue-lazyload": "^1.3.3", "vue-loader": "15.4.0", "vue-router": "^3.0.2", "vue-style-loader": "^4.1.2", @@ -162,4 +162,4 @@ "instrument": false, "sourceMap": false } -} \ No newline at end of file +} diff --git a/scripts/mdToVue.js b/scripts/mdToVue.js index ac365a45ac..429994242f 100644 --- a/scripts/mdToVue.js +++ b/scripts/mdToVue.js @@ -6,6 +6,7 @@ let { version } = require("../package.json"); let marked = require('marked'); let contrast = require('./contrast'); let rimraf = require("rimraf"); +let Chokidar = require('chokidar'); if (!marked) { console.log('you need npm i marked -D!'); } @@ -33,6 +34,7 @@ class mdVue{ _that.needHandleFiles = res; _that.ishasOutFile(_that.options.output).then(res=>{ _that.star(); + _that.filelisten() }); }) }) @@ -59,6 +61,37 @@ class mdVue{ } apply(){} + filelisten(){ + let _that = this; + let watcher = Chokidar.watch(_that.options.entry,{ + persistent: true, + usePolling: true, + }); + let log = console.dir.bind(console); + let watchAction = function({event, eventPath}){ + // 这里进行文件更改后的操作 + // fileReadStar(eventPath,(res)=>{ + // createdFile(param.output + res.mdName + '.vue', res.html, param.needCode) + // }) + console.log(path.join(__dirname,JSON.stringify(eventPath))) + if(/\.md$/.test(eventPath)){ + _that.vueDesWrite(eventPath) + } + // "d:\workplace\nutui\docs\international.md" + // _that.read(eventPath).then(res=>{ + // _that.headHandle(); + // _that.markHandle(); + // let html = _that.marked(res); + // _that.write({ + // outsrc:_that.options.output, + // name:fileName + '.vue', + // html:html + // }); + // }) + } + watcher.on('change', path => watchAction({event: 'change', eventPath: path})) + .on('unlink', path => watchAction({event: 'remove', eventPath: path})); + } star(){ let _that = this; hashElement(_that.options.entry, { @@ -68,43 +101,73 @@ class mdVue{ }).then(hash => { nodeFilelist.read([_that.options.entry],{"ext":'md'}, res => { - res.map((item,index) =>{ - if(index == 30){ - debugger - } - let fileSplits = item.path.split(path.sep); - let fileName = fileSplits.pop(); - if(_that.isDoc(fileName)){ - fileName = fileSplits.pop(); - }else{ - fileName = fileName.replace(/\.md/,''); - } - if(_that.needHandleFiles[fileName]){ - // _that.read(item.path).then(res=>{ - // _that.headHandle(); - // _that.markHandle(); - // let html = _that.marked(res); - // _that.write({ - // outsrc:_that.options.output, - // name:fileName + '.vue', - // html:html - // }); - // }) - } - _that.read(item.path).then(res=>{ - _that.headHandle(); - _that.markHandle(); - let html = _that.marked(res); - _that.write({ - outsrc:_that.options.output, - name:fileName + '.vue', - html:html - }); - }) + res.map((item,index) =>{ + _that.vueDesWrite(item.path) + // let fileSplits = item.path.split(path.sep); + // let fileName = fileSplits.pop(); + // if(_that.isDoc(fileName)){ + // fileName = fileSplits.pop(); + // }else{ + // fileName = fileName.replace(/\.md/,''); + // } + // if(_that.needHandleFiles[fileName]){ + // // _that.read(item.path).then(res=>{ + // // _that.headHandle(); + // // _that.markHandle(); + // // let html = _that.marked(res); + // // _that.write({ + // // outsrc:_that.options.output, + // // name:fileName + '.vue', + // // html:html + // // }); + // // }) + // } + // _that.read(item.path).then(res=>{ + // _that.headHandle(); + // _that.markHandle(); + // let html = _that.marked(res); + // _that.write({ + // outsrc:_that.options.output, + // name:fileName + '.vue', + // html:html + // }); + // }) }); }); }) } + vueDesWrite(getpath){ + let _that = this; + let fileSplits = getpath.split(path.sep); + let fileName = fileSplits.pop(); + if(_that.isDoc(fileName)){ + fileName = fileSplits.pop(); + }else{ + fileName = fileName.replace(/\.md/,''); + } + if(_that.needHandleFiles[fileName]){ + // _that.read(item.path).then(res=>{ + // _that.headHandle(); + // _that.markHandle(); + // let html = _that.marked(res); + // _that.write({ + // outsrc:_that.options.output, + // name:fileName + '.vue', + // html:html + // }); + // }) + } + _that.read(getpath).then(res=>{ + _that.headHandle(); + _that.markHandle(); + let html = _that.marked(res); + _that.write({ + outsrc:_that.options.output, + name:fileName + '.vue', + html:html + }); + }) + } isDoc(name){ return (name == "doc.md") ? true : false; } diff --git a/sites/demo/view/index.vue b/sites/demo/view/index.vue index 31d8e98488..fb2dcffcb3 100644 --- a/sites/demo/view/index.vue +++ b/sites/demo/view/index.vue @@ -3,7 +3,7 @@ Github
-一套京东风格的移动端Vue组件库
单个按钮
多个按钮