Skip to content

Commit f2da66d

Browse files
authored
Merge pull request #9526 from quarto-dev/fix/check-dev-commit
2 parents e1026cf + b9becf9 commit f2da66d

File tree

3 files changed

+31
-24
lines changed

3 files changed

+31
-24
lines changed

.vscode/launch.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
],
2323
"env": {
2424
"QUARTO_BIN_PATH": "${workspaceFolder}/package/dist/bin",
25-
"QUARTO_SHARE_PATH": "${workspaceFolder}/src/resources"
25+
"QUARTO_SHARE_PATH": "${workspaceFolder}/src/resources",
26+
"QUARTO_ROOT": "${workspaceFolder}",
27+
"QUARTO_DEBUG": "true"
2628
},
2729
"attachSimplePort": 9229,
2830
"windows": {

src/command/check/check.ts

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -131,52 +131,57 @@ async function checkVersions(_services: RenderServices) {
131131
let typstVersion = lines(
132132
(await execProcess({
133133
cmd: [typstBinaryPath(), "--version"],
134-
stdout: "piped"
134+
stdout: "piped",
135135
})).stdout!,
136-
)[0].split(' ')[1];
136+
)[0].split(" ")[1];
137137
checkVersion(typstVersion, ">=0.10.0", "Typst");
138138

139139
completeMessage("Checking versions of quarto dependencies......OK");
140140
}
141141

142142
async function checkInstall(services: RenderServices) {
143143
completeMessage("Checking Quarto installation......OK");
144-
info(` Version: ${quartoConfig.version()}`);
144+
info(`${kIndent}Version: ${quartoConfig.version()}`);
145145
if (quartoConfig.version() === "99.9.9") {
146146
// if they're running a dev version, we assume git is installed
147+
// and QUARTO_ROOT is set to the root of the quarto-cli repo
147148
// print the output of git rev-parse HEAD
148-
const gitHead = await execProcess({
149-
cmd: ["git", "rev-parse", "HEAD"],
150-
stdout: "piped",
151-
});
152-
if (gitHead.stdout) {
153-
info(` commit: ${gitHead.stdout.trim()}`);
149+
const quartoRoot = Deno.env.get("QUARTO_ROOT");
150+
if (quartoRoot) {
151+
const gitHead = await execProcess({
152+
cmd: ["git", "-C", quartoRoot, "rev-parse", "HEAD"],
153+
stdout: "piped",
154+
stderr: "piped", // to not show error if not in a git repo
155+
});
156+
if (gitHead.success && gitHead.stdout) {
157+
info(`${kIndent}commit: ${gitHead.stdout.trim()}`);
158+
}
154159
}
155160
}
156-
info(` Path: ${quartoConfig.binPath()}`);
161+
info(`${kIndent}Path: ${quartoConfig.binPath()}`);
157162
if (Deno.build.os === "windows") {
158163
try {
159164
const codePage = readCodePage();
160165
clearCodePageCache();
161166
await cacheCodePage();
162167
const codePage2 = readCodePage();
163168

164-
info(` CodePage: ${codePage2 || "unknown"}`);
169+
info(`${kIndent}CodePage: ${codePage2 || "unknown"}`);
165170
if (codePage && codePage !== codePage2) {
166171
info(
167-
` NOTE: Code page updated from ${codePage} to ${codePage2}. Previous rendering may have been affected.`,
172+
`${kIndent}NOTE: Code page updated from ${codePage} to ${codePage2}. Previous rendering may have been affected.`,
168173
);
169174
}
170175
// if non-standard code page, check for non-ascii characters in path
171176
// deno-lint-ignore no-control-regex
172177
const nonAscii = /[^\x00-\x7F]+/;
173178
if (nonAscii.test(quartoConfig.binPath())) {
174179
info(
175-
` ERROR: Non-ASCII characters in Quarto path causes rendering problems.`,
180+
`${kIndent}ERROR: Non-ASCII characters in Quarto path causes rendering problems.`,
176181
);
177182
}
178183
} catch {
179-
info(` CodePage: Unable to read code page`);
184+
info(`${kIndent}CodePage: Unable to read code page`);
180185
}
181186
}
182187

@@ -191,10 +196,10 @@ async function checkInstall(services: RenderServices) {
191196

192197
for (const tool of tools.installed) {
193198
const version = await tool.installedVersion() || "(external install)";
194-
toolsOutput.push(` ${tool.name}: ${version}`);
199+
toolsOutput.push(`${kIndent}${tool.name}: ${version}`);
195200
}
196201
for (const tool of tools.notInstalled) {
197-
toolsOutput.push(` ${tool.name}: (not installed)`);
202+
toolsOutput.push(`${kIndent}${tool.name}: (not installed)`);
198203
}
199204
});
200205
toolsOutput.forEach((out) => info(out));
@@ -213,19 +218,19 @@ async function checkInstall(services: RenderServices) {
213218
if (tlContext.usingGlobal) {
214219
const tlMgrPath = await which("tlmgr");
215220

216-
latexOutput.push(` Using: Installation From Path`);
221+
latexOutput.push(`${kIndent}Using: Installation From Path`);
217222
if (tlMgrPath) {
218-
latexOutput.push(` Path: ${dirname(tlMgrPath)}`);
223+
latexOutput.push(`${kIndent}Path: ${dirname(tlMgrPath)}`);
219224
}
220225
} else {
221-
latexOutput.push(` Using: TinyTex`);
226+
latexOutput.push(`${kIndent}Using: TinyTex`);
222227
if (tlContext.binDir) {
223-
latexOutput.push(` Path: ${tlContext.binDir}`);
228+
latexOutput.push(`${kIndent}Path: ${tlContext.binDir}`);
224229
}
225230
}
226-
latexOutput.push(` Version: ${version}`);
231+
latexOutput.push(`${kIndent}Version: ${version}`);
227232
} else {
228-
latexOutput.push(` Tex: (not detected)`);
233+
latexOutput.push(`${kIndent}Tex: (not detected)`);
229234
}
230235
});
231236
latexOutput.forEach((out) => info(out));

src/core/devconfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function readInstalledDevConfig(): DevConfig | null {
8282

8383
export function readSourceDevConfig(): DevConfig {
8484
const rootDir = Deno.env.get("QUARTO_ROOT") ||
85-
join(quartoConfig.sharePath(), "../../src");
85+
join(quartoConfig.sharePath(), "../..");
8686
const configurationScript = join(
8787
rootDir,
8888
"configuration",

0 commit comments

Comments
 (0)