parent
275f6700a2
commit
02ccc30e23
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @authors yutent (yutent@doui.cc)
|
* @authors yutent (yutent.io@gmail.com)
|
||||||
* @date 2018-08-04 01:00:06
|
* @date 2018-08-04 01:00:06
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -12,8 +12,9 @@ const path = require('path')
|
||||||
const chokidar = require('chokidar')
|
const chokidar = require('chokidar')
|
||||||
const uglify = require('uglify-es')
|
const uglify = require('uglify-es')
|
||||||
const chalk = require('chalk')
|
const chalk = require('chalk')
|
||||||
|
const config = require('./package.json')
|
||||||
const log = console.log
|
const log = console.log
|
||||||
const VERSION = '2.0.0'
|
const VERSION = config.version
|
||||||
|
|
||||||
const PACK_DIR = path.resolve('./dist')
|
const PACK_DIR = path.resolve('./dist')
|
||||||
const SOURCE_DIR = path.resolve('./src/')
|
const SOURCE_DIR = path.resolve('./src/')
|
||||||
|
@ -59,9 +60,9 @@ export default _Anot
|
||||||
function comment({ touch } = {}) {
|
function comment({ touch } = {}) {
|
||||||
return `/*==================================================
|
return `/*==================================================
|
||||||
* Anot ${touch ? 'touch' : 'normal'} version for future browsers
|
* Anot ${touch ? 'touch' : 'normal'} version for future browsers
|
||||||
* @authors yutent (yutent@doui.cc)
|
* @authors yutent<yutent.io@gmail.com>
|
||||||
* @date 2017-03-21 21:05:57
|
* @date ${new Date().format()}
|
||||||
* V${VERSION}
|
* @version v${VERSION}
|
||||||
*
|
*
|
||||||
==================================================*/
|
==================================================*/
|
||||||
`
|
`
|
||||||
|
@ -115,8 +116,8 @@ function packNoCompress(file) {
|
||||||
* 打包带触摸事件的未来版的 anot
|
* 打包带触摸事件的未来版的 anot
|
||||||
* --------------------------------------------------------
|
* --------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
fs.echo(Buffer.concat([PAD_START, touchVer, PAD_END]), './dist/anot-touch.js')
|
fs.echo(Buffer.concat([PAD_START, touchVer, PAD_END]), './dist/anot.touch.js')
|
||||||
log('%s 打包完成...', chalk.green('anot-touch.js'))
|
log('%s 打包完成...', chalk.green('anot.touch.js'))
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打包并压缩
|
// 打包并压缩
|
||||||
|
@ -144,14 +145,14 @@ function packAndCompress() {
|
||||||
* 打包带触摸事件的未来版的 anot
|
* 打包带触摸事件的未来版的 anot
|
||||||
* --------------------------------------------------------
|
* --------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
log('正在打包 anot-touch.js...')
|
log('正在打包 anot.touch.js...')
|
||||||
let touchVerPack = Buffer.concat([PAD_START, touchVer, PAD_END]).toString()
|
let touchVerPack = Buffer.concat([PAD_START, touchVer, PAD_END]).toString()
|
||||||
|
|
||||||
fs.echo(
|
fs.echo(
|
||||||
comment({ touch: true }) + uglify.minify(touchVerPack).code,
|
comment({ touch: true }) + uglify.minify(touchVerPack).code,
|
||||||
'./dist/anot-touch.js'
|
'./dist/anot.touch.js'
|
||||||
)
|
)
|
||||||
log(chalk.green('anot-touch.js 打包压缩完成!'))
|
log(chalk.green('anot.touch.js 打包压缩完成!'))
|
||||||
}
|
}
|
||||||
|
|
||||||
let args = process.argv.slice(2)
|
let args = process.argv.slice(2)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "anot",
|
"name": "anot",
|
||||||
"version": "2.2.2",
|
"version": "2.2.3",
|
||||||
"description": "Anot - 迷你mvvm框架",
|
"description": "Anot - 迷你mvvm框架",
|
||||||
"main": "dist/anot.js",
|
"main": "dist/anot.js",
|
||||||
"files": ["dist"],
|
"files": ["dist"],
|
||||||
|
|
|
@ -16,7 +16,7 @@ npm run prod
|
||||||
```
|
```
|
||||||
执行完, 会打包为2个版本, 分别是
|
执行完, 会打包为2个版本, 分别是
|
||||||
- anot.js 普通版(需要支持es6 module的现代浏览器)
|
- anot.js 普通版(需要支持es6 module的现代浏览器)
|
||||||
- anot-touch.js 带触摸的版本(需要支持es6 module的现代浏览器)
|
- anot.touch.js 带触摸事件的版本(需要支持es6 module的现代浏览器)
|
||||||
|
|
||||||
|
|
||||||
### 文档:
|
### 文档:
|
||||||
|
|
|
@ -264,8 +264,8 @@ function observeObject(source, options) {
|
||||||
return (old = value.get.call(this))
|
return (old = value.get.call(this))
|
||||||
},
|
},
|
||||||
set: function(x) {
|
set: function(x) {
|
||||||
var older = old,
|
var older = old
|
||||||
newer
|
var newer
|
||||||
value.set.call(this, x)
|
value.set.call(this, x)
|
||||||
newer = this[key]
|
newer = this[key]
|
||||||
if (this.$fire && newer !== older) {
|
if (this.$fire && newer !== older) {
|
||||||
|
|
Reference in New Issue