From e6f0e0f1097f862ac7fd0e1fc20b257d3d5508a2 Mon Sep 17 00:00:00 2001 From: Pawel Kosiec Date: Tue, 2 Jun 2026 12:58:41 +0200 Subject: [PATCH] feat: copy databricks.yml.tmpl to pre-rendered app templates The generate-app-templates script now copies databricks.yml.tmpl from the source template into each generated app directory. This enables `databricks apps init --template ` to render resource blocks, target variables, and project identity via --set values. The static databricks.yml remains as a readable reference; the CLI's copyTemplate() lexical walk order ensures the .tmpl version overwrites it in the output. Co-authored-by: Isaac --- tools/generate-app-templates.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/generate-app-templates.ts b/tools/generate-app-templates.ts index 742b81b7..9f911d47 100644 --- a/tools/generate-app-templates.ts +++ b/tools/generate-app-templates.ts @@ -193,7 +193,19 @@ function postProcess(appDir: string, app: AppTemplate): void { const envTmplBody = readFileSync(join(TEMPLATE_PATH, ".env.tmpl"), "utf-8"); writeFileSync(join(appDir, ".env.tmpl"), envTmplHeader + envTmplBody); - // 2. Sync appkit.plugins.json based on server imports (discovers available plugins + // 2. Copy databricks.yml.tmpl from the source template so that + // `databricks apps init --template ` can render it + // with the user's project name, workspace host, and --set values. + // The static databricks.yml remains as a readable reference; + // copyTemplate()'s lexical walk order ensures the .tmpl version + // overwrites it in the output. + const databricksYmlTmpl = readFileSync( + join(TEMPLATE_PATH, "databricks.yml.tmpl"), + "utf-8", + ); + writeFileSync(join(appDir, "databricks.yml.tmpl"), databricksYmlTmpl); + + // 3. Sync appkit.plugins.json based on server imports (discovers available plugins // and marks the ones used in the plugins array as required). const syncStatus = run( "node", @@ -205,7 +217,7 @@ function postProcess(appDir: string, app: AppTemplate): void { process.exit(syncStatus); } - // 3. Replace the resolved workspace host URL with a placeholder. + // 4. Replace the resolved workspace host URL with a placeholder. const databricksYmlPath = join(appDir, "databricks.yml"); const yml = readFileSync(databricksYmlPath, "utf-8"); const fixedYml = yml.replace(