- Build output moved to build/ (tsc outDir; worker-client, registry DEVICES_DIR, html script src, tests, sync_www ITEMS updated; build/ gitignored, stale peris/core+ui removed) - Version management: src/core/version.ts (project, 0.2.0) shown in the header and terminal banner; per-device Device.version validated by the registry and shown on card headers; docs/CHANGELOG.md records both (project + device table) - docs/EMU-API.md: full reverse-engineered summary of the closed-source esp_emu_bg.wasm surface (lifecycle, execution, CPU state, GPIO/UART/ WiFi, M0-verified MMIO facts, stock worker protocol, CLI-only gaps) - AGENT.md: environment pitfalls (mirrors, idfm.bat/MSYSTEM, merge-bin), emulator behavior facts, architecture invariants, past-bug table, test conventions and versioning rules for future agents - README/ARCHITECTURE/DEVICE-API updated for the new layout
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Publish esp-emu-peris into an esp-emu-browser www directory: copies the
|
|
entry HTML, the peris/ tree and examples/. Existing stock files
|
|
(index.html, app.js, worker.js, pkg/) are never touched.
|
|
|
|
Usage: python sync_www.py [--www PATH] [--clean]
|
|
default www ../_tools/esp-emu-browser/www
|
|
--clean removes a previously synced peris/ from www first
|
|
"""
|
|
import argparse
|
|
import os
|
|
import shutil
|
|
|
|
REPO = os.path.dirname(os.path.abspath(__file__))
|
|
ITEMS = ['esp-emu-peris.html', 'build', 'peris', 'examples']
|
|
|
|
|
|
def sync(www, clean=False):
|
|
ok = True
|
|
for name in ITEMS:
|
|
src = os.path.join(REPO, name)
|
|
dst = os.path.join(www, name)
|
|
if not os.path.exists(src):
|
|
print(f'skip (missing in repo): {name}')
|
|
continue
|
|
if clean and os.path.isdir(dst):
|
|
shutil.rmtree(dst)
|
|
try:
|
|
if os.path.isdir(src):
|
|
shutil.copytree(src, dst, dirs_exist_ok=True)
|
|
else:
|
|
shutil.copy2(src, dst)
|
|
print(f'copied: {name}')
|
|
except OSError as e:
|
|
print(f'FAILED: {name}: {e}')
|
|
ok = False
|
|
return ok
|
|
|
|
|
|
def main():
|
|
default_www = os.path.normpath(os.path.join(REPO, '..', '_tools', 'esp-emu-browser', 'www'))
|
|
ap = argparse.ArgumentParser(description=__doc__)
|
|
ap.add_argument('--www', default=default_www, help='esp-emu-browser www directory')
|
|
ap.add_argument('--clean', action='store_true', help='remove old peris/ in www before copying')
|
|
args = ap.parse_args()
|
|
|
|
if not os.path.isdir(args.www):
|
|
raise SystemExit(f'error: {args.www} is not a directory')
|
|
ok = sync(args.www, args.clean)
|
|
print('done' if ok else 'done with errors')
|
|
raise SystemExit(0 if ok else 1)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|