Skip to content

Commit

Permalink
打包器自动提取changelog到剪切板
Browse files Browse the repository at this point in the history
  • Loading branch information
iceriny committed Nov 20, 2023
1 parent 7cc8bf8 commit d8439ee
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 45 deletions.
12 changes: 12 additions & 0 deletions Packager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import json
import zipfile
import os
# 三方输出到剪切板块
import pyperclip


def set_manifest() -> str:
Expand All @@ -20,12 +22,22 @@ def set_manifest() -> str:
data['version'] = input("请输入版本号:")
already_edited = True

text_to_copy = f"{data['version']}\n\n{data['description']}\n\n{get_last_changelog(data)}"
pyperclip.copy(text_to_copy)

if already_edited:
with open('manifest.json', 'w', encoding='utf-8') as json_file:
json.dump(data, json_file, indent=4, ensure_ascii=False)

return package_name

def get_last_changelog(data) -> str:
changelog = data['changelog']
last_changelog = changelog[0]

result = last_changelog['description']
return result

def zip_to_package(package_name : str):
files_list = [
".\\css",
Expand Down
100 changes: 55 additions & 45 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,58 @@
{
"manifest_version": 3,
"name": "B站视频信息",
"package_name": "BiliVideoInfo",
"version": "0.2.0",
"description": "可以预览B站视频信息, 播放量、点赞、投币、收藏、转发、等。",
"icons": {
"128": "img/logo.png"
"manifest_version": 3,
"name": "B站视频信息",
"package_name": "BiliVideoInfo",
"version": "0.2.0",
"description": "可以预览B站视频信息, 播放量、点赞、投币、收藏、转发、等。",
"icons": {
"128": "img/logo.png"
},
"content_scripts": [
{
"js": [
"scripts/content.js",
"scripts/bilibiliAPI.js",
"scripts/md5.js",
"scripts/constants.js",
"scripts/ui.js"
],
"css": [
"css/idcard.css"
],
"matches": [
"https://*.bilibili.com/*"
],
"run_at": "document_start"
}
],
"author": [
{
"name": "iceriny",
"url": "https://github.com/iceriny"
}
],
"permissions": [
"storage"
],
"web_accessible_resources": [
{
"resources": [
"css/idcard.css",
"scripts/markScript.js"
],
"matches": [
"https://*.bilibili.com/*"
]
}
],
"changelog": [
{
"description": "完善与优化UI",
"version": "0.2.0"
},
"content_scripts": [
{
"js": [
"scripts/content.js",
"scripts/bilibiliAPI.js",
"scripts/md5.js",
"scripts/constants.js",
"scripts/ui.js"
],
"css": [
"css/idcard.css"
],
"matches": [
"https://*.bilibili.com/*"
],
"run_at": "document_start"
}
],
"author": [
{
"name": "iceriny",
"url": "https://github.com/iceriny"
}
],
"permissions": [
"storage"
],
"web_accessible_resources": [
{
"resources": [
"css/idcard.css",
"scripts/markScript.js"
],
"matches": [
"https://*.bilibili.com/*"
]
}
]
{
"description": "基本功能完成",
"version": "0.1.0"
}
]
}

0 comments on commit d8439ee

Please sign in to comment.