mirror of
https://github.com/bytedream/stream-bypass.git
synced 2025-05-09 20:25:14 +02:00
Use web-ext instead of custom bundle & add code check
This commit is contained in:
parent
e64feb5130
commit
31787bb3e3
8085
package-lock.json
generated
8085
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,9 @@
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
"build": "node tasks/build.ts",
|
||||
"bundle": "node tasks/build.ts && node tasks/bundle.ts"
|
||||
"bundle": "node tasks/build.ts && web-ext build -s build -a dist -o",
|
||||
"bundle:all": "node tasks/build.ts && web-ext build -s build -a dist -o && web-ext sign -s build -a dist",
|
||||
"check": "web-ext lint -s build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -34,6 +36,6 @@
|
||||
"rollup": "^2.75.6",
|
||||
"tippy.js": "^6.3.7",
|
||||
"typescript": "^4.7.3",
|
||||
"yazl": "^2.5.1"
|
||||
"web-ext": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import * as yazl from "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()
|
Loading…
x
Reference in New Issue
Block a user