feat: add offline Shanhe Puzzle mini tool
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import pathlib,zipfile,json,hashlib
|
||||
root=pathlib.Path('dist');out=pathlib.Path('artifacts/shanhe-puzzle-xhs.zip')
|
||||
with zipfile.ZipFile(out,'w',zipfile.ZIP_DEFLATED,compresslevel=9) as z:
|
||||
for p in sorted(root.rglob('*')):
|
||||
if p.is_file():z.write(p,p.relative_to(root).as_posix())
|
||||
with zipfile.ZipFile(out) as z:
|
||||
assert 'index.html' in z.namelist()
|
||||
assert z.testzip() is None
|
||||
print('离线 ZIP:',out.resolve(),' | ',round(out.stat().st_size/1024),'KB')
|
||||
pathlib.Path('artifacts/package-report.json').write_text(json.dumps({'file':str(out),'bytes':out.stat().st_size,'sha256':hashlib.sha256(out.read_bytes()).hexdigest(),'archiveIntegrity':'passed','rootEntry':'index.html'},indent=2))
|
||||
Reference in New Issue
Block a user