all repos — vite @ bce0b549b8c10271ee7df30d6d7c78af2675cf6c

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
}