mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-17 09:29:30 +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
|
return err
|
||||||
}
|
}
|
||||||
options.AuthorEmail = strings.TrimSpace(email)
|
options.AuthorEmail = strings.TrimSpace(email)
|
||||||
|
|
||||||
println("Name", name, "Email", email)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -22,13 +22,14 @@ var templateCache []Template = nil
|
|||||||
|
|
||||||
// Data contains the data we wish to embed during template installation
|
// Data contains the data we wish to embed during template installation
|
||||||
type Data struct {
|
type Data struct {
|
||||||
ProjectName string
|
ProjectName string
|
||||||
BinaryName string
|
BinaryName string
|
||||||
WailsVersion string
|
WailsVersion string
|
||||||
NPMProjectName string
|
NPMProjectName string
|
||||||
AuthorName string
|
AuthorName string
|
||||||
AuthorEmail string
|
AuthorEmail string
|
||||||
WailsDirectory string
|
AuthorNameAndEmail string
|
||||||
|
WailsDirectory string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Options for installing a template
|
// Options for installing a template
|
||||||
@ -232,6 +233,15 @@ func Install(options *Options) error {
|
|||||||
AuthorName: options.AuthorName,
|
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
|
// Extract the template
|
||||||
err = installer.Extract(options.TargetDir, templateData)
|
err = installer.Extract(options.TargetDir, templateData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "vuetify2",
|
"name": "vuetify2",
|
||||||
"author": "Travis McLane<tmclane@gmail.com>",
|
"author": "{{.AuthorNameAndEmail}}",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
@ -5,5 +5,9 @@
|
|||||||
"js": "frontend/dist/app.js",
|
"js": "frontend/dist/app.js",
|
||||||
"css": "frontend/dist/app.css",
|
"css": "frontend/dist/app.css",
|
||||||
"frontend:build": "npm run build",
|
"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