Skip to content
Snippets Groups Projects
Verified Commit 29a54dc7 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

chore: commit save point

parent 39b83893
No related branches found
No related tags found
No related merge requests found
Showing
with 1645 additions and 0 deletions
package session
package session
type Session struct {
SID string
UID uint32
}
func (s *Session) GetUID() uint32 {
return s.UID
}
package util
import (
"reflect"
)
var (
MaxDepth = 32
)
// Merge recursively merges the src and dst maps. Key conflicts are resolved by
// preferring src, or recursively descending, if both src and dst are maps.
func Merge(dst, src map[string]interface{}) map[string]interface{} {
return merge(dst, src, 0)
}
func merge(dst, src map[string]interface{}, depth int) map[string]interface{} {
if depth > MaxDepth {
panic("too deep!")
}
for key, srcVal := range src {
if dstVal, ok := dst[key]; ok {
srcMap, srcMapOk := doMapping(srcVal)
dstMap, dstMapOk := doMapping(dstVal)
if srcMapOk && dstMapOk {
srcVal = merge(dstMap, srcMap, depth+1)
}
}
dst[key] = srcVal
}
return dst
}
func doMapping(i interface{}) (map[string]interface{}, bool) {
value := reflect.ValueOf(i)
if value.Kind() == reflect.Map {
m := map[string]interface{}{}
for _, k := range value.MapKeys() {
m[k.String()] = value.MapIndex(k).Interface()
}
return m, true
}
return map[string]interface{}{}, false
}
package watch
import (
"gitlab.schukai.com/oss/utilities/conan/configuration"
"gitlab.schukai.com/oss/utilities/conan/constants"
"path"
)
func getScriptName() string {
return "app.js"
}
func getStyleName() string {
return "app.css"
}
func newDataset(appID string) *Dataset {
webPath := configuration.GetServerWebPath()
scriptName := getScriptName()
relScriptPath := path.Join(appID, constants.AppScriptDirectory)
absScriptPath := path.Join(webPath, relScriptPath)
scriptHash := GetFileHash(path.Join(absScriptPath, scriptName))
relScriptPath = path.Join("/", relScriptPath, scriptHash, scriptName)
styleName := getStyleName()
relStylePath := path.Join(appID, constants.AppStyleDirectory)
absStylePath := path.Join(webPath, relStylePath)
styleHash := GetFileHash(path.Join(absStylePath, styleName))
relStylePath = path.Join("/", relStylePath, styleHash, styleName)
manifestPath := path.Join("/", appID, constants.WebManifestName)
faviconPath := path.Join("/", appID, constants.FaviconName)
tags := &Tags{
Config: "",
WebManifest: "<link rel=\"manifest\" href=\"" + manifestPath + "\" crossorigin=\"use-credentials\">",
Favicon: "<link rel=\"icon\" href=\"" + faviconPath + "\">",
Script: "<script type=\"module\" src=\"" + relScriptPath + "\"></script>",
Style: "<link rel=\"stylesheet\" href=\"" + relStylePath + "\">",
Cache: "<meta http-equiv=\"cache-control\" content=\"" + constants.StandardCacheControl + "\">",
}
meta := &Meta{
Language: "en",
}
dataset := &Dataset{
Mnemonic: appID,
Tags: tags,
Meta: meta,
}
return dataset
}
type Meta struct {
Language string
}
type Resources struct {
Script string
Style string
}
type Tags struct {
Config string
WebManifest string
Favicon string
Script string
Style string
Cache string
}
type Dataset struct {
Mnemonic string
*Tags
*Meta
*Resources
}
package watch
import (
"crypto/md5"
"encoding/hex"
"io"
"os"
"sync"
"time"
)
type FileHash struct {
Name string
Hash string
expiresAt int64
}
var (
fileHashCache map[string]FileHash
fileHashMutex *sync.Mutex
)
func init() {
fileHashCache = make(map[string]FileHash)
fileHashMutex = &sync.Mutex{}
go func() {
for {
time.Sleep(time.Minute * 60 * 24) // 1 day
fileHashMutex.Lock()
for k, v := range fileHashCache {
if v.expiresAt < time.Now().Unix() {
delete(fileHashCache, k)
}
}
fileHashMutex.Unlock()
}
}()
}
func RemoveFileHash(path string) {
fileHashMutex.Lock()
defer fileHashMutex.Unlock()
if _, ok := fileHashCache[path]; ok {
delete(fileHashCache, path)
}
}
func GetFileHash(path string) string {
fileHashMutex.Lock()
defer fileHashMutex.Unlock()
if hash, ok := fileHashCache[path]; ok {
return hash.Hash
}
h, err := buildHash(path)
if err != nil {
return ""
}
fileHashCache[path] = h
return h.Hash
}
type FileHashes map[string]FileHash
func buildHash(path string) (FileHash, error) {
var h FileHash // HASH
h.Name = path
h.Hash, _ = hashFile(path)
h.expiresAt = time.Now().Unix() + 3600*24 // 1 day
return h, nil
}
func hashFile(path string) (string, error) {
var h string // HASH
file, err := os.Open(path)
if err != nil {
return h, err
}
defer file.Close()
hash := md5.New()
if _, err := io.Copy(hash, file); err != nil {
return h, err
}
hashInBytes := hash.Sum(nil)[:16]
h = hex.EncodeToString(hashInBytes)
return h, nil
}
package watch
import (
"bytes"
"github.com/bitfield/script"
"github.com/fsnotify/fsnotify"
"gitlab.schukai.com/oss/utilities/conan/configuration"
"gitlab.schukai.com/oss/utilities/conan/constants"
"gitlab.schukai.com/oss/utilities/conan/logging"
"os"
"path"
"path/filepath"
"regexp"
"strings"
"sync"
"text/template"
)
var (
watcher *fsnotify.Watcher
watchList map[string]string
watchListMutex = &sync.Mutex{}
)
func init() {
var err error
watcher, err = fsnotify.NewWatcher()
if err != nil {
logging.LogError("watching: watch error: %v", err.Error())
}
watchList = make(map[string]string)
}
func executeWatchAction(watchPath string) {
watch := configuration.GetWatch()
for _, w := range watch {
if !strings.HasPrefix(watchPath, w.Path) {
continue
}
if w.Exclude != nil {
stop := false
for _, e := range w.Exclude {
reg, err := regexp.Compile(e)
if err != nil {
logging.LogError("watching: compile exclude regex error: %v", err.Error())
stop = true
break
}
if reg.MatchString(watchPath) {
stop = true
break
}
}
if stop {
continue
}
}
logging.LogDebug("watching: execute watch action: %s", w.Command)
t, err := template.New("command").Parse(w.Command)
if err != nil {
logging.LogError("watching: execute watch action error: %v", err.Error())
continue
}
data := make(map[string]interface{})
data["Path"] = watchPath
data["WebPath"] = configuration.GetServerWebPath()
data["PID"] = os.Getpid()
data["Bin"] = os.Args[0]
data["Call"] = strings.Join(os.Args[0:], " ")
stat, err := os.Stat(watchPath)
if err != nil {
logging.LogError("watching: execute watch action error: %v", err.Error())
continue
}
if stat.IsDir() {
data["IsDir"] = true
data["Directory"] = watchPath
} else {
data["IsDir"] = false
data["Directory"] = path.Dir(watchPath)
}
var cmd bytes.Buffer
err = t.Execute(&cmd, data)
if err != nil {
logging.LogError("watching: execute watch action error: %v", err.Error())
continue
}
result := script.Exec(cmd.String())
if result.Error() != nil {
logging.LogError("watching: execute watch action error: %v", result.Error())
}
r, err := result.String()
logging.LogDebug("%s", r)
if err != nil {
logging.LogError("watching: execute watch action error: %v", err.Error())
continue
}
}
}
func StartWatching() error {
webPath := configuration.GetServerWebPath()
go func() {
for {
select {
case event, ok := <-watcher.Events:
if !ok {
return
}
fullPath := event.Name
d := strings.TrimPrefix(fullPath, webPath)
if event.Op&fsnotify.Chmod == fsnotify.Chmod {
logging.LogDebug("watching: chmod file: %s", d)
RemoveFileHash(fullPath)
}
if event.Op&fsnotify.Write == fsnotify.Write {
logging.LogDebug("watching: modified file: %s", d)
if fullPath == path.Join(configuration.GetConfigurationPath(), constants.ConfigFileName) {
configuration.Reload()
continue
}
RemoveFileHash(fullPath)
executeWatchAction(fullPath)
}
if event.Op&fsnotify.Create == fsnotify.Create {
logging.LogDebug("watching: created file: %s", d)
scanPath(fullPath)
executeWatchAction(fullPath)
}
if event.Op&fsnotify.Remove == fsnotify.Remove {
logging.LogDebug("watching: removed file: %s", d)
removeFromWatchlist(fullPath)
RemoveFileHash(fullPath)
}
if event.Op&fsnotify.Rename == fsnotify.Rename {
logging.LogDebug("watching: renamed file: %s", event.Name)
removeFromWatchlist(fullPath)
RemoveFileHash(fullPath)
}
case err, ok := <-watcher.Errors:
if !ok {
return
}
logging.LogError("watching: watch error: %v", err.Error())
}
}
}()
return nil
}
func InitWatch() {
watchList := configuration.GetWatch()
if len(watchList) == 0 {
watchList = append(watchList, configuration.Watch{
Path: configuration.GetServerWebPath(),
})
}
watchList = append(watchList, configuration.Watch{
Path: path.Join(configuration.GetConfigurationPath(), constants.ConfigFileName),
})
for _, w := range watchList {
scanPath(w.Path)
}
}
func scanPath(p string) {
if !path.IsAbs(p) {
p = path.Join(configuration.GetConfigurationPath(), p)
}
followFlag := configuration.GetServerFlagFollowSymlinks()
err := filepath.Walk(p,
func(x string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if info.IsDir() && p == x {
addToWatchlist(x)
return nil
}
if followFlag {
x2, err := filepath.EvalSymlinks(x)
if err != nil {
return err
}
if x2 != x {
scanPath(x2)
return nil
}
}
//if info.IsDir() {
addToWatchlist(x)
//}
return nil
})
if err != nil {
logging.LogError("watching: watch files error %s", err.Error())
}
}
func removeFromWatchlist(p string) {
watchListMutex.Lock()
for k, _ := range watchList {
if k == p {
delete(watchList, k)
break
}
}
watchListMutex.Unlock()
}
func addToWatchlist(p string) {
watchListMutex.Lock()
err := watcher.Add(p)
if err != nil {
logging.LogError("watching: watch error: %v", err.Error())
} else {
logging.LogInfo("watching: watching %s", p)
watchList[p] = p
}
watchListMutex.Unlock()
}
func DestroyApps() {
watcher.Close()
}
package websocket
import (
"fmt"
"gitea.com/go-chi/session"
"github.com/gorilla/websocket"
"gitlab.schukai.com/oss/utilities/conan/logging"
"log"
"net/http"
)
var (
upgrader = websocket.Upgrader{}
connections = make(map[string]*websocket.Conn)
)
//func getCmd(input string) string {
// inputArr := strings.Split(input, " ")
// return inputArr[0]
//}
//
//func getMessage(input string) string {
// inputArr := strings.Split(input, " ")
// var result string
// for i := 1; i < len(inputArr); i++ {
// result += inputArr[i]
// }
// return result
//}
func SendMessageToAll(message []byte) {
for _, conn := range connections {
conn.WriteMessage(websocket.TextMessage, message)
}
}
func closeConnection(session string) error {
if conn, ok := connections[session]; ok {
conn.Close()
delete(connections, session)
}
return nil
}
func GetWebsocketHandler() http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
sessionStore := session.GetSession(r)
session := sessionStore.ID()
conn, err := upgrader.Upgrade(w, r, nil)
if err != nil {
logging.LogError("websocket error %s", err.Error())
return
}
conn.SetCloseHandler(func(code int, text string) error {
return closeConnection(session)
})
connections[session] = conn
defer func() {
closeConnection(session)
}()
//if sessionStore.Get("user") == nil {
// http.Error(w, "Forbidden", http.StatusForbidden)
// return
//}
// Continuosly read and write message
for {
mt, message, err := conn.ReadMessage()
if err != nil {
log.Println("read failed:", err)
break
}
if string(message) == "exit" {
break
}
fmt.Println(mt, string(message), "!!!!!!!!!!!!!!!!!!")
//input := string(message)
//cmd := getCmd(input)
//msg := getMessage(input)
//if cmd == "x" {
// todoList = append(todoList, msg)
//} else if cmd == "done" {
// updateTodoList(msg)
//}
//output := "Current Todos: \n"
//for _, todo := range todoList {
// output += "\n - " + todo + "\n"
//}
//output += "\n----------------------------------------"
//message = []byte(output)
//err = conn.WriteMessage(mt, message)
//if err != nil {
// log.Println("write failed:", err)
// break
//}
}
})
}
Server:
# The hostname or IP address of the server (CONAN_SERVER_HOST)
# Domain, IP or hostname of the server
#Host: localhost:8080
# The port of the server (CONAN_SERVER_ADDRESS)
# Address: localhost
# The port of the server (CONAN_SERVER_PORT)
Port: 8080
#
Path:
# The path to the server (CONAN_SERVER_WEB_PATH)
Web: web
Watch:
- Path: src
Command: /bin/bash -c "PATH=$PATH:/home/volker.schukai/.nvm/versions/node/v18.8.0/bin; npx esbuild --bundle --outfile={{ .WebPath }}/scripts/bundle.js --sourcemap {{ .Path }}"
Exclude:
- ~$
- ^\.
Flags:
FollowSymlinks: true
{
"name": "e1",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"esbuild": "^0.15.6"
}
}
lockfileVersion: 5.4
specifiers:
esbuild: ^0.15.6
devDependencies:
esbuild: 0.15.6
packages:
/@esbuild/linux-loong64/0.15.6:
resolution: {integrity: sha512-hqmVU2mUjH6J2ZivHphJ/Pdse2ZD+uGCHK0uvsiLDk/JnSedEVj77CiVUnbMKuU4tih1TZZL8tG9DExQg/GZsw==}
engines: {node: '>=12'}
cpu: [loong64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-android-64/0.15.6:
resolution: {integrity: sha512-Z1CHSgB1crVQi2LKSBwSkpaGtaloVz0ZIYcRMsvHc3uSXcR/x5/bv9wcZspvH/25lIGTaViosciS/NS09ERmVA==}
engines: {node: '>=12'}
cpu: [x64]
os: [android]
requiresBuild: true
dev: true
optional: true
/esbuild-android-arm64/0.15.6:
resolution: {integrity: sha512-mvM+gqNxqKm2pCa3dnjdRzl7gIowuc4ga7P7c3yHzs58Im8v/Lfk1ixSgQ2USgIywT48QWaACRa3F4MG7djpSw==}
engines: {node: '>=12'}
cpu: [arm64]
os: [android]
requiresBuild: true
dev: true
optional: true
/esbuild-darwin-64/0.15.6:
resolution: {integrity: sha512-BsfVt3usScAfGlXJiGtGamwVEOTM8AiYiw1zqDWhGv6BncLXCnTg1As+90mxWewdTZKq3iIy8s9g8CKkrrAXVw==}
engines: {node: '>=12'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/esbuild-darwin-arm64/0.15.6:
resolution: {integrity: sha512-CnrAeJaEpPakUobhqO4wVSA4Zm6TPaI5UY4EsI62j9mTrjIyQPXA1n4Ju6Iu5TVZRnEqV6q8blodgYJ6CJuwCA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/esbuild-freebsd-64/0.15.6:
resolution: {integrity: sha512-+qFdmqi+jkAsxsNJkaWVrnxEUUI50nu6c3MBVarv3RCDCbz7ZS1a4ZrdkwEYFnKcVWu6UUE0Kkb1SQ1yGEG6sg==}
engines: {node: '>=12'}
cpu: [x64]
os: [freebsd]
requiresBuild: true
dev: true
optional: true
/esbuild-freebsd-arm64/0.15.6:
resolution: {integrity: sha512-KtQkQOhnNciXm2yrTYZMD3MOm2zBiiwFSU+dkwNbcfDumzzUprr1x70ClTdGuZwieBS1BM/k0KajRQX7r504Xw==}
engines: {node: '>=12'}
cpu: [arm64]
os: [freebsd]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-32/0.15.6:
resolution: {integrity: sha512-IAkDNz3TpxwISTGVdQijwyHBZrbFgLlRi5YXcvaEHtgbmayLSDcJmH5nV1MFgo/x2QdKcHBkOYHdjhKxUAcPwg==}
engines: {node: '>=12'}
cpu: [ia32]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-64/0.15.6:
resolution: {integrity: sha512-gQPksyrEYfA4LJwyfTQWAZaVZCx4wpaLrSzo2+Xc9QLC+i/sMWmX31jBjrn4nLJCd79KvwCinto36QC7BEIU/A==}
engines: {node: '>=12'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-arm/0.15.6:
resolution: {integrity: sha512-xZ0Bq2aivsthDjA/ytQZzxrxIZbG0ATJYMJxNeOIBc1zUjpbVpzBKgllOZMsTSXMHFHGrow6TnCcgwqY0+oEoQ==}
engines: {node: '>=12'}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-arm64/0.15.6:
resolution: {integrity: sha512-aovDkclFa6C9EdZVBuOXxqZx83fuoq8097xZKhEPSygwuy4Lxs8J4anHG7kojAsR+31lfUuxzOo2tHxv7EiNHA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-mips64le/0.15.6:
resolution: {integrity: sha512-wVpW8wkWOGizsCqCwOR/G3SHwhaecpGy3fic9BF1r7vq4djLjUcA8KunDaBCjJ6TgLQFhJ98RjDuyEf8AGjAvw==}
engines: {node: '>=12'}
cpu: [mips64el]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-ppc64le/0.15.6:
resolution: {integrity: sha512-z6w6gsPH/Y77uchocluDC8tkCg9rfkcPTePzZKNr879bF4tu7j9t255wuNOCE396IYEGxY7y8u2HJ9i7kjCLVw==}
engines: {node: '>=12'}
cpu: [ppc64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-riscv64/0.15.6:
resolution: {integrity: sha512-pfK/3MJcmbfU399TnXW5RTPS1S+ID6ra+CVj9TFZ2s0q9Ja1F5A1VirUUvViPkjiw+Kq3zveyn6U09Wg1zJXrw==}
engines: {node: '>=12'}
cpu: [riscv64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-linux-s390x/0.15.6:
resolution: {integrity: sha512-OZeeDu32liefcwAE63FhVqM4heWTC8E3MglOC7SK0KYocDdY/6jyApw0UDkDHlcEK9mW6alX/SH9r3PDjcCo/Q==}
engines: {node: '>=12'}
cpu: [s390x]
os: [linux]
requiresBuild: true
dev: true
optional: true
/esbuild-netbsd-64/0.15.6:
resolution: {integrity: sha512-kaxw61wcHMyiEsSsi5ut1YYs/hvTC2QkxJwyRvC2Cnsz3lfMLEu8zAjpBKWh9aU/N0O/gsRap4wTur5GRuSvBA==}
engines: {node: '>=12'}
cpu: [x64]
os: [netbsd]
requiresBuild: true
dev: true
optional: true
/esbuild-openbsd-64/0.15.6:
resolution: {integrity: sha512-CuoY60alzYfIZapUHqFXqXbj88bbRJu8Fp9okCSHRX2zWIcGz4BXAHXiG7dlCye5nFVrY72psesLuWdusyf2qw==}
engines: {node: '>=12'}
cpu: [x64]
os: [openbsd]
requiresBuild: true
dev: true
optional: true
/esbuild-sunos-64/0.15.6:
resolution: {integrity: sha512-1ceefLdPWcd1nW/ZLruPEYxeUEAVX0YHbG7w+BB4aYgfknaLGotI/ZvPWUZpzhC8l1EybrVlz++lm3E6ODIJOg==}
engines: {node: '>=12'}
cpu: [x64]
os: [sunos]
requiresBuild: true
dev: true
optional: true
/esbuild-windows-32/0.15.6:
resolution: {integrity: sha512-pBqdOsKqCD5LRYiwF29PJRDJZi7/Wgkz46u3d17MRFmrLFcAZDke3nbdDa1c8YgY78RiemudfCeAemN8EBlIpA==}
engines: {node: '>=12'}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: true
optional: true
/esbuild-windows-64/0.15.6:
resolution: {integrity: sha512-KpPOh4aTOo//g9Pk2oVAzXMpc9Sz9n5A9sZTmWqDSXCiiachfFhbuFlsKBGATYCVitXfmBIJ4nNYYWSOdz4hQg==}
engines: {node: '>=12'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/esbuild-windows-arm64/0.15.6:
resolution: {integrity: sha512-DB3G2x9OvFEa00jV+OkDBYpufq5x/K7a6VW6E2iM896DG4ZnAvJKQksOsCPiM1DUaa+DrijXAQ/ZOcKAqf/3Hg==}
engines: {node: '>=12'}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/esbuild/0.15.6:
resolution: {integrity: sha512-sgLOv3l4xklvXzzczhRwKRotyrfyZ2i1fCS6PTOLPd9wevDPArGU8HFtHrHCOcsMwTjLjzGm15gvC8uxVzQf+w==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
optionalDependencies:
'@esbuild/linux-loong64': 0.15.6
esbuild-android-64: 0.15.6
esbuild-android-arm64: 0.15.6
esbuild-darwin-64: 0.15.6
esbuild-darwin-arm64: 0.15.6
esbuild-freebsd-64: 0.15.6
esbuild-freebsd-arm64: 0.15.6
esbuild-linux-32: 0.15.6
esbuild-linux-64: 0.15.6
esbuild-linux-arm: 0.15.6
esbuild-linux-arm64: 0.15.6
esbuild-linux-mips64le: 0.15.6
esbuild-linux-ppc64le: 0.15.6
esbuild-linux-riscv64: 0.15.6
esbuild-linux-s390x: 0.15.6
esbuild-netbsd-64: 0.15.6
esbuild-openbsd-64: 0.15.6
esbuild-sunos-64: 0.15.6
esbuild-windows-32: 0.15.6
esbuild-windows-64: 0.15.6
esbuild-windows-arm64: 0.15.6
dev: true
console.log('Hello ME!?');
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World</title>
<script src="scripts/bundle.js"></script>
</head>
<body>
<h1>Hello World</h1>
</body>
(() => {
// src/main.js
console.log("Hello ME!?");
})();
//# sourceMappingURL=bundle.js.map
{
"version": 3,
"sources": ["../../src/main.js"],
"sourcesContent": ["console.log('Hello ME!?');"],
"mappings": ";;AAAA,UAAQ,IAAI,YAAY;",
"names": []
}
#############################################################################################
#############################################################################################
##
## COLORS
##
#############################################################################################
#############################################################################################
BLACK := $(shell tput -Txterm setaf 0)
RED := $(shell tput -Txterm setaf 1)
GREEN := $(shell tput -Txterm setaf 2)
YELLOW := $(shell tput -Txterm setaf 3)
LIGHTPURPLE := $(shell tput -Txterm setaf 4)
PURPLE := $(shell tput -Txterm setaf 5)
BLUE := $(shell tput -Txterm setaf 6)
WHITE := $(shell tput -Txterm setaf 7)
RESET := $(shell tput -Txterm sgr0)
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## DIRECTORIES
##
#############################################################################################
#############################################################################################
APPLICATION_PATH ?= $(PROJECT_ROOT)application/
DEPLOYMENT_PATH ?= $(PROJECT_ROOT)deployment/
DEVELOPMENT_PATH ?= $(PROJECT_ROOT)development/
DOCUMENTATION_PATH ?= $(PROJECT_ROOT)documentation/
REQUIREMENT_PATH ?= $(PROJECT_ROOT)requirement/
CREDENTIALS_PATH ?= $(PROJECT_ROOT)credential/
TUTORIALS_PATH ?= $(DOCUMENTATION_PATH)tutorial/
DOCUMENTATION_CONFIG_PATH ?= $(DOCUMENTATION_PATH)config/
RESOURCE_PATH ?= $(APPLICATION_PATH)resource/
SOURCE_PATH ?= $(APPLICATION_PATH)source/
WEB_PATH ?= $(APPLICATION_PATH)web/
## SCRIPTS_PATH IS DEPRECATED
SCRIPTS_PATH ?= $(DEVELOPMENT_PATH)script/
DEVELOPMENT_SCRIPTS_PATH ?= $(DEVELOPMENT_PATH)script/
BUILD_PATH ?= $(DEPLOYMENT_PATH)build/
VENDOR_PATH ?= $(DEPLOYMENT_PATH)vendor/
TEST_PATH ?= $(DEVELOPMENT_PATH)test/
DEPLOYMENT_SCRIPTS_PATH ?= $(DEPLOYMENT_PATH)script/
PROJECT_DIRECTORIES := $(PROJECT_DIRECTORIES) \
$(APPLICATION_PATH) \
$(RESOURCE_PATH) \
$(SOURCE_PATH) \
$(WEB_PATH) \
$(DEPLOYMENT_PATH) \
$(VENDOR_PATH) \
$(DEVELOPMENT_PATH) \
$(DEVELOPMENT_SCRIPTS_PATH) \
$(DEPLOYMENT_SCRIPTS_PATH) \
$(DOCUMENTATION_PATH) \
$(REQUIREMENT_PATH) \
$(CREDENTIALS_PATH) \
$(BUILD_PATH)
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## INSTALL .gitignore
##
#############################################################################################
#############################################################################################
define GITIGNOREDS
# Created by https://www.toptal.com/developers/gitignore/api/intellij+iml,phpunit,git,vim,visualstudiocode,phpstorm,go,intellij+all,netbeans,dbeaver,node,yarn
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+iml,phpunit,git,vim,visualstudiocode,phpstorm,go,intellij+all,netbeans,dbeaver,node,yarn
### DBeaver ###
# ide config file
.dbeaver-data-sources*.xml
### Git ###
# Created by git for backups. To disable backups in Git:
# $ git config --global mergetool.keepBackup false
*.orig
# Created by git when using merge tools for conflicts
*.BACKUP.*
*.BASE.*
*.LOCAL.*
*.REMOTE.*
*_BACKUP_*.txt
*_BASE_*.txt
*_LOCAL_*.txt
*_REMOTE_*.txt
### Go ###
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
### Go Patch ###
/vendor/
/Godeps/
### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### Intellij+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### Intellij+iml ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
# AWS User-specific
# Generated files
# Sensitive or high-churn files
# Gradle
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
# Mongo Explorer plugin
# File-based project format
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Cursive Clojure plugin
# SonarLint plugin
# Crashlytics plugin (for Android Studio and IntelliJ)
# Editor-based Rest Client
# Android studio 3.1+ serialized cache file
### Intellij+iml Patch ###
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
*.iml
modules.xml
.idea/misc.xml
*.ipr
### NetBeans ###
**/nbproject/private/
**/nbproject/Makefile-*.mk
**/nbproject/Package-*.bash
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
### Node Patch ###
# Serverless Webpack directories
.webpack/
# Optional stylelint cache
# SvelteKit build / generate output
.svelte-kit
### PhpStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
# AWS User-specific
# Generated files
# Sensitive or high-churn files
# Gradle
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
# Mongo Explorer plugin
# File-based project format
# IntelliJ
# mpeltonen/sbt-idea plugin
# JIRA plugin
# Cursive Clojure plugin
# SonarLint plugin
# Crashlytics plugin (for Android Studio and IntelliJ)
# Editor-based Rest Client
# Android studio 3.1+ serialized cache file
### PhpStorm Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/
# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml
# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/
# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$
# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml
# Azure Toolkit for IntelliJ plugin
# https://plugins.jetbrains.com/plugin/8053-azure-toolkit-for-intellij
.idea/**/azureSettings.xml
### PHPUnit ###
# Covers PHPUnit
# Reference: https://phpunit.de/
# Generated files
.phpunit.result.cache
.phpunit.cache
# PHPUnit
/app/phpunit.xml
/phpunit.xml
# Build data
/build/
### Vim ###
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide
# Support for Project snippet scope
.vscode/*.code-snippets
# Ignore code-workspaces
*.code-workspace
### yarn ###
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/releases
!.yarn/patches
!.yarn/plugins
!.yarn/sdks
!.yarn/versions
# if you are NOT using Zero-installs, then:
# comment the following lines
!.yarn/cache
# and uncomment the following lines
# .pnp.*
endef
export GITIGNOREDS
.gitignore:
$(QUITE) $(ECHO) "$$GITIGNOREDS" >> $@
#############################################################################################
#############################################################################################
##
## COMMANDS GO
##
#############################################################################################
#############################################################################################
# path and binaries
GO := go
EXECUTABLES = $(EXECUTABLES:-) $(GO);
#############################################################################################
#############################################################################################
##
## INSTALL jsdoc.json
##
#############################################################################################
#############################################################################################
define JSDOCJSON
{
"tags": {
"allowUnknownTags": true
},
"source": {
"include": "$(SOURCE_PATH)",
"includePattern": "\\.js$$",
"excludePattern": ""
},
"plugins": [
"plugins/markdown",
"jsdoc-plantuml"
],
"opts": {
"template": "node_modules/clean-jsdoc-theme",
"encoding": "utf8",
"destination": "$(BUILD_PATH)/docs/",
"recurse": true,
"verbose": true,
"theme_opts": {
"theme": "light",
"title": "$(COMPONENT_NAME)",
"meta": [
{
"name": "author",
"content": "schukai GmbH"
},
{
"name": "description",
"content": "javascript library for ..."
}
],
"search": true,
"add_style_path": [
{
"href": "https://monsterjs.org/assets/prettify.css",
"crossorigin": "anonymous",
"rel": "stylesheet"
}
],
"add_script_path": [
{
"src": "https://code.jquery.com/jquery-3.5.1.js",
"integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=",
"crossorigin": "anonymous"
},
],
"footer": "<a href='https://about.schukai.com/de/impressum/'>Imprint</a>",
"overlay_scrollbar": {
"options": {
}
},
"resizeable": {
"navbar": {
"min": "300",
"max": "600"
}
},
"codepen": {
"enable_for": [
"examples"
],
"options": {
"title": "javascript library by schukai GmbH",
"description": "the example ...",
"editors": "0012"
}
},
"sections": [
"Tutorials",
"Namespaces",
"Classes",
"Modules",
"Externals",
"Events",
"Mixins",
"Interfaces",
"Global",
"Menu"
]
}
},
"templates": {
"cleverLinks": true,
"monospaceLinks": false,
"default": {
"outputSourceFiles": false
}
},
"plantuml": {
"puml": {
"create": true,
"destination": "$(BUILD_PATH)/docs/puml"
},
"images": {
"create": true,
"destination": "$(BUILD_PATH)/docs/images",
"defaultFormat": "svg"
}
}
}
endef
export JSDOCJSON
$(DEPLOYMENT_PATH)jsdoc.json:
$(QUITE) $(ECHO) "$$JSDOCJSON" >> $@
\ No newline at end of file
#############################################################################################
#############################################################################################
##
## COMMANDS JSDOC
##
#############################################################################################
#############################################################################################
# path and binaries
JSDOC ?= $(NODE_MODULES_BIN_DIR)jsdoc
EXECUTABLES = $(EXECUTABLES:-) $(JSDOC);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment