5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-17 01:19:29 +08:00

Improved project generation

This commit is contained in:
Lea Anthony 2020-11-21 11:56:01 +11:00
parent aa271d6498
commit 7f02f6886f
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
4 changed files with 23 additions and 11 deletions

View File

@ -177,8 +177,6 @@ func findAuthorDetails(options *templates.Options) error {
return err
}
options.AuthorEmail = strings.TrimSpace(email)
println("Name", name, "Email", email)
}
return nil

View File

@ -22,13 +22,14 @@ var templateCache []Template = nil
// Data contains the data we wish to embed during template installation
type Data struct {
ProjectName string
BinaryName string
WailsVersion string
NPMProjectName string
AuthorName string
AuthorEmail string
WailsDirectory string
ProjectName string
BinaryName string
WailsVersion string
NPMProjectName string
AuthorName string
AuthorEmail string
AuthorNameAndEmail string
WailsDirectory string
}
// Options for installing a template
@ -232,6 +233,15 @@ func Install(options *Options) error {
AuthorName: options.AuthorName,
}
// Create a formatted name and email combo.
if options.AuthorName != "" {
templateData.AuthorNameAndEmail = options.AuthorName + " "
}
if options.AuthorEmail != "" {
templateData.AuthorNameAndEmail += "<" + options.AuthorEmail + ">"
}
templateData.AuthorNameAndEmail = strings.TrimSpace(templateData.AuthorNameAndEmail)
// Extract the template
err = installer.Extract(options.TargetDir, templateData)
if err != nil {

View File

@ -1,6 +1,6 @@
{
"name": "vuetify2",
"author": "Travis McLane<tmclane@gmail.com>",
"author": "{{.AuthorNameAndEmail}}",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",

View File

@ -5,5 +5,9 @@
"js": "frontend/dist/app.js",
"css": "frontend/dist/app.css",
"frontend:build": "npm run build",
"frontend:install": "npm install"
"frontend:install": "npm install",
"author": {
"name": "{{.AuthorName}}",
"email": "{{.AuthorEmail}}"
}
}