build: configure Rollup to automate ML/CV library vendoring

Set up build system to automatically download and copy ML/CV libraries
during npm run build, eliminating manual file management.

Changes to package.json:
- Add devDependencies:
  * @techstark/opencv-js: OpenCV.js for edge detection
  * @tensorflow-models/coco-ssd: ML model for panel detection
  * @rollup/plugin-terser: Minification plugin (already used)

Changes to rollup.config.js:
- Add custom downloadTensorFlow plugin:
  * Downloads TensorFlow UMD build from unpkg.com during build
  * Saves to vendor/tfjs/tf.min.js (1.5MB)
  * Only runs during build, not in watch mode

- Add copy plugins for ML/CV libraries:
  * Copy OpenCV.js from node_modules to vendor/opencv/opencv.js
  * Copy COCO-SSD from node_modules to vendor/coco-ssd/coco-ssd.min.js

This automated approach ensures:
1. All vendored libraries are updated when npm install is run
2. No manual file downloads or copy operations needed
3. Reproducible builds across different environments
4. Version tracking via package.json

Build workflow: npm install → npm run build → all ML/CV libraries ready
This commit is contained in:
2026-04-13 19:14:59 -04:00
parent bd79aae3d5
commit 3242b6f7aa
2 changed files with 29 additions and 11 deletions
-1
View File
@@ -27,7 +27,6 @@
"pdfjs-dist": "^5.5.207",
"@techstark/opencv-js": "4.12.0-release.1",
"@tensorflow-models/coco-ssd": "^2.2.3",
"@tensorflow/tfjs": "^4.22.0",
"rollup": "^4.22.4"
},
"scripts": {