@netnodeag/kraftwerk 0.59.0 → 0.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/config.d.ts CHANGED
@@ -275,6 +275,9 @@ export declare const isDir: (p: string) => Promise<boolean>;
275
275
  /**
276
276
  * Resolve the project for a cwd: walk up until a kraftwerk.yml or a
277
277
  * workflows root appears; a .git directory is the fallback root, the cwd
278
- * itself the last resort.
278
+ * itself the last resort. A bare workflows root is only a candidate: a
279
+ * kraftwerk.yml further up whose `workflows:` is that very folder wins, so
280
+ * a command run inside the workspace's own data (kraftwerk-data/projects/<slug>,
281
+ * next to kraftwerk-data/workflows) still finds the workspace.
279
282
  */
280
283
  export declare function resolveProject(cwd: string): Promise<Project>;
package/dist/config.js CHANGED
@@ -188,32 +188,40 @@ async function findWorkflowsDir(dir, configured) {
188
188
  /**
189
189
  * Resolve the project for a cwd: walk up until a kraftwerk.yml or a
190
190
  * workflows root appears; a .git directory is the fallback root, the cwd
191
- * itself the last resort.
191
+ * itself the last resort. A bare workflows root is only a candidate: a
192
+ * kraftwerk.yml further up whose `workflows:` is that very folder wins, so
193
+ * a command run inside the workspace's own data (kraftwerk-data/projects/<slug>,
194
+ * next to kraftwerk-data/workflows) still finds the workspace.
192
195
  */
193
196
  export async function resolveProject(cwd) {
194
197
  const start = path.resolve(cwd);
195
198
  let gitFallback;
199
+ let bare;
196
200
  for (let dir = start;; dir = path.dirname(dir)) {
197
201
  const configPath = await findConfigFile(dir);
198
202
  if (configPath) {
199
- const config = await loadConfig(configPath);
200
- return {
201
- root: dir,
202
- config,
203
- configPath,
204
- workflowsRoot: await findWorkflowsDir(dir, config.workflows),
205
- outputDir: path.resolve(dir, config.output ?? "output"),
206
- };
203
+ // Above a bare candidate an unreadable kraftwerk.yml is someone else's problem.
204
+ const config = bare ? await loadConfig(configPath).catch(() => null) : await loadConfig(configPath);
205
+ if (!config)
206
+ return bare;
207
+ const workflowsRoot = await findWorkflowsDir(dir, config.workflows);
208
+ if (!bare || (workflowsRoot && path.resolve(workflowsRoot) === bare.workflowsRoot)) {
209
+ return { root: dir, config, configPath, workflowsRoot, outputDir: path.resolve(dir, config.output ?? "output") };
210
+ }
211
+ return bare;
207
212
  }
208
- const workflowsRoot = await findWorkflowsDir(dir);
209
- if (workflowsRoot) {
210
- return { root: dir, config: {}, workflowsRoot, outputDir: path.join(dir, "output") };
213
+ if (!bare) {
214
+ const workflowsRoot = await findWorkflowsDir(dir);
215
+ if (workflowsRoot)
216
+ bare = { root: dir, config: {}, workflowsRoot, outputDir: path.join(dir, "output") };
211
217
  }
212
218
  if (!gitFallback && (await exists(path.join(dir, ".git"))))
213
219
  gitFallback = dir;
214
220
  if (dir === path.dirname(dir))
215
221
  break;
216
222
  }
223
+ if (bare)
224
+ return bare;
217
225
  const root = gitFallback ?? start;
218
226
  return { root, config: {}, outputDir: path.join(root, "output") };
219
227
  }
@@ -0,0 +1 @@
1
+ import{a as e}from"./editor-dsYnSWbf.js";export{e as markdown};