mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-06 16:02:23 +00:00
fix: classify fileset resource files with script extensions correctly (#8851)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
88e4120e96
commit
b1aeb33ade
@@ -1986,7 +1986,7 @@ interface ChangeTracker {
|
||||
}
|
||||
|
||||
async function addToChangedIfNotExists(p: string, tracker: ChangeTracker) {
|
||||
const isScript = exts.some((e) => p.endsWith(e));
|
||||
const isScript = exts.some((e) => p.endsWith(e)) && !isFileResource(p) && !isFilesetResource(p);
|
||||
if (isScript) {
|
||||
if (isFlowPath(p)) {
|
||||
const folder = extractFolderPath(p, "flow")!;
|
||||
|
||||
+3
-3
@@ -286,6 +286,9 @@ export function getTypeStrFromPath(
|
||||
if (p.startsWith("dependencies" + SEP)) {
|
||||
return "workspace_dependencies";
|
||||
}
|
||||
if (isFileResource(p) || isFilesetResource(p)) {
|
||||
return "resource";
|
||||
}
|
||||
const parsed = path.parse(p);
|
||||
if (
|
||||
parsed.ext == ".go" ||
|
||||
@@ -349,9 +352,6 @@ export function getTypeStrFromPath(
|
||||
) {
|
||||
return typeEnding;
|
||||
} else {
|
||||
if (isFileResource(p) || isFilesetResource(p)) {
|
||||
return "resource";
|
||||
}
|
||||
throw new Error("Could not infer type of path " + JSON.stringify(parsed));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,6 +270,10 @@ describe("getTypeStrFromPath", () => {
|
||||
test("detects fileset resource files as resource type", () => {
|
||||
expect(getTypeStrFromPath("f/test/my_config.fileset/config.yaml")).toBe("resource");
|
||||
expect(getTypeStrFromPath("u/admin/templates.fileset/path/to/file.txt")).toBe("resource");
|
||||
// fileset files with script-like extensions should still be detected as resource
|
||||
expect(getTypeStrFromPath("f/test/my_queries.fileset/query.sql")).toBe("resource");
|
||||
expect(getTypeStrFromPath("f/test/my_queries.fileset/script.py")).toBe("resource");
|
||||
expect(getTypeStrFromPath("f/test/my_queries.fileset/nested/dir/file.ts")).toBe("resource");
|
||||
});
|
||||
|
||||
test("throws for unknown type", () => {
|
||||
|
||||
Reference in New Issue
Block a user