Skip to content

Commit

Permalink
bump v0.0.111
Browse files Browse the repository at this point in the history
  • Loading branch information
airyland committed Apr 23, 2016
1 parent d7bb9ee commit 4e8435a
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 31 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,8 @@ npm run dev
</template>

<script>
import { Group, Cell } from 'vux'
// or you can import the components you need
// by this way, you can reduce webpack bundle size
import Group from 'vux/components/group/'
import Cell from 'vux/components/cell/'
import Group from 'vux/components/group'
import Cell from 'vux/components/cell'
export default {
components: {
Expand Down
31 changes: 25 additions & 6 deletions build/build-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

var path = require('path')
var fs = require('fs')
var Spinner = require('cli-spinner').Spinner
var webpack = require('webpack')
var ExtractTextPlugin = require('extract-text-webpack-plugin')
var HtmlWebpackPlugin = require('html-webpack-plugin')
Expand Down Expand Up @@ -113,21 +112,30 @@ if (list) {
build('date-formatter', '../src/components/datetime/format')
build('friendly-time', '../src/filters/friendly-time')
build('inview', '../src/directives/inview')

// multi entry
var list = require('./components')
list.multi_entry.forEach(function (one) {
build(one, `../src/components/${one}/${one}`)
build(`${one}-item`, `../src/components/${one}/${one}-item`)
})
}

var number = 0
function build (name, _path) {
let spinner = new Spinner(`building ${name}`)
spinner.setSpinnerString('←↖↑↗→↘↓↙')
spinner.start()
let _name = name
let file = _path || `../src/components/${name}/index`
let _start = new Date().getTime()
config.entry = {}
config.entry[name] = [path.resolve(__dirname, file)]
config.output.library = converName(name)
config.output.path = path.resolve(__dirname, '../components/' + name + '/')
webpack(config, function(err, stats) {
var jsonStats = stats.toJson()
spinner.setSpinnerString(stats.endTime - stats.startTime)
spinner.stop()
var assets = jsonStats.assets[0]
var offset = Math.round((new Date().getTime() - _start)/1000)
var index = ++number
console.log(`[${index < 10 ? ('0' + index) : index}] `, addWhiteSpace(`${offset}s`, 10), addWhiteSpace(_name, 18), `${(_name, assets.size/1024).toFixed(2)}k`)
if (err) {
throw err
}
Expand All @@ -142,4 +150,15 @@ function converName (name) {
return ('vux-' + name).split('-').map(function(one, index) {
return index === 0 ? one : capitalizeFirstLetter(one)
}).join('')
}

function addWhiteSpace (str, number) {
if (str.length < number) {
var rs = str
for( var i = 0; i < number - str.length; i++) {
rs += ' '
}
return rs
}
return str
}
7 changes: 7 additions & 0 deletions build/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"multi_entry": [
"button-tab",
"timeline",
"tabbar"
]
}
1 change: 1 addition & 0 deletions components/button-tab-item/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/button-tab/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/button-tab/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/panel/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion components/tab-item/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/tabbar-item/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4e8435a

Please sign in to comment.