mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-04 19:02:58 +00:00
doc: use code snippet for typescript examples (#880)
The typescript code is in a fully function file, that will be run via the CI.
This commit is contained in:
@@ -9,7 +9,10 @@ const excludedGlobs = [
|
||||
"../src/embedding.md",
|
||||
"../src/examples/*.md",
|
||||
"../src/guides/tables.md",
|
||||
"../src/guides/storage.md",
|
||||
"../src/embeddings/*.md",
|
||||
"../src/javascript/**/*.md",
|
||||
"../src/basic.md",
|
||||
];
|
||||
|
||||
const nodePrefix = "javascript";
|
||||
@@ -47,8 +50,11 @@ for (const file of files.filter((file) => !excludedFiles.includes(file))) {
|
||||
if (lines.length > 0) {
|
||||
const fileName = path.basename(file, ".md");
|
||||
const outPath = path.join(nodeFolder, fileName, `${fileName}${nodeFile}`);
|
||||
console.log(outPath)
|
||||
console.log(outPath);
|
||||
fs.mkdirSync(path.dirname(outPath), { recursive: true });
|
||||
fs.writeFileSync(outPath, asyncPrefix + "\n" + lines.join("\n") + asyncSuffix);
|
||||
fs.writeFileSync(
|
||||
outPath,
|
||||
asyncPrefix + "\n" + lines.join("\n") + asyncSuffix
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user