1 Star 0 Fork 0

半反/my-web-view-ts

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
pack.js 1.62 KB
一键复制 编辑 原始数据 按行查看 历史
半反 提交于 2021-08-29 22:48 . init
// build 命令
const fs = require('fs')
const path = require('path')
const copy = require('recursive-copy')
const archiver = require('archiver')
const packName = 'powerfulpixivdownloader'
// 复制一些文件到 dist 目录
async function copys() {
return new Promise(async (resolve, reject) => {
// 复制 static 文件夹的内容
await copy('./src/static', './dist', {
overwrite: true,
}).catch(function (error) {
console.error('Copy failed: ' + error)
reject()
})
// 复制 manifest
await copy('./src', './dist', {
overwrite: true,
filter: ['manifest.json'],
})
// 复制根目录一些文件
await copy('./', './dist', {
overwrite: true,
filter: ['README.md', 'README-EN.md', 'README-ZH-TW.md', 'LICENSE'],
}).then(function (results) {
resolve()
console.log('Copy success')
})
})
}
// 打包 dist 目录
function pack() {
const zipName = path.resolve(__dirname, packName + '.zip')
const output = fs.createWriteStream(zipName)
const archive = archiver('zip', {
zlib: { level: 9 }, // Sets the compression level.
})
archive.on('error', function (err) {
throw err
})
archive.on('finish', () => {
console.log(`Pack success`)
})
// pipe archive data to the file
archive.pipe(output)
// 添加文件夹
archive.directory('dist', packName)
archive.finalize()
}
// 构建
async function build() {
await copys()
pack()
}
build()
console.log('Start pack')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/idbanfan/my-web-view-ts.git
[email protected]:idbanfan/my-web-view-ts.git
idbanfan
my-web-view-ts
my-web-view-ts
master

搜索帮助