This repository has been archived on 2023-08-29. You can view files and clone it, but cannot push or open issues/pull-requests.
yutent
/
anot.js
Archived
1
0
Fork 0

更新打包脚本

master
宇天 2021-01-08 10:20:18 +08:00
parent 3f8361af05
commit 542ebfc496
1 changed files with 10 additions and 10 deletions

View File

@ -4,13 +4,11 @@
* @date 2018-08-04 01:00:06 * @date 2018-08-04 01:00:06
*/ */
'use strict'
require('es.shim') require('es.shim')
const fs = require('iofs') const fs = require('iofs')
const path = require('path') const path = require('path')
const chokidar = require('chokidar') const chokidar = require('chokidar')
const uglify = require('terser') const { minify } = require('terser')
const chalk = require('chalk') const chalk = require('chalk')
const config = require('./package.json') const config = require('./package.json')
const log = console.log const log = console.log
@ -137,8 +135,11 @@ function packAndCompress() {
*/ */
log('正在打包 anot.js...') log('正在打包 anot.js...')
let normalVerPack = Buffer.concat([PAD_START, normalVer, PAD_END]).toString() let normalVerPack = Buffer.concat([PAD_START, normalVer, PAD_END]).toString()
fs.echo(comment() + uglify.minify(normalVerPack).code, './dist/anot.js')
log(chalk.green('anot.js 打包压缩完成!')) minify(normalVerPack, { sourceMap: false }).then(res => {
fs.echo(comment() + res.code, './dist/anot.js')
log(chalk.green('anot.js 打包压缩完成!'))
})
/** /**
* -------------------------------------------------------- * --------------------------------------------------------
@ -148,11 +149,10 @@ function packAndCompress() {
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( minify(touchVerPack, { sourceMap: false }).then(res => {
comment({ touch: true }) + uglify.minify(touchVerPack).code, fs.echo(comment({ touch: true }) + res.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)