diff options
author | Tim Keller <tjkeller.xyz> | 2024-11-17 22:36:53 -0600 |
---|---|---|
committer | Tim Keller <tjkeller.xyz> | 2024-11-17 22:36:53 -0600 |
commit | 6bb49cc16cbf03d4e0980c2343372ff20d0a4b55 (patch) | |
tree | 38b659a6081e639cce5bd4503886370a75c5c770 /mkconfig.py | |
parent | d7484069764fe74654fe5e7721919462bc1286d2 (diff) | |
download | userscripts-6bb49cc16cbf03d4e0980c2343372ff20d0a4b55.tar.xz userscripts-6bb49cc16cbf03d4e0980c2343372ff20d0a4b55.zip |
rename all scripts to have .user.js ext
Diffstat (limited to 'mkconfig.py')
-rw-r--r-- | mkconfig.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/mkconfig.py b/mkconfig.py index 47cc0ee..ad04413 100644 --- a/mkconfig.py +++ b/mkconfig.py @@ -10,16 +10,13 @@ if os.path.isfile("settings.json"): settings = json.load(f) # get all userscripts -paths = glob.glob(os.path.join('.', '**', '*.js'), recursive=True) -paths = [ path.removesuffix(".js") for path in paths ] +paths = glob.glob(os.path.join('.', '**', '*.user.js'), recursive=True) # zipp with zipfile.ZipFile("violentmonkey.zip", 'w', zipfile.ZIP_DEFLATED) as zipf: for path in paths: - arcname = os.path.basename(path) + ".user.js" # basename and add .user.js suffix - path += ".js" - zipf.write(path, arcname=arcname) + zipf.write(path, arcname=os.path.basename(path)) zipf.writestr("violentmonkey", json.dumps({ - "scripts": { os.path.basename(path): {} for path in paths }, + "scripts": { os.path.basename(path).removesuffix(".user.js"): {} for path in paths }, "settings": settings, })) |