fix: update.ts fails when there is no islands directory (#1327)
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@ export {
|
||||
SEP,
|
||||
toFileUrl,
|
||||
} from "https://deno.land/std@0.190.0/path/mod.ts";
|
||||
export { walk } from "https://deno.land/std@0.190.0/fs/walk.ts";
|
||||
export { walk, WalkError } from "https://deno.land/std@0.190.0/fs/walk.ts";
|
||||
export { parse } from "https://deno.land/std@0.190.0/flags/mod.ts";
|
||||
export { gte } from "https://deno.land/std@0.190.0/semver/mod.ts";
|
||||
|
||||
|
||||
+24
-6
@@ -1,4 +1,12 @@
|
||||
import { dirname, fromFileUrl, gte, join, toFileUrl, walk } from "./deps.ts";
|
||||
import {
|
||||
dirname,
|
||||
fromFileUrl,
|
||||
gte,
|
||||
join,
|
||||
toFileUrl,
|
||||
walk,
|
||||
WalkError,
|
||||
} from "./deps.ts";
|
||||
import { error } from "./error.ts";
|
||||
|
||||
const MIN_DENO_VERSION = "1.31.0";
|
||||
@@ -28,12 +36,22 @@ async function collectDir(dir: string): Promise<string[]> {
|
||||
includeFiles: true,
|
||||
exts: ["tsx", "jsx", "ts", "js"],
|
||||
});
|
||||
for await (const entry of routesFolder) {
|
||||
const path = toFileUrl(entry.path).href.substring(
|
||||
dirUrl.href.length,
|
||||
);
|
||||
paths.push(path);
|
||||
|
||||
try {
|
||||
for await (const entry of routesFolder) {
|
||||
const path = toFileUrl(entry.path).href.substring(
|
||||
dirUrl.href.length,
|
||||
);
|
||||
paths.push(path);
|
||||
}
|
||||
} catch (err) {
|
||||
if (err instanceof WalkError && err.cause instanceof Deno.errors.NotFound) {
|
||||
// Do nothing.
|
||||
return [];
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
|
||||
paths.sort();
|
||||
return paths;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user