project

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package project provides the functionality for creating a new Go project.

Package project provides the functionality for creating a new Go project.

Index

Constants

This section is empty.

Variables

View Source
var (
	SupportedWebframeworks = []string{"chi", "echo", "fiber", "gin", "gorilla/mux", "httpRouter", "standard-library"}
)

Web framework dependencies, and supported web-frameworks

Functions

func IsValidWebFramework

func IsValidWebFramework(input string) bool

isValidWebFramework check if the input is supported or not

Types

type ProjectConfig

type ProjectConfig struct {
	ProjectName  string
	ProjectType  string                  // Can be an api or serverless.
	FrameworkMap map[string]WebFramework // Can be any of the suggested router Packages.
	Exit         bool
	AbsolutePath string
}

ProjectConfig represents the configuration for a new Go project. It includes the project name, type, a map of web frameworks, a flag to indicate whether to exit the CLI, and the absolute path of the project.

func (*ProjectConfig) CreateMainFile

func (p *ProjectConfig) CreateMainFile() error

Todo: Decompose this function into smaller ones. CreateMainFile creates the main file for the project. It creates the project directory, initializes the Go module, installs the dependencies, creates the necessary paths and files, and formats the Go code.

func (*ProjectConfig) ExitCLI

func (p *ProjectConfig) ExitCLI(tprogram *tea.Program)

ExitCLI releases the terminal and exits the program if the Exit flag is set.

type TemplateGenerator

type TemplateGenerator interface {
	Main() []byte
	Server() []byte
	Routes() []byte
}

TemplateGenerator is an interface that defines the methods for generating templates for the main, server, and routes files.

type WebFramework

type WebFramework struct {
	// contains filtered or unexported fields
}

WebFramework represents a web framework that can be used in the project. It includes the dependencies of the framework and a template generator.

Jump to

Keyboard shortcuts

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