Skip to content

Commit

Permalink
remove unnecessary files from template repos
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Vlasic committed Dec 6, 2021
1 parent 00e3cb2 commit 0c028b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
24 changes: 18 additions & 6 deletions cli/controller/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,24 @@ import (
"github.com/mantil-io/mantil/kit/git"
)

const (
PingTemplate = "ping"
ExcusesTemplate = "excuses"
ChatTemplate = "chat"
TodoTemplate = "todo"
)

var TemplateRepos = map[string]string{
"ping": "https://github.com/mantil-io/template-ping",
"excuses": "https://github.com/mantil-io/template-excuses",
"chat": "https://github.com/mantil-io/template-chat",
"todo": "https://github.com/mantil-io/template-todo",
PingTemplate: "https://github.com/mantil-io/template-ping",
ExcusesTemplate: "https://github.com/mantil-io/template-excuses",
ChatTemplate: "https://github.com/mantil-io/template-chat",
TodoTemplate: "https://github.com/mantil-io/template-todo",
}

const (
DefaultTemplate = "ping"
DefaultTemplate = PingTemplate
LicenseFile = "LICENSE"
ReadmeFile = "README.md"
)

type NewArgs struct {
Expand Down Expand Up @@ -61,9 +69,13 @@ func createProject(name, from, moduleName string) error {

}

// delete LICENSE from template repositories
// delete unnecessary files from template repositories
if !isExternalRepo(from) {
os.Remove(filepath.Join(projectPath, LicenseFile))
os.Remove(filepath.Join(projectPath, ReadmeFile))
if from == ExcusesTemplate {
os.Remove(filepath.Join(projectPath, "excuses.png"))
}
}
// create .gitignore with BuildDir
generateGitignore(projectPath, BuildDir)
Expand Down
1 change: 1 addition & 0 deletions texts/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ The source can either be an existing git repository or one of the predefined tem
ping - https://github.com/mantil-io/template-ping
excuses - https://github.com/mantil-io/template-excuses
chat - https://github.com/mantil-io/template-chat
todo - https://github.com/mantil-io/template-todo
If no source is provided it will default to the template "ping".
Expand Down

0 comments on commit 0c028b3

Please sign in to comment.