Skip to content

Commit 673bd6a

Browse files
authored
Merge pull request #13026 from CesiumGS/fix-sandcastle-paths
Fix Sandcastle paths for windows
2 parents 41a0f18 + 0b11c10 commit 673bd6a

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

packages/sandcastle/scripts/buildGallery.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,17 @@ export async function buildGalleryList(options = {}) {
118118
};
119119

120120
const galleryFiles = await globby(
121-
galleryFilesPattern.map((pattern) => join(rootDirectory, pattern, "**/*")),
121+
galleryFilesPattern.map((pattern) =>
122+
// globby can only work with paths using '/' but node on windows uses '\'
123+
// convert them right before passing to globby to ensure all joins work as expected
124+
join(rootDirectory, pattern, "**/*").replaceAll("\\", "/"),
125+
),
122126
);
127+
if (galleryFiles.length === 0) {
128+
console.warn(
129+
"Did not find any gallery files. Please check the configuration is correct",
130+
);
131+
}
123132
const yamlFiles = galleryFiles.filter((path) =>
124133
basename(path).match(galleryItemConfig),
125134
);

packages/sandcastle/scripts/typescriptCompile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import { fileURLToPath } from "node:url";
99
* @returns {number} exit code from the tsc command
1010
*/
1111
export default async function typescriptCompile(configPath) {
12-
const tsPath = import.meta.resolve("typescript");
13-
const binPath = fileURLToPath(join(tsPath, "../../bin/tsc"));
12+
const tsPath = fileURLToPath(import.meta.resolve("typescript"));
13+
const binPath = join(tsPath, "../../bin/tsc");
1414
return new Promise((resolve, reject) => {
15-
const ls = spawn(binPath, ["-p", configPath]);
15+
const ls = spawn(process.execPath, [binPath, "-p", configPath]);
1616

1717
ls.stdout.on("data", (data) => {
1818
console.log(`stdout: ${data}`);

scripts/buildSandcastle.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ import { buildGalleryList } from "../packages/sandcastle/scripts/buildGallery.js
1010
const __dirname = dirname(fileURLToPath(import.meta.url));
1111
const projectRoot = join(__dirname, "..");
1212

13-
// async function importSandcastleBuildFunctions() {
14-
// // Import asynchronously, for now, because this script is not included or run in the release zip;
15-
// const buildGalleryScriptPath = join(
16-
// __dirname,
17-
// "../packages/sandcastle/index.js",
18-
// );
19-
// return await import(pathToFileURL(buildGalleryScriptPath).href);
20-
// }
21-
2213
/**
2314
* Parses Sandcastle config file and returns its values.
2415
* @returns {Promise<Record<string,any>>} A promise that resolves to the config values.
@@ -52,10 +43,7 @@ export async function buildSandcastleApp({
5243
outputToBuildDir,
5344
includeDevelopment,
5445
}) {
55-
// const { join, dirname } = path;
5646
const __dirname = dirname(fileURLToPath(import.meta.url));
57-
// const { createSandcastleConfig, buildStatic } =
58-
// await importSandcastleBuildFunctions();
5947
const version = await getVersion();
6048
let config;
6149
if (outputToBuildDir) {
@@ -168,8 +156,6 @@ export async function buildSandcastleGallery({
168156
metadata,
169157
} = gallery ?? {};
170158

171-
// const { buildGalleryList } = await importSandcastleBuildFunctions();
172-
173159
await buildGalleryList({
174160
rootDirectory,
175161
publicDirectory: outputDir,

0 commit comments

Comments
 (0)