Closed balloob closed 1 year ago
@balloob Could you please try something like this?
diff --git a/src/esploader.ts b/src/esploader.ts
index 06a7d17..99d4dac 100644
--- a/src/esploader.ts
+++ b/src/esploader.ts
@@ -2,6 +2,7 @@ import { ESPError } from "./error";
import { deflate } from "pako";
import { Transport } from "./webserial";
import { ROM } from "./targets/rom";
+import PACKAGE from "../package.json";
async function magic2Chip(magic: number): Promise<ROM> {
switch (magic) {
@@ -104,7 +105,7 @@ export class ESPLoader {
this.terminal.clean();
}
- this.info("esptool.js v0.1-dev");
+ this.info(`esptool.js v${PACKAGE.version}`);
this.info("Serial port " + this.transport.get_info());
}
The downside of that approach is that we're now shipping the whole package.json for the web version, while we only need a single string from it. We should aim to keep the web packages as lean as possible, as every byte impacts initial loading time.
I see, good point. I'll merge your change as is, then.
A different approach could be that we have a default version containing export const version = "0.0.0"
and the build step overwrites this file with the version from package.json before building.
This removes the hardcoded version number.
I would prefer if we could include the actual version number. So maybe we should have a small build script to create that a file like
cat package.json | jq .version