更新部署机制

This commit is contained in:
Julyp
2020-01-31 19:39:40 +08:00
parent 7bc2f8818c
commit a7d4ae92ab
12 changed files with 174 additions and 284 deletions

View File

@@ -24,7 +24,7 @@
## Usage ## Usage
- 加载UI库<br> - 加载UI库<br>
Download the minified library [smartTable.min.js](https://github.com/peng92055/smart-table/tree/master/dist/smartTable.min.js), and include it in your webpage. Download the minified library [smartTable.min.js](https://peng92055.github.io/smart-table/smartTable.min.js), and include it in your webpage.
```html ```html
/* smartTable library */ /* smartTable library */
<script type="text/javascript" src="js/smartTable.min.js"></script> <script type="text/javascript" src="js/smartTable.min.js"></script>

View File

@@ -1,14 +1,5 @@
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = { module.exports = {
entry: './src/index.js', entry: './src/index.js',
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../public/index.html'),
inject: 'head'
})
],
module: { module: {
rules: [{ rules: [{
test: /\.scss$/, test: /\.scss$/,
@@ -22,10 +13,6 @@ module.exports = {
} }
} }
] ]
}, ] }]
}, }
output: {
filename: 'smartTable.min.js',
path: path.resolve(__dirname, '../dist')
},
} }

View File

@@ -1,9 +1,17 @@
const path = require('path');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const common = require('./webpack.common.js'); const common = require('./webpack.common.js');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = merge(common, { module.exports = merge(common, {
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../examples/index.html'),
inject: 'head'
})
],
devtool: 'inline-source-map', devtool: 'inline-source-map',
devServer: { devServer: {
contentBase: './dist' contentBase: './examples'
} }
}); });

27
config/webpack.example.js Normal file
View File

@@ -0,0 +1,27 @@
const path = require('path');
const merge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const {
CleanWebpackPlugin
} = require('clean-webpack-plugin');
const common = require('./webpack.common.js');
module.exports = merge(common, {
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin([{
from: "examples/assets",
to: "assets"
}]),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, '../examples/index.html'),
inject: 'head'
})
],
output: {
filename: 'smartTable.min.js',
path: path.resolve(__dirname, '../docs')
},
});

View File

@@ -1,11 +1,17 @@
const path = require('path');
const merge = require('webpack-merge'); const merge = require('webpack-merge');
const { const {
CleanWebpackPlugin CleanWebpackPlugin
} = require('clean-webpack-plugin'); } = require('clean-webpack-plugin');
const common = require('./webpack.common.js'); const common = require('./webpack.common.js');
module.exports = merge(common, { module.exports = merge(common, {
plugins: [ plugins: [
new CleanWebpackPlugin() new CleanWebpackPlugin()
] ],
}); output: {
filename: 'smartTable.min.js',
path: path.resolve(__dirname, '../dist')
},
});

View File

@@ -2,9 +2,9 @@
set -e set -e
npm run build npm run example
cd dist cd examples
git init git init
git config user.name 'pengyajun' git config user.name 'pengyajun'

BIN
docs/assets/js-table.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@@ -5,6 +5,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="icon" href="./assets/fav.ico">
<title>Smart Example</title> <title>Smart Example</title>
<style> <style>
@@ -50,6 +52,7 @@
<thead> <thead>
<tr> <tr>
<th colspan="1" rowspan="3" fixed sort>Id</th> <th colspan="1" rowspan="3" fixed sort>Id</th>
<th colspan="1" rowspan="3" fixed sort>Logo</th>
<th colspan="1" rowspan="2" width="200" fixed>日期</th> <th colspan="1" rowspan="2" width="200" fixed>日期</th>
<th colspan="1" rowspan="2" width="100" sort>姓名</th> <th colspan="1" rowspan="2" width="100" sort>姓名</th>
<th colspan="1" width="100" rowspan="1">省份</th> <th colspan="1" width="100" rowspan="1">省份</th>
@@ -61,33 +64,17 @@
<tbody> <tbody>
<tr> <tr>
<td>12</td> <td>12</td>
<td><img src="./assets/js-table.png" /></td>
<td>2020-01-03</td> <td>2020-01-03</td>
<td>1王小虎</td> <td>1王小虎</td>
<td>1上海</td> <td>1上海</td>
<td>2长宁区</td> <td>2长宁区</td>
<td>3上海市长宁区淞虹路888号<img src="//hbimg.huabanimg.com/e3ebdd150746bf9e5ce4c6b057c1e5541c11721b84efd-PN5wmF_fw658" /></td> <td>3上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>13</td>
<td>2020-02-03</td>
<td>2王小虎</td>
<td>3上海</td>
<td>4长宁区</td>
<td>2上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>14</td>
<td>2020-03-03</td>
<td>3王小虎</td>
<td>4上海</td>
<td>1长宁区</td>
<td>6上海市长宁区淞虹路888号</td>
<td>200331</td> <td>200331</td>
</tr> </tr>
<tr> <tr>
<td>13</td> <td>13</td>
<td><img src="./assets/js-table.png" /></td>
<td>2020-02-03</td> <td>2020-02-03</td>
<td>2王小虎</td> <td>2王小虎</td>
<td>3上海</td> <td>3上海</td>
@@ -97,6 +84,27 @@
</tr> </tr>
<tr> <tr>
<td>14</td> <td>14</td>
<td><img src="./assets/js-table.png" /></td>
<td>2020-03-03</td>
<td>3王小虎</td>
<td>4上海</td>
<td>1长宁区</td>
<td>6上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>15</td>
<td><img src="./assets/js-table.png" /></td>
<td>2020-02-03</td>
<td>2王小虎</td>
<td>3上海</td>
<td>4长宁区</td>
<td>2上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>14</td>
<td><img src="./assets/js-table.png" /></td>
<td>2020-03-03</td> <td>2020-03-03</td>
<td>3王小虎</td> <td>3王小虎</td>
<td>4上海</td> <td>4上海</td>
@@ -106,6 +114,7 @@
</tr> </tr>
<tr> <tr>
<td>13</td> <td>13</td>
<td><img src="./assets/js-table.png" /></td>
<td>2020-02-03</td> <td>2020-02-03</td>
<td>2王小虎</td> <td>2王小虎</td>
<td>3上海</td> <td>3上海</td>
@@ -115,6 +124,7 @@
</tr> </tr>
<tr> <tr>
<td>14</td> <td>14</td>
<td><img src="./assets/js-table.png" /></td>
<td>2020-03-03</td> <td>2020-03-03</td>
<td>3王小虎</td> <td>3王小虎</td>
<td>4上海</td> <td>4上海</td>
@@ -123,12 +133,7 @@
<td>200331</td> <td>200331</td>
</tr> </tr>
<tr unsort> <tr unsort>
<td>15</td> <td colspan="6">合计</td>
<td>2020-04-03</td>
<td>5王小虎</td>
<td>6上海</td>
<td>7长宁区</td>
<td>8上海市长宁区淞虹路888号</td>
<td>200331</td> <td>200331</td>
</tr> </tr>
</tbody> </tbody>

1
docs/smartTable.min.js vendored Normal file

File diff suppressed because one or more lines are too long

91
package-lock.json generated
View File

@@ -1321,6 +1321,59 @@
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=",
"dev": true "dev": true
}, },
"copy-webpack-plugin": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz",
"integrity": "sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg==",
"dev": true,
"requires": {
"cacache": "^12.0.3",
"find-cache-dir": "^2.1.0",
"glob-parent": "^3.1.0",
"globby": "^7.1.1",
"is-glob": "^4.0.1",
"loader-utils": "^1.2.3",
"minimatch": "^3.0.4",
"normalize-path": "^3.0.0",
"p-limit": "^2.2.1",
"schema-utils": "^1.0.0",
"serialize-javascript": "^2.1.2",
"webpack-log": "^2.0.0"
},
"dependencies": {
"globby": {
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz",
"integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=",
"dev": true,
"requires": {
"array-union": "^1.0.1",
"dir-glob": "^2.0.0",
"glob": "^7.1.2",
"ignore": "^3.3.5",
"pify": "^3.0.0",
"slash": "^1.0.0"
}
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
},
"schema-utils": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-1.0.0.tgz",
"integrity": "sha512-i27Mic4KovM/lnGsy8whRCHhc7VicJajAjTrYg11K9zfZXnYIt4k5F+kZkwjnrhKzLic/HLU4j11mjsz2G/75g==",
"dev": true,
"requires": {
"ajv": "^6.1.0",
"ajv-errors": "^1.0.0",
"ajv-keywords": "^3.1.0"
}
}
}
},
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@@ -1643,6 +1696,32 @@
"randombytes": "^2.0.0" "randombytes": "^2.0.0"
} }
}, },
"dir-glob": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz",
"integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==",
"dev": true,
"requires": {
"path-type": "^3.0.0"
},
"dependencies": {
"path-type": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
"integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
"dev": true,
"requires": {
"pify": "^3.0.0"
}
},
"pify": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
"dev": true
}
}
},
"dns-equal": { "dns-equal": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz",
@@ -3565,6 +3644,12 @@
"integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=",
"dev": true "dev": true
}, },
"ignore": {
"version": "3.3.10",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz",
"integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==",
"dev": true
},
"import-local": { "import-local": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz", "resolved": "https://registry.npmjs.org/import-local/-/import-local-2.0.0.tgz",
@@ -6095,6 +6180,12 @@
"integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=",
"dev": true "dev": true
}, },
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",
"integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=",
"dev": true
},
"snapdragon": { "snapdragon": {
"version": "0.8.2", "version": "0.8.2",
"resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz",

View File

@@ -6,12 +6,14 @@
"scripts": { "scripts": {
"serve": "webpack-dev-server --open --config config/webpack.dev.js", "serve": "webpack-dev-server --open --config config/webpack.dev.js",
"build": "webpack --config config/webpack.prod.js", "build": "webpack --config config/webpack.prod.js",
"example": "webpack --config config/webpack.example.js",
"deploy": "sh deploy/index.sh" "deploy": "sh deploy/index.sh"
}, },
"author": "pyj92055@163.com", "author": "pyj92055@163.com",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"clean-webpack-plugin": "^3.0.0", "clean-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^3.4.1", "css-loader": "^3.4.1",
"extract-text-webpack-plugin": "^3.0.2", "extract-text-webpack-plugin": "^3.0.2",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",

View File

@@ -1,237 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Smart Example</title>
<style>
body {
padding: 10px 20px;
}
.repo-link {
font-size: 16px;
color: #409eff;
text-decoration: none;
margin-right: 15px;
}
.smart-table a {
color: #409eff;
}
.title {
text-align: center;
padding: 10px 0;
color: #4acccc;
margin: 0;
}
.smart-table {
margin: 20px 0px;
}
td img {
width: 50px;
height: 50px;
}
</style>
</head>
<body>
<h1 class="title">Smart Table Example<a href="https://github.com/peng92055/smart-table" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub</a></h1>
<div class="container">
<div id="smartTable1">
<table stripe>
<thead>
<tr>
<th colspan="1" rowspan="3" fixed sort>Id</th>
<th colspan="1" rowspan="2" width="200" fixed>日期</th>
<th colspan="1" rowspan="2" width="100" sort>姓名</th>
<th colspan="1" width="100" rowspan="1">省份</th>
<th colspan="1" rowspan="1" sort>市区</th>
<th colspan="1" rowspan="1">地址</th>
<th colspan="1" rowspan="1" fixed>邮编</th>
</tr>
</thead>
<tbody>
<tr>
<td>12</td>
<td>2020-01-03</td>
<td>1王小虎</td>
<td>1上海</td>
<td>2长宁区</td>
<td>3上海市长宁区淞虹路888号<img src="//hbimg.huabanimg.com/e3ebdd150746bf9e5ce4c6b057c1e5541c11721b84efd-PN5wmF_fw658" /></td>
<td>200331</td>
</tr>
<tr>
<td>13</td>
<td>2020-02-03</td>
<td>2王小虎</td>
<td>3上海</td>
<td>4长宁区</td>
<td>2上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>14</td>
<td>2020-03-03</td>
<td>3王小虎</td>
<td>4上海</td>
<td>1长宁区</td>
<td>6上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>13</td>
<td>2020-02-03</td>
<td>2王小虎</td>
<td>3上海</td>
<td>4长宁区</td>
<td>2上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>14</td>
<td>2020-03-03</td>
<td>3王小虎</td>
<td>4上海</td>
<td>1长宁区</td>
<td>6上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>13</td>
<td>2020-02-03</td>
<td>2王小虎</td>
<td>3上海</td>
<td>4长宁区</td>
<td>2上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr>
<td>14</td>
<td>2020-03-03</td>
<td>3王小虎</td>
<td>4上海</td>
<td>1长宁区</td>
<td>6上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
<tr unsort>
<td>15</td>
<td>2020-04-03</td>
<td>5王小虎</td>
<td>6上海</td>
<td>7长宁区</td>
<td>8上海市长宁区淞虹路888号</td>
<td>200331</td>
</tr>
</tbody>
</table>
</div>
<div id="smartTable2">
<table>
<thead>
<tr>
<th colspan="1" rowspan="3" fixed sort="number">Id</th>
<th colspan="1" rowspan="3" sort fixed>日期</th>
<th colspan="5" rowspan="1" sort>配送信息</th>
<th colspan="1" rowspan="3" fixed>操作</th>
</tr>
<tr>
<th colspan="1" rowspan="2" sort>姓名</th>
<th colspan="4" rowspan="1" sort>地址</th>
</tr>
<tr>
<th colspan="1" rowspan="1">省份</th>
<th colspan="1" rowspan="1">市区</th>
<th colspan="1" rowspan="1">地址</th>
<th colspan="1" rowspan="1" sort>邮编</th>
</tr>
</thead>
<tbody>
<tr>
<td>11</td>
<td>2020-05-02</td>
<td>王小虎2</td>
<td>上海2</td>
<td>长宁区2</td>
<td>上海市长宁区淞虹路888号2</td>
<td>200332</td>
<td><a href="#">查看2</a></td>
</tr>
<tr>
<td>2</td>
<td>2020-05-03</td>
<td>上小虎3</td>
<td>上海3</td>
<td>长宁区3</td>
<td>上海市长宁区淞虹路888号3</td>
<td>200333</td>
<td><a href="#">查看3</a></td>
</tr>
<tr>
<td>13</td>
<td>2020-01-03</td>
<td>小小虎1</td>
<td>上海1</td>
<td>长宁区1</td>
<td>上海市长宁区淞虹路888号1</td>
<td>200331</td>
<td><a href="#">查看1</a></td>
</tr>
<tr>
<td>5</td>
<td>2020-05-04</td>
<td>王小虎4</td>
<td>上海4</td>
<td>长宁区4</td>
<td>上海市长宁区淞虹路888号4</td>
<td>200334</td>
<td><a href="#">查看4</a></td>
</tr>
<tr>
<td>13</td>
<td>2020-01-03</td>
<td>小小虎1</td>
<td>上海1</td>
<td>长宁区1</td>
<td>上海市长宁区淞虹路888号1</td>
<td>200331</td>
<td><a href="#">查看1</a></td>
</tr>
<tr>
<td>5</td>
<td>2020-05-04</td>
<td>王小虎4</td>
<td>上海4</td>
<td>长宁区4</td>
<td>上海市长宁区淞虹路888号4</td>
<td>200334</td>
<td><a href="#">查看4</a></td>
</tr>
</tbody>
</table>
</div>
</div>
<script>
new SmartTable({
selector: '#smartTable1'
})
new SmartTable({
selector: '#smartTable2',
height: 300,
align: 'left',
size: 'middle'
})
</script>
</body>
</html>