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:
parent
aa271d6498
commit
7f02f6886f
@ -177,8 +177,6 @@ func findAuthorDetails(options *templates.Options) error {
|
||||
return err
|
||||
}
|
||||
options.AuthorEmail = strings.TrimSpace(email)
|
||||
|
||||
println("Name", name, "Email", email)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -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 {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "vuetify2",
|
||||
"author": "Travis McLane<tmclane@gmail.com>",
|
||||
"author": "{{.AuthorNameAndEmail}}",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
@ -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}}"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user