fix(cli): make wmill app new respects nonDottedPaths setting from wmill.yaml (#7700)

* update dnt

* fix nondottedpath settings
This commit is contained in:
centdix
2026-01-27 15:14:42 +00:00
committed by GitHub
parent bad86d862f
commit 6899a16efb
5 changed files with 92 additions and 52 deletions
+47 -1
View File
@@ -8,7 +8,10 @@
* (.flow, .app, .raw_app) or dunder-prefixed names (__flow, __app, __raw_app).
*/
import { log, SEP } from "../../deps.ts";
import { log, SEP, yamlParseFile } from "../../deps.ts";
import * as fs from "node:fs";
import * as path from "node:path";
import process from "node:process";
// Resource types that use folder-based storage
export type FolderResourceType = "flow" | "app" | "raw_app";
@@ -56,6 +59,49 @@ export function getNonDottedPaths(): boolean {
return _nonDottedPaths;
}
/**
* Search for wmill.yaml by traversing upward from the current directory
* and initialize the nonDottedPaths setting.
* Unlike findWmillYaml() in conf.ts, this does not stop at the git root -
* it continues searching until the filesystem root.
* This is needed for commands like `app dev` and `app new` which may run
* from inside folders that are deeply nested within a larger git repository.
*/
export async function loadNonDottedPathsSetting(): Promise<void> {
let currentDir = process.cwd();
while (true) {
const wmillYamlPath = path.join(currentDir, "wmill.yaml");
if (fs.existsSync(wmillYamlPath)) {
try {
const config = (await yamlParseFile(wmillYamlPath)) as {
nonDottedPaths?: boolean;
};
setNonDottedPaths(config?.nonDottedPaths ?? false);
log.debug(
`Found wmill.yaml at ${wmillYamlPath}, nonDottedPaths=${
config?.nonDottedPaths ?? false
}`
);
} catch (e) {
log.debug(`Failed to parse wmill.yaml at ${wmillYamlPath}: ${e}`);
}
return;
}
// Check if we've reached the filesystem root
const parentDir = path.dirname(currentDir);
if (parentDir === currentDir) {
// Reached filesystem root without finding wmill.yaml
log.debug("No wmill.yaml found, using default dotted paths");
return;
}
currentDir = parentDir;
}
}
/**
* Get the folder suffixes based on the global configuration.
*/