Skip to content

Commit f67329a

Browse files
committed
build: add dist
1 parent 7be0a1a commit f67329a

File tree

10 files changed

+51
-9
lines changed

10 files changed

+51
-9
lines changed

build/build.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const fs = require('fs-extra')
2+
const path = require('path')
3+
const dist = path.join(__dirname, '../dist')
4+
const lib = path.join(__dirname, '../lib')
5+
fs.removeSync(dist)
6+
fs.removeSync(lib)
7+
8+
require('./compiler')

build/compiler.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const tsConfig = path.resolve(__dirname, '../tsconfig.json')
99
const exampleDir = path.resolve(__dirname, '../example/dist')
1010
const isProduction = process.env.NODE_ENV === 'production'
1111
const src = path.join(__dirname, '../src')
12+
const esDir = path.resolve(__dirname, '../dist')
1213

1314
// less
1415
const compileLess = dist => () =>
@@ -35,17 +36,10 @@ const compileTs = (dist, config) => () => {
3536

3637
const copy = (dist, ext) => () => gulp.src(`${src}/**/*.${ext}`).pipe(gulp.dest(dist))
3738

38-
const compile = (dist, config) =>
39-
gulp.parallel(
40-
compileTs(dist, config),
41-
compileLess(dist),
42-
copy(dist, 'wxml'),
43-
copy(dist, 'wxs'),
44-
copy(dist, 'json')
45-
);
39+
const compile = (dist, config) => gulp.parallel(compileTs(dist, config), compileLess(dist), copy(dist, 'wxml'), copy(dist, 'wxs'), copy(dist, 'json'))
4640

4741
if (isProduction) {
48-
// TODO
42+
gulp.series(compile(esDir))()
4943
} else {
5044
compile(exampleDir)()
5145

dist/mp-loading/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

dist/mp-loading/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Component({
2+
properties: {
3+
size: {
4+
type: Number,
5+
value: 30
6+
},
7+
color: {
8+
type: String,
9+
value: '#1890ff'
10+
},
11+
showTip: {
12+
type: Boolean,
13+
value: false
14+
},
15+
tip: {
16+
type: String,
17+
value: '加载中...'
18+
}
19+
}
20+
});

dist/mp-loading/index.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"component": true
3+
}

dist/mp-loading/index.wxml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<View class='spin-dot-wrap'>
2+
<View class='spin-dot-wrap-rotate' style="width: {{ size }}px; height: {{ size }}px">
3+
<block wx:for="{{[1,2,3,4]}}" wx:key="{{item}}">
4+
<View class='spin-dot-item' style="width: {{ size/2 - 2}}px; height: {{ size/2 - 2}}px ;background-color: {{color}};" />
5+
</block>
6+
</View>
7+
<block wx:if="{{showTip}}">
8+
<view class="spin-tip" style="color: {{color}}">{{tip}}</view>
9+
</block>
10+
</View>

dist/mp-loading/index.wxss

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.spin-dot-wrap{display:inline-block;text-align:center;vertical-align:middle}.spin-dot-wrap .spin-dot-wrap-rotate{display:inline-block;height:100%;-webkit-transform:rotate(45deg);transform:rotate(45deg);-webkit-animation:rotate 1.2s linear infinite;animation:rotate 1.2s linear infinite}.spin-dot-wrap .spin-dot-wrap-rotate .spin-dot-item{position:absolute;border-radius:100%;opacity:.3;-webkit-transform:scale(.75);transform:scale(.75);-webkit-animation:spinMove .3s linear infinite alternate;animation:spinMove .3s linear infinite alternate}.spin-dot-wrap .spin-dot-wrap-rotate .spin-dot-item:first-child{top:0;left:0}.spin-dot-wrap .spin-dot-wrap-rotate .spin-dot-item:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.spin-dot-wrap .spin-dot-wrap-rotate .spin-dot-item:nth-child(3){bottom:0;left:0;-webkit-animation-delay:.8s;animation-delay:.8s}.spin-dot-wrap .spin-dot-wrap-rotate .spin-dot-item:nth-child(4){right:0;bottom:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}.spin-dot-wrap .spin-tip{margin-top:6px;text-align:center;font-size:14px}@-webkit-keyframes spinMove{to{opacity:1}}@keyframes spinMove{to{opacity:1}}@-webkit-keyframes rotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes rotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}

dist/temp/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

dist/temp/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// TODO

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "1.0.0",
44
"description": "loading component for Mini Program",
55
"miniprogram": "dist",
6+
"files": [
7+
"dist"
8+
],
69
"dependencies": {},
710
"devDependencies": {
811
"autoprefixer": "^9.6.1",

0 commit comments

Comments
 (0)