forked from SSmJaE/WELearnHelper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
自动根据metadata修改package.json、manifest.json
- Loading branch information
Showing
4 changed files
with
102 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import json | ||
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
load_dotenv() # take environment variables from .env. | ||
|
||
PLATFORM = os.getenv("COMPILE_PLATFORM", "welearn") | ||
|
||
|
||
META: dict | ||
|
||
with open("metadata.json", "r", encoding="utf-8") as f: | ||
META = json.load(f) | ||
|
||
|
||
PROJECT = META["projects"][PLATFORM] | ||
|
||
# print(PROJECT) | ||
|
||
# 根据metadata修改package.json | ||
|
||
PACKAGE: dict | ||
|
||
with open("package.json", "r", encoding="utf-8") as f: | ||
package = json.load(f) | ||
|
||
|
||
with open("package.json", "w", encoding="utf-8") as f: | ||
package["version"] = PROJECT["version"] | ||
json.dump(package, f, indent=4, ensure_ascii=False) | ||
|
||
|
||
# 根据metadata修改生成userscript的header | ||
# 这个直接让vite-plugin-monkey来做 |