Use web-ext instead of custom bundle & add code check

This commit is contained in:
bytedream 2022-06-16 19:44:24 +02:00
parent e64feb5130
commit 31787bb3e3
3 changed files with 8089 additions and 29 deletions

8085
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,9 @@
"main": "src/index.ts", "main": "src/index.ts",
"scripts": { "scripts": {
"build": "node tasks/build.ts", "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": { "repository": {
"type": "git", "type": "git",
@ -34,6 +36,6 @@
"rollup": "^2.75.6", "rollup": "^2.75.6",
"tippy.js": "^6.3.7", "tippy.js": "^6.3.7",
"typescript": "^4.7.3", "typescript": "^4.7.3",
"yazl": "^2.5.1" "web-ext": "^7.0.0"
} }
} }

View File

@ -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()