diff --git a/compose.dang b/compose.dang index 3c008ee..aaa22f6 100644 --- a/compose.dang +++ b/compose.dang @@ -27,40 +27,13 @@ type Compose { prefix marks an enclosing project. """ pub projects(ws: Workspace!): [ComposeProject!]! { - polyfill - .workspace(ws) - .findConfigDirs(configNames) + ws + .findRoots(markers: configNames) .map { projectPath => ComposeProject(path: projectPath, composeImage: composeImage, configNames: configNames) } } - - """ - Return the number of path segments of a workspace-root-absolute file path. - """ - let depth(filePath: String!): Int! { - filePath.trimPrefix("/").split("/").length - } - - """ - Return the directory of a workspace-root-absolute file path, relative to the - client's cwd: "/a/b/compose.yaml" from cwd "a" is "b", from "a/b/c" is "..". - """ - let relativeToCwd(ws: Workspace!, filePath: String!): String! { - let dirSegments = filePath.trimPrefix("/").split("/").dropLast(1) - let cwdSegments = ws.path.trimPrefix("/").split("/").filter { segment => - segment != "" and segment != "." - } - # Longest common prefix: acc only advances while every prior segment matched. - let common = cwdSegments.map { segment, i => i }.reduce(0) { acc, i => - if (acc == i and dirSegments[i] == cwdSegments[i]) { acc + 1 } else { acc } - } - let segments = cwdSegments.dropFirst(common).map { segment => ".." } + - dirSegments.dropFirst(common) - if (segments.length == 0) { "." } else { segments.join("/") } - } - """ Run the services of the Compose project detected from the client's cwd, proxied through a single service with one frontend port per compose service. diff --git a/dagger.json b/dagger.json index 57524f1..af53617 100644 --- a/dagger.json +++ b/dagger.json @@ -1,18 +1,14 @@ { "name": "docker", - "engineVersion": "v0.20.6", + "engineVersion": "v1.0.0-beta.10", "sdk": { "source": "dang" }, "dependencies": [ - { - "name": "polyfill", - "source": "github.com/dagger/polyfill@main", - "pin": "ec3ea84a2351b4beb06ecece951f2e5ef66509ff" - }, { "name": "proxy", - "source": "./proxy" + "source": "https://github.com/dagger/proxy@main", + "pin": "3224e8981d8c8f04a0c238dc933b7415a2a6349f" } ] -} \ No newline at end of file +} diff --git a/docker.dang b/docker.dang index 8af9f78..21b90b2 100644 --- a/docker.dang +++ b/docker.dang @@ -17,9 +17,8 @@ type Docker { marks an enclosing project. """ pub projects(ws: Workspace!): [DockerProject!]! { - polyfill - .workspace(ws) - .findConfigDirs(["Dockerfile"]) + ws + .findRoots(markers: ["Dockerfile"]) .map { projectPath => DockerProject(path: projectPath, lintImage: lintImage) } @@ -53,7 +52,7 @@ type Docker { """ let relativeToCwd(ws: Workspace!, filePath: String!): String! { let dirSegments = filePath.trimPrefix("/").split("/").dropLast(1) - let cwdSegments = ws.path.trimPrefix("/").split("/").filter { segment => + let cwdSegments = ws.cwd.trimPrefix("/").split("/").filter { segment => segment != "" and segment != "." } # Longest common prefix: acc only advances while every prior segment matched.