diff --git a/cmd/frameworks.go b/cmd/frameworks.go
new file mode 100644
index 000000000..610a5254f
--- /dev/null
+++ b/cmd/frameworks.go
@@ -0,0 +1,69 @@
+package cmd
+
+import (
+ "encoding/json"
+ "io/ioutil"
+ "path"
+ "path/filepath"
+ "runtime"
+)
+
+// FrameworkMetadata contains information about a given framework
+type FrameworkMetadata struct {
+ Name string `json:"name"`
+ BuildTag string `json:"buildtag"`
+ Description string `json:"description"`
+}
+
+// Utility function for creating new FrameworkMetadata structs
+func loadFrameworkMetadata(pathToMetadataJSON string) (*FrameworkMetadata, error) {
+ result := &FrameworkMetadata{}
+ configData, err := ioutil.ReadFile(pathToMetadataJSON)
+ if err != nil {
+ return nil, err
+ }
+ // Load and unmarshall!
+ err = json.Unmarshal(configData, result)
+ if err != nil {
+ return nil, err
+ }
+ return result, nil
+}
+
+// GetFrameworks returns information about all the available frameworks
+func GetFrameworks() ([]*FrameworkMetadata, error) {
+
+ var err error
+
+ // Calculate framework base dir
+ _, filename, _, _ := runtime.Caller(1)
+ frameworksBaseDir := filepath.Join(path.Dir(filename), "frameworks")
+
+ // Get the subdirectories
+ fs := NewFSHelper()
+ frameworkDirs, err := fs.GetSubdirs(frameworksBaseDir)
+ if err != nil {
+ return nil, err
+ }
+
+ // Prepare result
+ result := []*FrameworkMetadata{}
+
+ // Iterate framework directories, looking for metadata.json files
+ for _, frameworkDir := range frameworkDirs {
+ var frameworkMetadata FrameworkMetadata
+ metadataFile := filepath.Join(frameworkDir, "metadata.json")
+ jsonData, err := ioutil.ReadFile(metadataFile)
+ if err != nil {
+ return nil, err
+ }
+ err = json.Unmarshal(jsonData, &frameworkMetadata)
+ if err != nil {
+ return nil, err
+ }
+ result = append(result, &frameworkMetadata)
+ }
+
+ // Read in framework metadata
+ return result, nil
+}
diff --git a/cmd/project.go b/cmd/project.go
new file mode 100644
index 000000000..682db2eaf
--- /dev/null
+++ b/cmd/project.go
@@ -0,0 +1,336 @@
+package cmd
+
+import (
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "path/filepath"
+ "strings"
+
+ "github.com/AlecAivazis/survey"
+)
+
+type author struct {
+ Name string `json:"name"`
+ Email string `json:"email"`
+}
+
+type frontend struct {
+ Dir string `json:"dir"`
+ Install string `json:"install"`
+ Build string `json:"build"`
+}
+
+type framework struct {
+ Name string `json:"name"`
+ BuildTag string `json:"buildtag"`
+ Options map[string]string `json:"options,omitempty"`
+}
+
+// ProjectHelper is a helper struct for managing projects
+type ProjectHelper struct {
+ log *Logger
+ system *SystemHelper
+ templates *TemplateHelper
+}
+
+// NewProjectHelper creates a new Project helper struct
+func NewProjectHelper() *ProjectHelper {
+ return &ProjectHelper{
+ log: NewLogger(),
+ system: NewSystemHelper(),
+ templates: NewTemplateHelper(),
+ }
+}
+
+// GenerateProject generates a new project using the options given
+func (ph *ProjectHelper) GenerateProject(projectOptions *ProjectOptions) error {
+
+ fs := NewFSHelper()
+ exists, err := ph.templates.TemplateExists(projectOptions.Template)
+ if err != nil {
+ return err
+ }
+
+ if !exists {
+ return fmt.Errorf("template '%s' is invalid", projectOptions.Template)
+ }
+
+ // Calculate project path
+ projectPath, err := filepath.Abs(projectOptions.OutputDirectory)
+ if err != nil {
+ return err
+ }
+
+ if fs.DirExists(projectPath) {
+ return fmt.Errorf("directory '%s' already exists", projectPath)
+ }
+
+ // Create project directory
+ err = fs.MkDir(projectPath)
+ if err != nil {
+ return err
+ }
+
+ // Create and save project config
+ err = projectOptions.WriteProjectConfig()
+ if err != nil {
+ return err
+ }
+
+ err = ph.templates.InstallTemplate(projectPath, projectOptions)
+ if err != nil {
+ return err
+ }
+ ph.log.Yellow("Project '%s' generated in directory '%s'!", projectOptions.Name, projectOptions.OutputDirectory)
+ ph.log.Yellow("To compile the project, run 'wails build' in the project directory.")
+ return nil
+}
+
+// LoadProjectConfig loads the project config from the given directory
+func (ph *ProjectHelper) LoadProjectConfig(dir string) (*ProjectOptions, error) {
+ po := ph.NewProjectOptions()
+ err := po.LoadConfig(dir)
+ return po, err
+}
+
+// NewProjectOptions creates a new default set of project options
+func (ph *ProjectHelper) NewProjectOptions() *ProjectOptions {
+ result := ProjectOptions{
+ Name: "",
+ Description: "Enter your project description",
+ Version: "0.1.0",
+ BinaryName: "",
+ system: NewSystemHelper(),
+ log: NewLogger(),
+ templates: NewTemplateHelper(),
+ templateNameMap: make(map[string]string),
+ Author: &author{},
+ }
+
+ // Populate system config
+ config, err := ph.system.LoadConfig()
+ if err == nil {
+ result.Author.Name = config.Name
+ result.Author.Email = config.Email
+ }
+
+ return &result
+}
+
+// SelectQuestion creates a new select type question for Survey
+func SelectQuestion(name, message string, options []string, defaultValue string, required bool) *survey.Question {
+ result := survey.Question{
+ Name: name,
+ Prompt: &survey.Select{
+ Message: message,
+ Options: options,
+ Default: defaultValue,
+ },
+ }
+ if required {
+ result.Validate = survey.Required
+ }
+ return &result
+}
+
+// InputQuestion creates a new input type question for Survey
+func InputQuestion(name, message string, defaultValue string, required bool) *survey.Question {
+ result := survey.Question{
+ Name: name,
+ Prompt: &survey.Input{
+ Message: message + ":",
+ Default: defaultValue,
+ },
+ }
+ if required {
+ result.Validate = survey.Required
+ }
+ return &result
+}
+
+// ProjectOptions holds all the options available for a project
+type ProjectOptions struct {
+ Name string `json:"name"`
+ Description string `json:"description"`
+ Author *author `json:"author,omitempty"`
+ Version string `json:"version"`
+ OutputDirectory string `json:"-"`
+ UseDefaults bool `json:"-"`
+ Template string `json:"-"`
+ BinaryName string `json:"binaryname"`
+ FrontEnd *frontend `json:"frontend,omitempty"`
+ NPMProjectName string `json:"-"`
+ Framework *framework `json:"framework,omitempty"`
+ system *SystemHelper
+ log *Logger
+ templates *TemplateHelper
+ templateNameMap map[string]string // Converts template prompt text to template name
+}
+
+// Defaults sets the default project template
+func (po *ProjectOptions) Defaults() {
+ po.Template = "basic"
+}
+
+// PromptForInputs asks the user to input project details
+func (po *ProjectOptions) PromptForInputs() error {
+
+ var questions []*survey.Question
+ fs := NewFSHelper()
+
+ if po.Name == "" {
+ questions = append(questions, InputQuestion("Name", "The name of the project", "My Project", true))
+ } else {
+ fmt.Println("Project Name: " + po.Name)
+ }
+
+ if po.BinaryName == "" {
+ var binaryNameComputed string
+ if po.Name != "" {
+ binaryNameComputed = strings.ToLower(po.Name)
+ binaryNameComputed = strings.Replace(binaryNameComputed, " ", "-", -1)
+ binaryNameComputed = strings.Replace(binaryNameComputed, string(filepath.Separator), "-", -1)
+ binaryNameComputed = strings.Replace(binaryNameComputed, ":", "-", -1)
+ }
+ questions = append(questions, InputQuestion("BinaryName", "The output binary name", binaryNameComputed, true))
+ } else {
+ fmt.Println("Output binary Name: " + po.BinaryName)
+ }
+
+ if po.OutputDirectory != "" {
+ projectPath, err := filepath.Abs(po.OutputDirectory)
+ if err != nil {
+ return err
+ }
+
+ if fs.DirExists(projectPath) {
+ return fmt.Errorf("directory '%s' already exists", projectPath)
+ }
+
+ fmt.Println("Project Directory: " + po.OutputDirectory)
+ } else {
+ questions = append(questions, InputQuestion("OutputDirectory", "Project directory name", "", true))
+ }
+
+ templateDetails, err := po.templates.GetTemplateDetails()
+ if err != nil {
+ return err
+ }
+
+ templates := []string{}
+ // Add a Custom Template
+ // templates = append(templates, "Custom - Choose your own CSS framework")
+ for templateName, templateDetails := range templateDetails {
+ templateText := templateName
+ // Check if metadata json exists
+ if templateDetails.Metadata != nil {
+ shortdescription := templateDetails.Metadata["shortdescription"]
+ if shortdescription != "" {
+ templateText += " - " + shortdescription.(string)
+ }
+ }
+ templates = append(templates, templateText)
+ po.templateNameMap[templateText] = templateName
+ }
+
+ if po.Template != "" {
+ if _, ok := templateDetails[po.Template]; !ok {
+ po.log.Error("Template '%s' invalid.", po.Template)
+ questions = append(questions, SelectQuestion("Template", "Select template", templates, templates[0], true))
+ }
+ } else {
+ questions = append(questions, SelectQuestion("Template", "Select template", templates, templates[0], true))
+ }
+
+ err = survey.Ask(questions, po)
+ if err != nil {
+ return err
+ }
+
+ // Setup NPM Project name
+ po.NPMProjectName = strings.Replace(po.Name, " ", "_", -1)
+
+ // If we selected custom, prompt for framework
+ if po.Template == "custom - Choose your own CSS Framework" {
+ // Ask for the framework
+ var frameworkName string
+ frameworks, err := GetFrameworks()
+ fmt.Printf("Frameworks = %+v\n", frameworks)
+ frameworkNames := []string{}
+ metadataMap := make(map[string]*FrameworkMetadata)
+ for _, frameworkMetadata := range frameworks {
+ frameworkDetails := fmt.Sprintf("%s - %s", frameworkMetadata.Name, frameworkMetadata.Description)
+ metadataMap[frameworkDetails] = frameworkMetadata
+ frameworkNames = append(frameworkNames, frameworkDetails)
+ }
+ if err != nil {
+ return err
+ }
+ var frameworkQuestion []*survey.Question
+ frameworkQuestion = append(frameworkQuestion, SelectQuestion("Framework", "Select framework", frameworkNames, frameworkNames[0], true))
+ err = survey.Ask(frameworkQuestion, &frameworkName)
+ if err != nil {
+ return err
+ }
+ // Get metadata
+ metadata := metadataMap[frameworkName]
+
+ // Add to project config
+ po.Framework = &framework{
+ Name: metadata.Name,
+ BuildTag: metadata.BuildTag,
+ }
+
+ }
+
+ // Fix template name
+ if po.templateNameMap[po.Template] != "" {
+ po.Template = po.templateNameMap[po.Template]
+ }
+
+ // Populate template details
+ templateMetadata := templateDetails[po.Template].Metadata
+ if templateMetadata["frontenddir"] != nil {
+ po.FrontEnd = &frontend{}
+ po.FrontEnd.Dir = templateMetadata["frontenddir"].(string)
+ }
+ if templateMetadata["install"] != nil {
+ if po.FrontEnd == nil {
+ return fmt.Errorf("install set in template metadata but not frontenddir")
+ }
+ po.FrontEnd.Install = templateMetadata["install"].(string)
+ }
+ if templateMetadata["build"] != nil {
+ if po.FrontEnd == nil {
+ return fmt.Errorf("build set in template metadata but not frontenddir")
+ }
+ po.FrontEnd.Build = templateMetadata["build"].(string)
+ }
+
+ return nil
+}
+
+func (po *ProjectOptions) WriteProjectConfig() error {
+ targetDir, err := filepath.Abs(po.OutputDirectory)
+ if err != nil {
+ return err
+ }
+
+ targetFile := filepath.Join(targetDir, "project.json")
+ filedata, err := json.MarshalIndent(po, "", " ")
+ if err != nil {
+ return err
+ }
+
+ return ioutil.WriteFile(targetFile, filedata, 0600)
+}
+
+func (po *ProjectOptions) LoadConfig(projectDir string) error {
+ targetFile := filepath.Join(projectDir, "project.json")
+ rawBytes, err := ioutil.ReadFile(targetFile)
+ if err != nil {
+ return err
+ }
+ return json.Unmarshal(rawBytes, po)
+}
diff --git a/cmd/system.go b/cmd/system.go
index c8dd6a35a..d61cd8474 100644
--- a/cmd/system.go
+++ b/cmd/system.go
@@ -6,10 +6,12 @@ import (
"io/ioutil"
"log"
"path/filepath"
+ "runtime"
"strconv"
"time"
"github.com/AlecAivazis/survey"
+ "github.com/leaanthony/spinner"
homedir "github.com/mitchellh/go-homedir"
)
@@ -137,6 +139,16 @@ Wails is a lightweight framework for creating web-like desktop apps in Go.
I'll need to ask you a few questions so I can fill in your project templates and then I will try and see if you have the correct dependencies installed. If you don't have the right tools installed, I'll try and suggest how to install them.
`
+// CheckInitialised checks if the system has been set up
+// and if not, runs setup
+func (s *SystemHelper) CheckInitialised() error {
+ if !s.systemDirExists() {
+ s.log.Yellow("System not initialised. Running setup.")
+ return s.setup()
+ }
+ return nil
+}
+
// Initialise attempts to set up the Wails system.
// An error is returns if there is a problem
func (s *SystemHelper) Initialise() error {
@@ -208,3 +220,71 @@ func (sc *SystemConfig) load(filename string) error {
}
return nil
}
+
+// CheckDependencies will look for Wails dependencies on the system
+// Errors are reported in error and the bool return value is whether
+// the dependencies are all installed.
+func CheckDependencies(logger *Logger) (error, bool) {
+
+ switch runtime.GOOS {
+ case "darwin":
+ logger.Yellow("Detected Platform: OSX")
+ case "windows":
+ logger.Yellow("Detected Platform: Windows")
+ case "linux":
+ logger.Yellow("Detected Platform: Linux")
+ default:
+ return fmt.Errorf("Platform %s is currently not supported", runtime.GOOS), false
+ }
+
+ logger.Yellow("Checking for prerequisites...")
+ // Check we have a cgo capable environment
+
+ requiredPrograms, err := GetRequiredPrograms()
+ if err != nil {
+ return nil, false
+ }
+ errors := false
+ spinner := spinner.New()
+ programHelper := NewProgramHelper()
+ for _, program := range *requiredPrograms {
+ spinner.Start("Looking for program '%s'", program.Name)
+ bin := programHelper.FindProgram(program.Name)
+ if bin == nil {
+ errors = true
+ spinner.Errorf("Program '%s' not found. %s", program.Name, program.Help)
+ } else {
+ spinner.Successf("Program '%s' found: %s", program.Name, bin.Path)
+ }
+ }
+
+ // Linux has library deps
+ if runtime.GOOS == "linux" {
+ // Check library prerequisites
+ requiredLibraries, err := GetRequiredLibraries()
+ if err != nil {
+ return err, false
+ }
+ distroInfo := GetLinuxDistroInfo()
+ for _, library := range *requiredLibraries {
+ spinner.Start()
+ switch distroInfo.Distribution {
+ case Ubuntu:
+ installed, err := DpkgInstalled(library.Name)
+ if err != nil {
+ return err, false
+ }
+ if !installed {
+ errors = true
+ spinner.Errorf("Library '%s' not found. %s", library.Name, library.Help)
+ } else {
+ spinner.Successf("Library '%s' installed.", library.Name)
+ }
+ default:
+ return fmt.Errorf("unable to check libraries on distribution '%s'. Please ensure that the '%s' equivalent is installed", distroInfo.DistributorID, library.Name), false
+ }
+ }
+ }
+
+ return err, !errors
+}
diff --git a/cmd/templates.go b/cmd/templates.go
new file mode 100644
index 000000000..1647cae2b
--- /dev/null
+++ b/cmd/templates.go
@@ -0,0 +1,268 @@
+package cmd
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path"
+ "path/filepath"
+ "runtime"
+ "strings"
+
+ "github.com/alecthomas/template"
+)
+
+const templateSuffix = ".template"
+
+type TemplateHelper struct {
+ system *SystemHelper
+ fs *FSHelper
+ templateDir string
+ // templates map[string]string
+ templateSuffix string
+ metadataFilename string
+}
+
+type Template struct {
+ Name string
+ Dir string
+ Metadata map[string]interface{}
+}
+
+func NewTemplateHelper() *TemplateHelper {
+ result := TemplateHelper{
+ system: NewSystemHelper(),
+ fs: NewFSHelper(),
+ templateSuffix: ".template",
+ metadataFilename: "template.json",
+ }
+ // Calculate template base dir
+ _, filename, _, _ := runtime.Caller(1)
+ result.templateDir = filepath.Join(path.Dir(filename), "templates")
+ // result.templateDir = filepath.Join(result.system.homeDir, "go", "src", "github.com", "wailsapp", "wails", "cmd", "templates")
+ return &result
+}
+
+func (t *TemplateHelper) GetTemplateNames() (map[string]string, error) {
+ templateDirs, err := t.fs.GetSubdirs(t.templateDir)
+ if err != nil {
+ return nil, err
+ }
+ return templateDirs, nil
+}
+
+func (t *TemplateHelper) GetTemplateDetails() (map[string]*Template, error) {
+ templateDirs, err := t.fs.GetSubdirs(t.templateDir)
+ if err != nil {
+ return nil, err
+ }
+
+ result := make(map[string]*Template)
+
+ for name, dir := range templateDirs {
+ result[name] = &Template{
+ Dir: dir,
+ }
+ metadata, err := t.LoadMetadata(dir)
+ if err != nil {
+ return nil, err
+ }
+ result[name].Metadata = metadata
+ if metadata["name"] != nil {
+ result[name].Name = metadata["name"].(string)
+ } else {
+ // Ignore bad templates?
+ result[name] = nil
+ }
+ }
+
+ return result, nil
+}
+
+func (t *TemplateHelper) LoadMetadata(dir string) (map[string]interface{}, error) {
+ templateFile := filepath.Join(dir, t.metadataFilename)
+ result := make(map[string]interface{})
+ if !t.fs.FileExists(templateFile) {
+ return nil, nil
+ }
+ rawJSON, err := ioutil.ReadFile(templateFile)
+ if err != nil {
+ return nil, err
+ }
+ err = json.Unmarshal(rawJSON, &result)
+ return result, err
+}
+
+func (t *TemplateHelper) TemplateExists(templateName string) (bool, error) {
+ templates, err := t.GetTemplateNames()
+ if err != nil {
+ return false, err
+ }
+ _, exists := templates[templateName]
+ return exists, nil
+}
+
+func (t *TemplateHelper) InstallTemplate(projectPath string, projectOptions *ProjectOptions) error {
+
+ // Get template files
+ template, err := t.getTemplateFiles(projectOptions.Template)
+ if err != nil {
+ return err
+ }
+
+ // Copy files to target
+ err = template.Install(projectPath, projectOptions)
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
+// templateFiles categorises files found in a template
+type templateFiles struct {
+ BaseDir string
+ StandardFiles []string
+ Templates []string
+ Dirs []string
+}
+
+// newTemplateFiles returns a new TemplateFiles struct
+func (t *TemplateHelper) newTemplateFiles(dir string) *templateFiles {
+ pathsep := string(os.PathSeparator)
+ // Ensure base directory has trailing slash
+ if !strings.HasSuffix(dir, pathsep) {
+ dir = dir + pathsep
+ }
+ return &templateFiles{
+ BaseDir: dir,
+ }
+}
+
+// AddStandardFile adds the given file to the list of standard files
+func (t *templateFiles) AddStandardFile(filename string) {
+ localPath := strings.TrimPrefix(filename, t.BaseDir)
+ t.StandardFiles = append(t.StandardFiles, localPath)
+}
+
+// AddTemplate adds the given file to the list of template files
+func (t *templateFiles) AddTemplate(filename string) {
+ localPath := strings.TrimPrefix(filename, t.BaseDir)
+ t.Templates = append(t.Templates, localPath)
+}
+
+// AddDir adds the given directory to the list of template dirs
+func (t *templateFiles) AddDir(dir string) {
+ localPath := strings.TrimPrefix(dir, t.BaseDir)
+ t.Dirs = append(t.Dirs, localPath)
+}
+
+// getTemplateFiles returns a struct categorising files in
+// the template directory
+func (t *TemplateHelper) getTemplateFiles(templateName string) (*templateFiles, error) {
+
+ templates, err := t.GetTemplateNames()
+ if err != nil {
+ return nil, err
+ }
+ templateDir := templates[templateName]
+ result := t.newTemplateFiles(templateDir)
+ var localPath string
+ err = filepath.Walk(templateDir, func(dir string, info os.FileInfo, err error) error {
+ if dir == templateDir {
+ return nil
+ }
+ if err != nil {
+ return err
+ }
+
+ // Don't copy template metadata
+ localPath = strings.TrimPrefix(dir, templateDir+string(filepath.Separator))
+ if localPath == t.metadataFilename {
+ return nil
+ }
+
+ // Categorise the file
+ switch {
+ case info.IsDir():
+ result.AddDir(dir)
+ case strings.HasSuffix(info.Name(), templateSuffix):
+ result.AddTemplate(dir)
+ default:
+ result.AddStandardFile(dir)
+ }
+ return nil
+ })
+
+ if err != nil {
+ return nil, fmt.Errorf("error processing template '%s' in path '%q': %v", templateName, templateDir, err)
+ }
+ return result, err
+}
+
+// Install the template files into the given project path
+func (t *templateFiles) Install(projectPath string, projectOptions *ProjectOptions) error {
+
+ fs := NewFSHelper()
+
+ // Create directories
+ var targetDir string
+ for _, dirname := range t.Dirs {
+ targetDir = filepath.Join(projectPath, dirname)
+ fs.MkDir(targetDir)
+ }
+
+ // Copy standard files
+ var targetFile, sourceFile string
+ var err error
+ for _, filename := range t.StandardFiles {
+ sourceFile = filepath.Join(t.BaseDir, filename)
+ targetFile = filepath.Join(projectPath, filename)
+
+ err = fs.CopyFile(sourceFile, targetFile)
+ if err != nil {
+ return err
+ }
+ }
+
+ // Do we have template files?
+ if len(t.Templates) > 0 {
+
+ // Iterate over the templates
+ var templateFile string
+ var tmpl *template.Template
+ for _, filename := range t.Templates {
+
+ // Load template text
+ templateFile = filepath.Join(t.BaseDir, filename)
+ templateText, err := fs.LoadAsString(templateFile)
+ if err != nil {
+ return err
+ }
+
+ // Apply template
+ tmpl = template.New(templateFile)
+ tmpl.Parse(templateText)
+
+ // Write the template to a buffer
+ var tpl bytes.Buffer
+ err = tmpl.Execute(&tpl, projectOptions)
+ if err != nil {
+ fmt.Println("ERROR!!! " + err.Error())
+ return err
+ }
+
+ // Save buffer to disk
+ targetFilename := strings.TrimSuffix(filename, templateSuffix)
+ targetFile = filepath.Join(projectPath, targetFilename)
+ err = ioutil.WriteFile(targetFile, tpl.Bytes(), 0644)
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ return nil
+}
diff --git a/cmd/templates/basic/main.go b/cmd/templates/basic/main.go
new file mode 100644
index 000000000..269b1d396
--- /dev/null
+++ b/cmd/templates/basic/main.go
@@ -0,0 +1,19 @@
+package main
+
+import (
+ wails "github.com/wailsapp/wails"
+)
+
+var html = `
Basic Template
`
+
+func main() {
+
+ // Initialise the app
+ app := wails.CreateApp(&wails.AppConfig{
+ Width: 1024,
+ Height: 768,
+ Title: "My Project",
+ HTML: html,
+ })
+ app.Run()
+}
diff --git a/cmd/templates/basic/template.json b/cmd/templates/basic/template.json
new file mode 100644
index 000000000..6035732d4
--- /dev/null
+++ b/cmd/templates/basic/template.json
@@ -0,0 +1,7 @@
+{
+ "name": "Basic",
+ "shortdescription": "A basic template",
+ "description": "A basic template using vanilla JS",
+ "author": "Lea Anthony",
+ "created": "2018-10-18"
+}
\ No newline at end of file
diff --git a/cmd/templates/vuewebpack/frontend/.browserslistrc b/cmd/templates/vuewebpack/frontend/.browserslistrc
new file mode 100644
index 000000000..9dee64646
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/.browserslistrc
@@ -0,0 +1,3 @@
+> 1%
+last 2 versions
+not ie <= 8
diff --git a/cmd/templates/vuewebpack/frontend/.gitignore b/cmd/templates/vuewebpack/frontend/.gitignore
new file mode 100644
index 000000000..185e66319
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/.gitignore
@@ -0,0 +1,21 @@
+.DS_Store
+node_modules
+/dist
+
+# local env files
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw*
diff --git a/cmd/templates/vuewebpack/frontend/README.md b/cmd/templates/vuewebpack/frontend/README.md
new file mode 100644
index 000000000..4735dcb87
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/README.md
@@ -0,0 +1,29 @@
+# frontend
+
+## Project setup
+```
+npm install
+```
+
+### Compiles and hot-reloads for development
+```
+npm run serve
+```
+
+### Compiles and minifies for production
+```
+npm run build
+```
+
+### Run your tests
+```
+npm run test
+```
+
+### Lints and fixes files
+```
+npm run lint
+```
+
+### Customize configuration
+See [Configuration Reference](https://cli.vuejs.org/config/).
diff --git a/cmd/templates/vuewebpack/frontend/babel.config.js b/cmd/templates/vuewebpack/frontend/babel.config.js
new file mode 100644
index 000000000..ba179669a
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/babel.config.js
@@ -0,0 +1,5 @@
+module.exports = {
+ presets: [
+ '@vue/app'
+ ]
+}
diff --git a/cmd/templates/vuewebpack/frontend/package.json b/cmd/templates/vuewebpack/frontend/package.json
new file mode 100644
index 000000000..7d05448d7
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "frontend",
+ "version": "0.1.0",
+ "private": true,
+ "scripts": {
+ "serve": "vue-cli-service serve",
+ "build": "vue-cli-service build"
+ },
+ "dependencies": {
+ "vue": "^2.5.17"
+ },
+ "devDependencies": {
+ "@vue/cli-plugin-babel": "^3.1.1",
+ "@vue/cli-service": "^3.1.4",
+ "vue-template-compiler": "^2.5.17"
+ }
+}
diff --git a/cmd/templates/vuewebpack/frontend/postcss.config.js b/cmd/templates/vuewebpack/frontend/postcss.config.js
new file mode 100644
index 000000000..961986e2b
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/postcss.config.js
@@ -0,0 +1,5 @@
+module.exports = {
+ plugins: {
+ autoprefixer: {}
+ }
+}
diff --git a/cmd/templates/vuewebpack/frontend/public/favicon.ico b/cmd/templates/vuewebpack/frontend/public/favicon.ico
new file mode 100644
index 000000000..c7b9a43c8
Binary files /dev/null and b/cmd/templates/vuewebpack/frontend/public/favicon.ico differ
diff --git a/cmd/templates/vuewebpack/frontend/public/index.html b/cmd/templates/vuewebpack/frontend/public/index.html
new file mode 100644
index 000000000..1fe8d7369
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/public/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+ frontend
+
+
+
+
+
+
+
diff --git a/cmd/templates/vuewebpack/frontend/src/App.vue b/cmd/templates/vuewebpack/frontend/src/App.vue
new file mode 100644
index 000000000..279b0a94e
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/src/App.vue
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/css/main.css b/cmd/templates/vuewebpack/frontend/src/assets/css/main.css
new file mode 100644
index 000000000..1a5e18b93
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/src/assets/css/main.css
@@ -0,0 +1,55 @@
+#app {
+ font-family: "Roboto", Helvetica, Arial, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ text-align: center;
+ color: #eee;
+ margin-top: 60px;
+}
+
+html {
+ height: 100%;
+ overflow: hidden;
+ /* https://leaverou.github.io/css3patterns/#carbon */
+ background: linear-gradient(27deg, #151515 5px, transparent 5px) 0 5px,
+ linear-gradient(207deg, #151515 5px, transparent 5px) 10px 0px,
+ linear-gradient(27deg, #222 5px, transparent 5px) 0px 10px,
+ linear-gradient(207deg, #222 5px, transparent 5px) 10px 5px,
+ linear-gradient(90deg, #1b1b1b 10px, transparent 10px),
+ linear-gradient(
+ #1d1d1d 25%,
+ #1a1a1a 25%,
+ #1a1a1a 50%,
+ transparent 50%,
+ transparent 75%,
+ #242424 75%,
+ #242424
+ );
+ background-color: #131313;
+ background-size: 20px 20px;
+}
+
+.logo {
+ width: 16em;
+}
+
+/* roboto-regular - latin */
+@font-face {
+ font-family: "Roboto";
+ font-style: normal;
+ font-weight: 400;
+ src: url("../fonts/roboto/roboto-v18-latin-regular.eot"); /* IE9 Compat Modes */
+ src: local("Roboto"), local("Roboto-Regular"),
+ url("../fonts/roboto/roboto-v18-latin-regular.eot?#iefix")
+ format("embedded-opentype"),
+ /* IE6-IE8 */ url("../fonts/roboto/roboto-v18-latin-regular.woff2")
+ format("woff2"),
+ /* Super Modern Browsers */
+ url("../fonts/roboto/roboto-v18-latin-regular.woff") format("woff"),
+ /* Modern Browsers */
+ url("../fonts/roboto/roboto-v18-latin-regular.ttf")
+ format("truetype"),
+ /* Safari, Android, iOS */
+ url("../fonts/roboto/roboto-v18-latin-regular.svg#Roboto")
+ format("svg"); /* Legacy iOS */
+}
\ No newline at end of file
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/css/quote.css b/cmd/templates/vuewebpack/frontend/src/assets/css/quote.css
new file mode 100644
index 000000000..edfc8d3f5
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/src/assets/css/quote.css
@@ -0,0 +1,75 @@
+/**
+ Credit: https://codepen.io/harmputman/pen/IpAnb
+**/
+
+body {
+ font: normal 300 1em/1.5em sans-serif;
+}
+
+.container {
+ background: #fff;
+ width: 100%;
+ max-width: 480px;
+ min-width: 320px;
+ margin: 2em auto 0;
+ padding: 1.5em;
+ opacity: 0.8;
+ border-radius: 1em;
+ border-color: #117;
+}
+
+p { margin-bottom: 1.5em; }
+p:last-child { margin-bottom: 0; }
+
+blockquote {
+ display: block;
+ border-width: 2px 0;
+ border-style: solid;
+ border-color: #eee;
+ padding: 1.5em 0 0.5em;
+ margin: 1.5em 0;
+ position: relative;
+ color: #117;
+}
+blockquote:before {
+ content: '\201C';
+ position: absolute;
+ top: 0em;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ background: #fff;
+ width: 3rem;
+ height: 2rem;
+ font: 6em/1.08em sans-serif;
+ color: #666;
+ text-align: center;
+}
+blockquote:after {
+ content: "\2013 \2003" attr(cite);
+ display: block;
+ text-align: right;
+ font-size: 0.875em;
+ color: #e70000;
+}
+
+/* https://fdossena.com/?p=html5cool/buttons/i.frag */
+button {
+ display:inline-block;
+ padding:0.35em 1.2em;
+ border:0.1em solid #000;
+ margin:0 0.3em 0.3em 0;
+ border-radius:0.12em;
+ box-sizing: border-box;
+ text-decoration:none;
+ font-family:'Roboto',sans-serif;
+ font-weight:300;
+ font-size: 1em;
+ color:#000;
+ text-align:center;
+ transition: all 0.2s;
+}
+button:hover{
+ color:#FFF;
+ background-color:#000;
+ cursor: pointer;
+}
\ No newline at end of file
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/fonts/LICENSE.txt b/cmd/templates/vuewebpack/frontend/src/assets/fonts/LICENSE.txt
new file mode 100644
index 000000000..75b52484e
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/src/assets/fonts/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.eot b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.eot
new file mode 100644
index 000000000..a0780d6e3
Binary files /dev/null and b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.eot differ
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.svg b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.svg
new file mode 100644
index 000000000..627f5a368
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.svg
@@ -0,0 +1,308 @@
+
+
+
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.ttf b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.ttf
new file mode 100644
index 000000000..b91bf3f7e
Binary files /dev/null and b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.ttf differ
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.woff b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.woff
new file mode 100644
index 000000000..92dfacc61
Binary files /dev/null and b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.woff differ
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.woff2 b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.woff2
new file mode 100644
index 000000000..7e854e669
Binary files /dev/null and b/cmd/templates/vuewebpack/frontend/src/assets/fonts/roboto/roboto-v18-latin-regular.woff2 differ
diff --git a/cmd/templates/vuewebpack/frontend/src/assets/images/logo.png b/cmd/templates/vuewebpack/frontend/src/assets/images/logo.png
new file mode 100644
index 000000000..31fc8249c
Binary files /dev/null and b/cmd/templates/vuewebpack/frontend/src/assets/images/logo.png differ
diff --git a/cmd/templates/vuewebpack/frontend/src/components/HelloWorld.vue b/cmd/templates/vuewebpack/frontend/src/components/HelloWorld.vue
new file mode 100644
index 000000000..d231b0189
--- /dev/null
+++ b/cmd/templates/vuewebpack/frontend/src/components/HelloWorld.vue
@@ -0,0 +1,38 @@
+
+