mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-06-27 18:40:31 +02:00
Lots of updates :o
This commit is contained in:
27
tasks/bundle.ts
Normal file
27
tasks/bundle.ts
Normal file
@ -0,0 +1,27 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const yazl = require('yazl')
|
||||
|
||||
function walkDirectory(dir, callback) {
|
||||
for (const file of fs.readdirSync(dir)) {
|
||||
const filePath = path.join(dir, file)
|
||||
fs.statSync(filePath).isDirectory() ? walkDirectory(filePath, callback) : callback(filePath)
|
||||
}
|
||||
}
|
||||
|
||||
async function bundle_zip() {
|
||||
const zipfile = new yazl.ZipFile()
|
||||
walkDirectory('build', (path) => {
|
||||
zipfile.addFile(path, path.substring(6))
|
||||
})
|
||||
zipfile.end()
|
||||
|
||||
fs.mkdirSync('dist', {recursive: true})
|
||||
zipfile.outputStream.pipe(fs.createWriteStream(`dist/stream_bypass-v${process.env.npm_package_version}.zip`))
|
||||
}
|
||||
|
||||
async function bundle() {
|
||||
await bundle_zip()
|
||||
}
|
||||
|
||||
bundle()
|
Reference in New Issue
Block a user