mirror of
https://github.com/pybricks/pybricks-api.git
synced 2026-09-12 01:24:17 +00:00
npm/images: add DFU Windows driver images
This will be used in Pybricks Code for Windows driver installation instructions.
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
|
||||
|
||||
### Added
|
||||
- Added DFU Windows driver images.
|
||||
|
||||
## 1.2.1 - 2022-11-08
|
||||
|
||||
### Changed
|
||||
|
||||
+9
-3
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from glob import glob
|
||||
import json
|
||||
import pathlib
|
||||
import shutil
|
||||
@@ -21,6 +22,7 @@ package_json = {
|
||||
"directory": "npm/images",
|
||||
},
|
||||
"publishConfig": {"registry": "https://registry.npmjs.org", "access": "public"},
|
||||
"exports": {}, # dynamically filled below
|
||||
}
|
||||
|
||||
# ensure empty build directory so we don't end up with stale files
|
||||
@@ -30,12 +32,16 @@ BUILD_DIR.mkdir()
|
||||
# copy the hub images
|
||||
for h in HUBS:
|
||||
shutil.copyfile(IMAGE_DIR / f"icon_{h}hub.png", BUILD_DIR / f"hub-{h}.png")
|
||||
package_json["exports"][f"./hub-{h}.png"] = f"./hub-{h}.png"
|
||||
|
||||
# copy DFU Windows driver images
|
||||
for path in glob("dfu_windows_*", root_dir=IMAGE_DIR):
|
||||
file = pathlib.Path(path).name
|
||||
shutil.copyfile(IMAGE_DIR / path, BUILD_DIR / file)
|
||||
package_json["exports"][f"./{file}"] = f"./{file}"
|
||||
|
||||
# generate package.json file
|
||||
|
||||
# create "exports" item for hub images.
|
||||
package_json["exports"] = {f"./hub-{h}.png": f"./hub-{h}.png" for h in HUBS}
|
||||
|
||||
with open(BUILD_DIR / "package.json", "w") as f:
|
||||
json.dump(package_json, f, indent=2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user