all repos — vite @ 767dbd64730834c6e367344c7809531862a0afa5

a fast (this time, actually) and minimal static site generator

commands/init.go (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
package commands

import (
	"fmt"
	"os"
	"path/filepath"
)

func Init(path string) error {
	paths := []string{"build", "pages", "static", "templates"}
	var dirPath string

	for _, p := range paths {
		dirPath = filepath.Join(path, p)
		err := os.MkdirAll(dirPath, 0755)
		if err != nil {
			return err
		}
	}
	fp, _ := filepath.Abs(path)
	fmt.Printf("vite: created project at %s\n", fp)
	return nil
}