Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit06a577f

Browse files
author
Javier Diaz Chamorro
authored
Merge pull request#8 from coderdiaz/build/remake
Better approach in build process
2 parentse907d62 +ab9f985 commit06a577f

File tree

10 files changed

+2344
-5147
lines changed

10 files changed

+2344
-5147
lines changed

‎.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/dist
2+
/node_modules

‎.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module.exports = {
55
},
66
extends:[
77
'plugin:vue/essential',
8-
'@vue/airbnb',
8+
'airbnb-base',
99
],
1010
rules:{
1111
'no-console':process.env.NODE_ENV==='production' ?'error' :'off',

‎.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language:node_js
22
node_js:
3-
-"8"
4-
-"9"
3+
-8
4+
-10
55
cache:
66
yarn:true
77
directories:

‎babel.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module.exports={
2-
presets:[
3-
'@vue/app',
4-
],
2+
presets:['bili/babel'],
53
};

‎bili.config.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import{Config}from'bili';
2+
3+
constconfig:Config={
4+
input:'index.js',
5+
output:{
6+
moduleName:'VueTinyPagination',
7+
extractCSS:false,
8+
format:['esm','umd','cjs'],
9+
fileName({ format},defaultFileName){
10+
if(format==='esm'){
11+
return'vue-tiny-pagination.esm.js';
12+
}
13+
if(format==='umd'){
14+
return'vue-tiny-pagination.js';
15+
}
16+
if(format==='cjs'){
17+
return'vue-tiny-pagination.cjs.js';
18+
}
19+
returndefaultFileName;
20+
},
21+
sourceMapExcludeSources:true
22+
},
23+
babel:{
24+
minimal:true
25+
},
26+
plugins:{
27+
vue:true,
28+
},
29+
extendConfig(config,{ format}){
30+
if(format==='umd'){
31+
config.output.minify=true;
32+
config.env=Object.assign({},config.env,{
33+
NODE_ENV:'production',
34+
});
35+
}
36+
returnconfig;
37+
},
38+
};
39+
40+
exportdefaultconfig;

‎jest.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ module.exports = {
1010
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$':'jest-transform-stub',
1111
'^.+\\.jsx?$':'babel-jest',
1212
},
13-
moduleNameMapper:{
14-
'^@/(.*)$':'<rootDir>/src/$1',
15-
},
1613
snapshotSerializers:[
1714
'jest-serializer-vue',
1815
],

‎package.json

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"name":"vue-tiny-pagination",
33
"version":"0.3.1",
4+
"productName":"Vue Tiny Pagination",
5+
"description":"A Vue component for create a tiny pagination with Flexbox",
46
"author": {
57
"name":"Javier Diaz Chamorro",
68
"email":"hello@coderdiaz.me",
@@ -9,14 +11,19 @@
911
"license":"MIT",
1012
"private":false,
1113
"scripts": {
12-
"build":"rollup --config rollup.config.js",
13-
"lint":"vue-cli-service lint",
14-
"test:unit":"vue-cli-service test:unit",
15-
"prepare":"yarn test:unit && yarn build"
14+
"build":"bili",
15+
"lint":"eslint -c .eslintrc.js . --ext .js,.vue",
16+
"test:unit":"jest",
17+
"prepare":"yarnlint && yarntest:unit && yarn build"
1618
},
17-
"main":"dist/vue-tiny-pagination.umd.js",
19+
"main":"dist/vue-tiny-pagination.cjs.js",
1820
"module":"dist/vue-tiny-pagination.esm.js",
19-
"unpkg":"dist/vue-tiny-pagination.min.js",
21+
"unpkg":"dist/vue-tiny-pagination.js",
22+
"jsdelivr":"dist/vue-tiny-pagination.js",
23+
"cdn":"dist/vue-tiny-pagination.js",
24+
"files": [
25+
"dist"
26+
],
2027
"repository": {
2128
"type":"git",
2229
"url":"git+https://github.com/coderdiaz/vue-tiny-pagination.git"
@@ -35,24 +42,31 @@
3542
"small",
3643
"component"
3744
],
45+
"husky": {
46+
"hooks": {
47+
"pre-commit":"yarn lint"
48+
}
49+
},
3850
"dependencies": {
39-
"vue":"^2.5.17"
51+
"vue":"^2.6.10"
4052
},
4153
"devDependencies": {
42-
"@vue/cli-plugin-babel":"^3.0.5",
43-
"@vue/cli-plugin-eslint":"^3.0.5",
44-
"@vue/cli-plugin-unit-jest":"^3.0.5",
45-
"@vue/cli-service":"^3.0.5",
46-
"@vue/eslint-config-airbnb":"^3.0.5",
47-
"@vue/test-utils":"^1.0.0-beta.20",
54+
"@vue/test-utils":"^1.0.0-beta.29",
4855
"babel-core":"7.0.0-bridge.0",
49-
"babel-jest":"^23.0.1",
56+
"babel-eslint":"^10.0.1",
57+
"babel-jest":"^24.7.1",
58+
"bili":"^4.7.3",
59+
"eslint":"^5.16.0",
60+
"eslint-config-airbnb-base":"^13.1.0",
61+
"eslint-plugin-import":"^2.16.0",
62+
"eslint-plugin-vue":"^5.2.2",
63+
"husky":"^1.3.1",
64+
"jest":"^24.7.1",
65+
"jest-serializer-vue":"^2.0.2",
66+
"jest-transform-stub":"^2.0.0",
5067
"node-sass":"^4.9.0",
51-
"rollup":"^1.8.0",
52-
"rollup-plugin-commonjs":"^9.2.3",
53-
"rollup-plugin-terser":"^4.0.4",
5468
"rollup-plugin-vue":"^4.7.2",
55-
"sass-loader":"^7.0.1",
56-
"vue-template-compiler":"^2.5.17"
69+
"vue-jest":"^3.0.4",
70+
"vue-template-compiler":"^2.6.10"
5771
}
5872
}

‎packages/TinyPagination/src/main.vue

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,25 @@
22
<divclass="vue-tiny-pagination">
33
<ulclass="tiny-pagination":class="customClass">
44
<liclass="page-item":class="classFirstPage">
5-
<aclass="btn-prev-page"href="#"@click.prevent="lastPage">{{translation.prev}}</a>
5+
<aclass="btn-prev-page"href="#"@click.prevent="lastPage">{{translation.prev}}</a>
66
</li>
77
<liclass="page-item">
8-
<span>{{titlePage}}</span>
8+
<span>{{titlePage}}</span>
99
</li>
1010
<liclass="page-item":class="classLastPage">
11-
<aclass="btn-next-page"href="#"@click.prevent="nextPage">{{translation.next}}</a>
11+
<aclass="btn-next-page"href="#"@click.prevent="nextPage">{{translation.next}}</a>
1212
</li>
1313
<liv-if="showLimit"class="page-item">
14-
<selectclass="tiny-form-select"v-model="currentLimit"@change="onLimitChange">
14+
<selectv-model="currentLimit"class="tiny-form-select"@change="onLimitChange">
1515
<option
1616
v-for="(limit, index) in limits"
17-
:value="limit"
18-
:key="index">{{limit}}/{{translation.title}}</option>
17+
:key="index"
18+
:value="limit">{{limit}}/{{translation.title}}</option>
1919
</select>
2020
</li>
2121
</ul>
2222
</div>
2323
</template>
24-
2524
<script>
2625
exportdefault {
2726
name:'TinyPagination',
@@ -40,19 +39,20 @@ export default {
4039
},
4140
customClass: {
4241
type:String,
42+
default:'',
4343
},
4444
limits: {
4545
type:Array,
46-
default() {
46+
default() {
4747
return [10,15,20,50,100];
4848
},
4949
},
5050
showLimit: {
5151
type:Boolean,
5252
default:true,
53-
}
53+
},
5454
},
55-
data() {
55+
data() {
5656
return {
5757
version:'0.3.1',
5858
currentPage:1,
@@ -67,73 +67,73 @@ export default {
6767
prev:'Anterior',
6868
title:'Página',
6969
next:'Siguiente',
70-
}
70+
},
7171
},
7272
availableLanguages: ['en','es'],
7373
};
7474
},
75-
created () {
76-
this.currentPage=this.page
77-
},
7875
computed: {
79-
translation() {
80-
return (this.availableLanguages.includes(this.lang))?
81-
this.translations[this.lang]
82-
:this.translations['en']
76+
translation() {
77+
return (this.availableLanguages.includes(this.lang))
78+
?this.translations[this.lang]
79+
:this.translations.en;
8380
},
84-
totalPages() {
85-
returnMath.ceil(this.total/this.currentLimit)
81+
totalPages() {
82+
returnMath.ceil(this.total/this.currentLimit);
8683
},
87-
titlePage() {
88-
return`${this.translation.title}${this.currentPage}`
84+
titlePage() {
85+
return`${this.translation.title}${this.currentPage}`;
8986
},
90-
classFirstPage() {
87+
classFirstPage() {
9188
return {
9289
disabled: (this.currentPage===1),
93-
'c-not-allowed':true
94-
}
90+
'c-not-allowed':true,
91+
};
9592
},
96-
classLastPage() {
93+
classLastPage() {
9794
return {
9895
disabled: (this.currentPage===this.totalPages),
99-
'c-not-allowed':true
100-
}
101-
}
96+
'c-not-allowed':true,
97+
};
98+
},
99+
},
100+
watch: {
101+
currentPage(value) {
102+
this.$emit('tiny:change-page', {
103+
page: value,
104+
});
105+
},
106+
currentLimit(value) {
107+
this.$emit('tiny:change-limit', {
108+
limit: value,
109+
});
110+
},
111+
},
112+
created() {
113+
this.currentPage=this.page;
102114
},
103115
methods: {
104-
nextPage() {
116+
nextPage() {
105117
if (this.currentPage!==this.totalPages) {
106-
this.currentPage+=1
118+
this.currentPage+=1;
107119
}
108120
},
109-
lastPage() {
121+
lastPage() {
110122
if (this.currentPage>1) {
111-
this.currentPage-=1
123+
this.currentPage-=1;
112124
}
113125
},
114-
onLimitChange () {
115-
this.currentPage=1
116-
}
117-
},
118-
watch: {
119-
currentPage (value) {
120-
this.$emit('tiny:change-page', {
121-
page: value
122-
})
126+
onLimitChange() {
127+
this.currentPage=1;
123128
},
124-
currentLimit (value) {
125-
this.$emit('tiny:change-limit', {
126-
limit: value
127-
})
128-
}
129-
}
130-
}
129+
},
130+
};
131131
</script>
132-
133132
<style lang="scss">
134133
// Pagination
134+
$apple-fonts:-apple-system,system-ui, BlinkMacSystemFont;
135135
.tiny-pagination {
136-
font-family:-apple-system,system-ui, BlinkMacSystemFont,"Segoe UI", Roboto,"Helvetica Neue",sans-serif;
136+
font-family:$apple-fonts,"Segoe UI", Roboto,"Helvetica Neue",sans-serif;
137137
display:flex;
138138
list-style:none;
139139
margin:.2rem0;
@@ -218,4 +218,4 @@ export default {
218218
padding-right:1.2rem;
219219
}
220220
}
221-
</style>
221+
</style>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp