react

package
v0.0.0-...-0730a73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2019 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package react contains ReactCmd which generates new react project using template.

Index

Constants

This section is empty.

Variables

View Source
var ReactCmd = &cobra.Command{
	Use:   "react",
	Short: "Start a new project using 'react' template",
	Long:  "Start a new project using 'react' template",
	Run: func(cmd *cobra.Command, args []string) {
		answers := struct {
			CI                 bool
			CoverallToken      string
			Database           string
			Docker             bool
			License            string
			ProjectDescription string
			ProjectName        string
			Redis              bool
		}{}
		if err := survey.Ask(questions, &answers); err != nil {
			utils.ExitOnError(err)
		}
		templates := []string{"new/react", "new/github", "new/license"}
		requireMap := map[string]interface{}{
			"ci":       answers.CI,
			"coverage": answers.CoverallToken,
			"docker":   answers.Docker,
			"postgres": answers.Database == "Postgres",
			"redis":    answers.Redis,
		}
		replaceMap := map[string]interface{}{
			"author":             config.GetConfigByField("author"),
			"ci":                 answers.CI,
			"coverallToken":      answers.CoverallToken,
			"docker":             answers.Docker,
			"dockerUser":         config.GetConfigByField("dockerUser"),
			"email":              config.GetConfigByField("email"),
			"githubUser":         config.GetConfigByField("githubUser"),
			"license":            answers.License,
			"postgres":           answers.Database == "Postgres",
			"projectDescription": answers.ProjectDescription,
			"projectName":        answers.ProjectName,
			"redis":              answers.Redis,
		}
		utils.GenerateFile(templates, answers.ProjectName, requireMap, replaceMap)

		bold := color.New(color.Bold).SprintFunc()
		boldCyan := color.New(color.FgCyan, color.Bold).SprintFunc()

		fmt.Println()
		fmt.Printf("%s%s%s\n", bold("This project uses "), boldCyan("Commitlint"), bold(", see more detail here: https://github.com/Armour/commitlint-config-armour"))
	},
}

ReactCmd generates new react project using template.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL