Skip to content

Commit 059b457

Browse files
claude: Read full version from version.txt in packaging config
When QUARTO_VERSION from configuration file is incomplete (e.g., "1.9"), read the full version from version.txt (e.g., "1.9.17"). This ensures bundled distributions report the correct version number and pass extension quarto-required version checks. Includes safeguard to only use version.txt if its major.minor matches the configured version, preventing issues if version.txt gets out of sync. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 15018cc commit 059b457

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

package/src/common/config.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import { join } from "../../../src/deno_ral/path.ts";
99
import { info } from "../../../src/deno_ral/log.ts";
10+
import { existsSync } from "../../../src/deno_ral/fs.ts";
1011

1112
import { getEnv } from "../util/utils.ts";
1213

@@ -59,6 +60,20 @@ export function readConfiguration(
5960
const root = getEnv("QUARTO_ROOT");
6061
const src = getEnv("QUARTO_SRC_PATH");
6162

63+
// If version is incomplete (e.g., "1.9" from configuration file),
64+
// try to read the full version from version.txt
65+
if (version && version.split(".").length < 3) {
66+
const versionTxtPath = join(root, "version.txt");
67+
if (existsSync(versionTxtPath)) {
68+
const versionTxt = Deno.readTextFileSync(versionTxtPath).trim();
69+
// Only use version.txt if it starts with the same major.minor
70+
// (e.g., version="1.9" and versionTxt="1.9.17")
71+
if (versionTxt.startsWith(version + ".")) {
72+
version = versionTxt;
73+
}
74+
}
75+
}
76+
6277
const pkg = getEnv("QUARTO_PACKAGE_PATH") || "package";
6378
const out = join(pkg, getEnv("QUARTO_OUT_DIR") || "out");
6479

0 commit comments

Comments
 (0)