Skip to content
This repository was archived by the owner on Jul 20, 2021. It is now read-only.

Commit 4d6c0f2

Browse files
committed
update to v1.1.0
1 parent b55d7f8 commit 4d6c0f2

38 files changed

+487
-287
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ module.exports = {
2323
'generator-star-spacing': 0,
2424
// allow debugger during development
2525
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
26-
'comma-dangle': ['warn', 'always'],
26+
// allow comma dangle only multiline
27+
'comma-dangle': ['error', 'only-multiline'],
2728
}
2829
}

.npmignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: node_js
2+
node_js: stable
3+
4+
# S: Build Lifecycle
5+
install:
6+
- npm install
7+
8+
script:
9+
- npm run build-docs
10+
11+
after_success:
12+
- cd ./gh-pages
13+
- git init
14+
- git config user.name "meteorlxy"
15+
- git config user.email "meteor.lxy@foxmail.com"
16+
- git add .
17+
- git commit -m "Build docs $(date +%Y%m%d%H%M)"
18+
- git push --force --quiet "https://${GH_TOKEN}@${GH_REPO}" master:gh-pages
19+
# E: Build LifeCycle
20+
21+
branches:
22+
only:
23+
- master
24+

README.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,51 @@
11
# vue-bs-pagination
22

3+
[![build status](https://www.travis-ci.org/meteorlxy/vue-bs-pagination.svg?branch=master)](https://www.travis-ci.org/meteorlxy/vue-bs-pagination)
4+
[![npm version](https://badge.fury.io/js/vue-bs-pagination.svg)](https://badge.fury.io/js/vue-bs-pagination)
5+
36
> A very simple vue component - bootstrap pagination
47
5-
[Demo and Usage](https://meteorlxy.github.io/vue-bs-pagination/)
8+
[Live Demo](https://meteorlxy.github.io/vue-bs-pagination/)
9+
10+
---
11+
12+
## Get started
613

7-
## Usage
14+
### Import
815

9-
### Get start
16+
#### Build tools
1017

11-
#### Import via `npm`
18+
Import via `npm`
1219

1320
```bash
1421
npm install --save vue-bs-pagination
1522
```
1623

17-
#### Register component
24+
Register component
1825

1926
```js
2027
import Vue from 'vue'
2128
import VuePagination from 'vue-bs-pagination'
22-
Vue.component('v-pagination', VuePagination)
29+
Vue.component('VuePagination', VuePagination)
2330
```
2431

25-
#### Template
32+
#### Browser
33+
34+
Import via `<script>` tag
2635

2736
```html
28-
<v-pagination :total="10" v-model="page"></v-pagination>
37+
<script src="path/to/dist/vue-bs-pagination.js"></script>
2938
```
3039

31-
#### Stylesheet
40+
### Usage
41+
42+
Template
43+
44+
```html
45+
<vue-pagination :total="10" v-model="page"></vue-pagination>
46+
```
47+
48+
Stylesheet
3249

3350
> Use `Bootstrap 3` or `Bootstrap 4.0-beta`
3451
@@ -47,20 +64,17 @@ props: {
4764
}
4865
```
4966

67+
---
5068

51-
## Develop
69+
## Developing & Contributing
5270

5371
``` bash
5472
# install dependencies
5573
npm install
5674

5775
# serve with hot reload at localhost:8080
5876
npm run dev
59-
60-
# build for production with minification
61-
npm run build
62-
63-
# build for production and view the bundle analyzer report
64-
npm run build --report
6577
```
6678

79+
- `/src/components` the source file of `vue-bs-pagination` component
80+
- `/src/docs` the source file of [github-pages](https://meteorlxy.github.io/vue-bs-pagination/) of this project

build/build.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1+
'use strict'
12
require('./check-versions')()
23

34
process.env.NODE_ENV = 'production'
45

5-
var ora = require('ora')
6-
var rm = require('rimraf')
7-
var path = require('path')
8-
var chalk = require('chalk')
9-
var webpack = require('webpack')
10-
var config = require('../config')
11-
var isDocs = process.argv.indexOf('--docs') > 0
12-
var webpackConfig = isDocs ? require('./webpack.docs.conf') : require('./webpack.prod.conf')
13-
var config = isDocs ? config.docs : config.build
6+
const ora = require('ora')
7+
const rm = require('rimraf')
8+
const path = require('path')
9+
const chalk = require('chalk')
10+
const webpack = require('webpack')
11+
const isDocs = process.argv.indexOf('--docs') > 0
12+
const config = isDocs ? require('../config').docs : require('../config').build
13+
const webpackConfig = isDocs ? require('./webpack.docs.conf') : require('./webpack.prod.conf')
1414

15-
var spinner = ora('building for production...')
15+
const spinner = ora('building for production...')
1616
spinner.start()
1717

1818
rm(path.join(config.assetsRoot, config.assetsSubDirectory), err => {

build/check-versions.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
var chalk = require('chalk')
2-
var semver = require('semver')
3-
var packageConfig = require('../package.json')
4-
var shell = require('shelljs')
1+
'use strict'
2+
const chalk = require('chalk')
3+
const semver = require('semver')
4+
const packageConfig = require('../package.json')
5+
const shell = require('shelljs')
56
function exec (cmd) {
67
return require('child_process').execSync(cmd).toString().trim()
78
}
89

9-
var versionRequirements = [
10+
const versionRequirements = [
1011
{
1112
name: 'node',
1213
currentVersion: semver.clean(process.version),
@@ -23,9 +24,9 @@ if (shell.which('npm')) {
2324
}
2425

2526
module.exports = function () {
26-
var warnings = []
27-
for (var i = 0; i < versionRequirements.length; i++) {
28-
var mod = versionRequirements[i]
27+
const warnings = []
28+
for (let i = 0; i < versionRequirements.length; i++) {
29+
const mod = versionRequirements[i]
2930
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
3031
warnings.push(mod.name + ': ' +
3132
chalk.red(mod.currentVersion) + ' should be ' +
@@ -38,8 +39,8 @@ module.exports = function () {
3839
console.log('')
3940
console.log(chalk.yellow('To use this template, you must update following to modules:'))
4041
console.log()
41-
for (var i = 0; i < warnings.length; i++) {
42-
var warning = warnings[i]
42+
for (let i = 0; i < warnings.length; i++) {
43+
const warning = warnings[i]
4344
console.log(' ' + warning)
4445
}
4546
console.log()

build/dev-client.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable */
2+
'use strict'
23
require('eventsource-polyfill')
34
var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true')
45

build/dev-server.js

Lines changed: 51 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,55 @@
1+
'use strict'
12
require('./check-versions')()
23

3-
var config = require('../config')
4+
const config = require('../config')
45
if (!process.env.NODE_ENV) {
56
process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV)
67
}
78

8-
var opn = require('opn')
9-
var path = require('path')
10-
var express = require('express')
11-
var webpack = require('webpack')
12-
var proxyMiddleware = require('http-proxy-middleware')
13-
var webpackConfig = require('./webpack.dev.conf')
9+
const opn = require('opn')
10+
const path = require('path')
11+
const express = require('express')
12+
const webpack = require('webpack')
13+
const proxyMiddleware = require('http-proxy-middleware')
14+
const webpackConfig = require('./webpack.dev.conf')
1415

1516
// default port where dev server listens for incoming traffic
16-
var port = process.env.PORT || config.dev.port
17+
const port = process.env.PORT || config.dev.port
1718
// automatically open browser, if not set will be false
18-
var autoOpenBrowser = !!config.dev.autoOpenBrowser
19+
const autoOpenBrowser = !!config.dev.autoOpenBrowser
1920
// Define HTTP proxies to your custom API backend
2021
// https://github.com/chimurai/http-proxy-middleware
21-
var proxyTable = config.dev.proxyTable
22+
const proxyTable = config.dev.proxyTable
2223

23-
var app = express()
24-
var compiler = webpack(webpackConfig)
24+
const app = express()
25+
const compiler = webpack(webpackConfig)
2526

26-
var devMiddleware = require('webpack-dev-middleware')(compiler, {
27+
const devMiddleware = require('webpack-dev-middleware')(compiler, {
2728
publicPath: webpackConfig.output.publicPath,
2829
quiet: true
2930
})
3031

31-
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
32+
const hotMiddleware = require('webpack-hot-middleware')(compiler, {
3233
log: false,
3334
heartbeat: 2000
3435
})
3536
// force page reload when html-webpack-plugin template changes
36-
compiler.plugin('compilation', function (compilation) {
37-
compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
38-
hotMiddleware.publish({ action: 'reload' })
39-
cb()
40-
})
41-
})
37+
// currently disabled until this is resolved:
38+
// https://github.com/jantimon/html-webpack-plugin/issues/680
39+
// compiler.plugin('compilation', function (compilation) {
40+
// compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
41+
// hotMiddleware.publish({ action: 'reload' })
42+
// cb()
43+
// })
44+
// })
45+
46+
// enable hot-reload and state-preserving
47+
// compilation error display
48+
app.use(hotMiddleware)
4249

4350
// proxy api requests
4451
Object.keys(proxyTable).forEach(function (context) {
45-
var options = proxyTable[context]
52+
let options = proxyTable[context]
4653
if (typeof options === 'string') {
4754
options = { target: options }
4855
}
@@ -55,33 +62,41 @@ app.use(require('connect-history-api-fallback')())
5562
// serve webpack bundle output
5663
app.use(devMiddleware)
5764

58-
// enable hot-reload and state-preserving
59-
// compilation error display
60-
app.use(hotMiddleware)
61-
6265
// serve pure static assets
63-
var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
66+
const staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory)
6467
app.use(staticPath, express.static('./static'))
6568

66-
var uri = 'http://localhost:' + port
69+
const uri = 'http://localhost:' + port
6770

6871
var _resolve
69-
var readyPromise = new Promise(resolve => {
72+
var _reject
73+
var readyPromise = new Promise((resolve, reject) => {
7074
_resolve = resolve
75+
_reject = reject
7176
})
7277

78+
var server
79+
var portfinder = require('portfinder')
80+
portfinder.basePort = port
81+
7382
console.log('> Starting dev server...')
7483
devMiddleware.waitUntilValid(() => {
75-
console.log('> Listening at ' + uri + '\n')
76-
// when env is testing, don't need open it
77-
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
78-
opn(uri)
79-
}
80-
_resolve()
84+
portfinder.getPort((err, port) => {
85+
if (err) {
86+
_reject(err)
87+
}
88+
process.env.PORT = port
89+
var uri = 'http://localhost:' + port
90+
console.log('> Listening at ' + uri + '\n')
91+
// when env is testing, don't need open it
92+
if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') {
93+
opn(uri)
94+
}
95+
server = app.listen(port)
96+
_resolve()
97+
})
8198
})
8299

83-
var server = app.listen(port)
84-
85100
module.exports = {
86101
ready: readyPromise,
87102
close: () => {

0 commit comments

Comments
 (0)