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 16:14:42 +01:00
committed by GitHub
parent bad86d862f
commit 6899a16efb
5 changed files with 92 additions and 52 deletions
Generated
+35 -5
View File
@@ -2,8 +2,10 @@
"version": "5",
"specifiers": {
"jsr:@david/code-block-writer@^13.0.2": "13.0.2",
"jsr:@david/code-block-writer@^13.0.3": "13.0.3",
"jsr:@deno/cache-dir@~0.10.3": "0.10.3",
"jsr:@deno/dnt@0.41.3": "0.41.3",
"jsr:@deno/dnt@0.42.3": "0.42.3",
"jsr:@deno/dnt@~0.41.3": "0.41.3",
"jsr:@deno/graph@~0.73.1": "0.73.1",
"jsr:@std/assert@0.223": "0.223.0",
@@ -20,7 +22,7 @@
"jsr:@std/fmt@~0.225.4": "0.225.6",
"jsr:@std/fs@*": "1.0.22",
"jsr:@std/fs@0.223": "0.223.0",
"jsr:@std/fs@1": "1.0.20",
"jsr:@std/fs@1": "1.0.22",
"jsr:@std/fs@^1.0.11": "1.0.22",
"jsr:@std/fs@^1.0.21": "1.0.22",
"jsr:@std/fs@~0.229.3": "0.229.3",
@@ -32,7 +34,7 @@
"jsr:@std/log@*": "0.224.14",
"jsr:@std/path@*": "1.1.4",
"jsr:@std/path@0.223": "0.223.0",
"jsr:@std/path@1": "1.1.3",
"jsr:@std/path@1": "1.1.4",
"jsr:@std/path@1.0.0-rc.1": "1.0.0-rc.1",
"jsr:@std/path@1.0.0-rc.2": "1.0.0-rc.2",
"jsr:@std/path@^1.1.3": "1.1.4",
@@ -42,7 +44,9 @@
"jsr:@std/yaml@*": "1.0.10",
"jsr:@std/yaml@^1.0.10": "1.0.10",
"jsr:@ts-morph/bootstrap@0.24": "0.24.0",
"jsr:@ts-morph/bootstrap@0.27": "0.27.0",
"jsr:@ts-morph/common@0.24": "0.24.0",
"jsr:@ts-morph/common@0.27": "0.27.0",
"jsr:@windmill-labs/cliffy-ansi@1.0.0-rc.5": "1.0.0-rc.5",
"jsr:@windmill-labs/cliffy-command@1.0.0-rc.5": "1.0.0-rc.5",
"jsr:@windmill-labs/cliffy-flags@1.0.0-rc.5": "1.0.0-rc.5",
@@ -90,6 +94,9 @@
"@david/code-block-writer@13.0.2": {
"integrity": "14dd3baaafa3a2dea8bf7dfbcddeccaa13e583da2d21d666c01dc6d681cd74ad"
},
"@david/code-block-writer@13.0.3": {
"integrity": "f98c77d320f5957899a61bfb7a9bead7c6d83ad1515daee92dbacc861e13bb7f"
},
"@deno/cache-dir@0.10.3": {
"integrity": "eb022f84ecc49c91d9d98131c6e6b118ff63a29e343624d058646b9d50404776",
"dependencies": [
@@ -103,12 +110,22 @@
"@deno/dnt@0.41.3": {
"integrity": "b2ef2c8a5111eef86cb5bfcae103d6a2938e8e649e2461634a7befb7fc59d6d2",
"dependencies": [
"jsr:@david/code-block-writer",
"jsr:@david/code-block-writer@^13.0.2",
"jsr:@deno/cache-dir",
"jsr:@std/fmt@1",
"jsr:@std/fs@1",
"jsr:@std/path@1",
"jsr:@ts-morph/bootstrap"
"jsr:@ts-morph/bootstrap@0.24"
]
},
"@deno/dnt@0.42.3": {
"integrity": "62a917a0492f3c8af002dce90605bb0d41f7d29debc06aca40dba72ab65d8ae3",
"dependencies": [
"jsr:@david/code-block-writer@^13.0.3",
"jsr:@std/fmt@1",
"jsr:@std/fs@1",
"jsr:@std/path@1",
"jsr:@ts-morph/bootstrap@0.27"
]
},
"@deno/graph@0.73.1": {
@@ -236,7 +253,13 @@
"@ts-morph/bootstrap@0.24.0": {
"integrity": "a826a2ef7fa8a7c3f1042df2c034d20744d94da2ee32bf29275bcd4dffd3c060",
"dependencies": [
"jsr:@ts-morph/common"
"jsr:@ts-morph/common@0.24"
]
},
"@ts-morph/bootstrap@0.27.0": {
"integrity": "b8d7bc8f7942ce853dde4161b28f9aa96769cef3d8eebafb379a81800b9e2448",
"dependencies": [
"jsr:@ts-morph/common@0.27"
]
},
"@ts-morph/common@0.24.0": {
@@ -246,6 +269,13 @@
"jsr:@std/path@~0.225.2"
]
},
"@ts-morph/common@0.27.0": {
"integrity": "c7b73592d78ce8479b356fd4f3d6ec3c460d77753a8680ff196effea7a939052",
"dependencies": [
"jsr:@std/fs@1",
"jsr:@std/path@1"
]
},
"@windmill-labs/cliffy-ansi@1.0.0-rc.5": {
"integrity": "1109cbcb0c415b57779352f708f5969b8c645f56bc555cbafc6ea5e0c6a360a4",
"dependencies": [
+1 -1
View File
@@ -1,5 +1,5 @@
// ex. scripts/build_npm.ts
import { build, emptyDir } from "jsr:@deno/dnt@0.41.3";
import { build, emptyDir } from "jsr:@deno/dnt@0.42.3";
import { VERSION } from "./src/main.ts";
await emptyDir("./npm");
+2 -44
View File
@@ -39,54 +39,12 @@ import { regenerateAgentDocs } from "./generate_agents.ts";
import {
getFolderSuffix,
hasFolderSuffix,
setNonDottedPaths,
loadNonDottedPathsSetting,
} from "../../utils/resource_folders.ts";
const DEFAULT_PORT = 4000;
const DEFAULT_HOST = "localhost";
/**
* Search for wmill.yaml by traversing upward from the current directory.
* Unlike the standard findWmillYaml() in conf.ts, this does not stop at
* the git root - it continues searching until the filesystem root.
* This is needed for `app dev` which runs from inside a raw_app folder
* that may be deeply nested within a larger git repository.
*/
async function findAndLoadNonDottedPathsSetting(): 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;
}
}
// HTML template with live reload and SQL migration modal
const createHTML = (jsPath: string, cssPath: string) => `
<!DOCTYPE html>
@@ -353,7 +311,7 @@ async function dev(opts: DevOptions) {
// Search for wmill.yaml by traversing upward (without git root constraint)
// to initialize nonDottedPaths setting before using folder suffix functions
await findAndLoadNonDottedPathsSetting();
await loadNonDottedPathsSetting();
// Validate that we're in a .raw_app folder
const cwd = process.cwd();
+7 -1
View File
@@ -14,7 +14,10 @@ import { resolveWorkspace } from "../../core/context.ts";
import { requireLogin } from "../../core/auth.ts";
import * as wmill from "../../../gen/services.gen.ts";
import path from "node:path";
import { buildFolderPath } from "../../utils/resource_folders.ts";
import {
buildFolderPath,
loadNonDottedPathsSetting,
} from "../../utils/resource_folders.ts";
// Framework templates - adapted from frontend/src/routes/(root)/(logged)/apps_raw/add/templates.ts
const reactIndex = `
@@ -472,6 +475,9 @@ CREATE SCHEMA IF NOT EXISTS ${schemaName};
);
}
// Load nonDottedPaths setting from wmill.yaml before creating folder
await loadNonDottedPathsSetting();
// Create the directory structure - preserve full path (e.g., f/foobar/x/y becomes f/foobar/x/y.raw_app)
const folderName = buildFolderPath(appPath, "raw_app");
const appDir = path.join(Deno.cwd(), folderName);
+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.
*/