Skip to content

Commit f14bbc3

Browse files
committed
npm/images: add DFU Windows driver images
This will be used in Pybricks Code for Windows driver installation instructions.
1 parent 44c6191 commit f14bbc3

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

npm/images/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
44

5+
### Added
6+
- Added DFU Windows driver images.
7+
58
## 1.2.1 - 2022-11-08
69

710
### Changed

npm/images/build.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python3
22

3+
from glob import glob
34
import json
45
import pathlib
56
import shutil
@@ -21,6 +22,7 @@
2122
"directory": "npm/images",
2223
},
2324
"publishConfig": {"registry": "https://registry.npmjs.org", "access": "public"},
25+
"exports": {}, # dynamically filled below
2426
}
2527

2628
# ensure empty build directory so we don't end up with stale files
@@ -30,11 +32,15 @@
3032
# copy the hub images
3133
for h in HUBS:
3234
shutil.copyfile(IMAGE_DIR / f"icon_{h}hub.png", BUILD_DIR / f"hub-{h}.png")
35+
package_json["exports"][f"./hub-{h}.png"] = f"./hub-{h}.png"
3336

34-
# generate package.json file
37+
# copy DFU Windows driver images
38+
for path in glob("dfu_windows_*", root_dir=IMAGE_DIR):
39+
file = pathlib.Path(path).name
40+
shutil.copyfile(IMAGE_DIR / path, BUILD_DIR / file)
41+
package_json["exports"][f"./{file}"] = f"./{file}"
3542

36-
# create "exports" item for hub images.
37-
package_json["exports"] = {f"./hub-{h}.png": f"./hub-{h}.png" for h in HUBS}
43+
# generate package.json file
3844

3945
with open(BUILD_DIR / "package.json", "w") as f:
4046
json.dump(package_json, f, indent=2)

0 commit comments

Comments
 (0)