@@ -40,6 +40,13 @@ const (
4040 appkitDefaultBranch = "main"
4141 appkitTemplateTagPfx = "template-v"
4242 defaultProfile = "DEFAULT"
43+
44+ // projectNamePlaceholder is the Go template variable used in template
45+ // directory names to stand in for the user-provided project name.
46+ projectNamePlaceholder = "{{.project_name}}"
47+
48+ // bundleConfigFile is the standard bundle configuration filename.
49+ bundleConfigFile = "databricks.yml"
4350)
4451
4552// normalizeVersion converts a version string to the template tag format "template-vX.X.X".
@@ -649,11 +656,11 @@ func isPreRenderedTemplate(templateDir string) bool {
649656 return false
650657 }
651658 for _ , e := range entries {
652- if e .IsDir () && strings .Contains (e .Name (), "{{.project_name}}" ) {
659+ if e .IsDir () && strings .Contains (e .Name (), projectNamePlaceholder ) {
653660 return false
654661 }
655662 }
656- data , err := os .ReadFile (filepath .Join (templateDir , "databricks.yml" ))
663+ data , err := os .ReadFile (filepath .Join (templateDir , bundleConfigFile ))
657664 if err != nil {
658665 // No databricks.yml — can't tell, assume normal template.
659666 return false
@@ -682,17 +689,18 @@ func replaceProjectName(destDir, newName string) error {
682689 }
683690
684691 // Update databricks.yml: bundle name and app name.
685- ymlPath := filepath .Join (destDir , "databricks.yml" )
692+ ymlPath := filepath .Join (destDir , bundleConfigFile )
686693 data , err := os .ReadFile (ymlPath )
687694 if err != nil {
688- return nil
695+ // File may not exist for non-bundle templates; not an error.
696+ return err //nolint:nilerr
689697 }
690698 content := string (data )
691699
692700 // Read the original bundle name so we can do a targeted replace of the
693701 // app resource name that usually matches it.
694702 origName := ""
695- for _ , line := range strings .Split (content , "\n " ) {
703+ for line := range strings .SplitSeq (content , "\n " ) {
696704 trimmed := strings .TrimSpace (line )
697705 if strings .HasPrefix (trimmed , "name:" ) && origName == "" {
698706 origName = strings .TrimSpace (strings .TrimPrefix (trimmed , "name:" ))
@@ -719,7 +727,7 @@ func findProjectSrcDir(templateDir string) string {
719727 return templateDir
720728 }
721729 for _ , e := range entries {
722- if e .IsDir () && strings .Contains (e .Name (), "{{.project_name}}" ) {
730+ if e .IsDir () && strings .Contains (e .Name (), projectNamePlaceholder ) {
723731 return filepath .Join (templateDir , e .Name ())
724732 }
725733 }
@@ -1172,7 +1180,7 @@ func runCreate(ctx context.Context, opts createOptions) error {
11721180 if ! mandatory [p ] {
11731181 log .Warnf (ctx , "Feature %q is not supported by this pre-rendered template and will be ignored." +
11741182 " Only .env will include its configuration." +
1175- " To use all features dynamically, use the default AppKit template instead ." , p )
1183+ " To use all features dynamically, run `databricks apps init` without --template ." , p )
11761184 }
11771185 }
11781186 }
@@ -1532,7 +1540,7 @@ func copyTemplate(ctx context.Context, src, dest string, vars templateVars) (int
15321540 return 0 , err
15331541 }
15341542 for _ , e := range entries {
1535- if e .IsDir () && strings .Contains (e .Name (), "{{.project_name}}" ) {
1543+ if e .IsDir () && strings .Contains (e .Name (), projectNamePlaceholder ) {
15361544 srcProjectDir = filepath .Join (src , e .Name ())
15371545 break
15381546 }
0 commit comments