@necrolab/dashboard 0.4.46 β 0.4.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/postinstall.js +68 -30
- package/run +176 -9
- package/workbox-config.cjs +1 -1
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@necrolab/dashboard",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.48",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "rm -rf dist &&
|
|
6
|
+
"build": "rm -rf dist && npx workbox-cli generateSW workbox-config.cjs && vite build",
|
|
7
7
|
"dev": "node dev-server.js",
|
|
8
8
|
"bot": "node dev-server.js",
|
|
9
9
|
"expose": "node dev-server.js",
|
package/postinstall.js
CHANGED
|
@@ -5,33 +5,71 @@ import { fileURLToPath } from "node:url";
|
|
|
5
5
|
|
|
6
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
8
|
+
// π¨ Cool colors for better output
|
|
9
|
+
const colors = {
|
|
10
|
+
reset: '\x1b[0m',
|
|
11
|
+
bright: '\x1b[1m',
|
|
12
|
+
cyan: '\x1b[36m',
|
|
13
|
+
green: '\x1b[32m',
|
|
14
|
+
yellow: '\x1b[33m',
|
|
15
|
+
blue: '\x1b[34m',
|
|
16
|
+
magenta: '\x1b[35m'
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// π― Cool logging functions
|
|
20
|
+
const log = {
|
|
21
|
+
info: (msg) => console.log(`${colors.cyan}${colors.bright}βΉοΈ ${msg}${colors.reset}`),
|
|
22
|
+
success: (msg) => console.log(`${colors.green}${colors.bright}β
${msg}${colors.reset}`),
|
|
23
|
+
process: (msg) => console.log(`${colors.yellow}${colors.bright}β‘ ${msg}${colors.reset}`),
|
|
24
|
+
path: (label, path) => console.log(`${colors.blue}π ${colors.bright}${label}:${colors.reset} ${colors.magenta}${path}${colors.reset}`)
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// π Banner for style
|
|
28
|
+
console.log(`${colors.cyan}${colors.bright}`);
|
|
29
|
+
console.log("βββββββββββββββββββββββββββββββββββββββ");
|
|
30
|
+
console.log("β π§ NECRO POSTINSTALL SCRIPT β");
|
|
31
|
+
console.log("βββββββββββββββββββββββββββββββββββββββ");
|
|
32
|
+
console.log(`${colors.reset}`);
|
|
33
|
+
|
|
34
|
+
log.process("Running postinstall build...");
|
|
35
|
+
|
|
36
|
+
var vitePath = path.resolve(path.join(__dirname, "/../../vite/bin/vite.js"));
|
|
37
|
+
|
|
38
|
+
log.path("Vite path", vitePath);
|
|
39
|
+
log.path("Current directory", __dirname);
|
|
40
|
+
|
|
41
|
+
log.process("Generating service worker with Workbox...");
|
|
42
|
+
|
|
43
|
+
execSync(`npx workbox-cli generateSW workbox-config.cjs`, {
|
|
44
|
+
cwd: __dirname,
|
|
45
|
+
stdio: "inherit"
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
log.success("Service worker generated!");
|
|
49
|
+
|
|
50
|
+
log.process("Building with Vite...");
|
|
51
|
+
|
|
52
|
+
execSync(`node "${vitePath}" build`, {
|
|
53
|
+
cwd: __dirname,
|
|
54
|
+
stdio: "inherit"
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
log.success("Vite build completed!");
|
|
58
|
+
|
|
59
|
+
var oldPath = path.resolve("./dist/");
|
|
60
|
+
var distPath = path.resolve(path.join(__dirname, "../../../dashboard/dist/"));
|
|
61
|
+
|
|
62
|
+
log.process("Moving build artifacts...");
|
|
63
|
+
log.path("Source", oldPath);
|
|
64
|
+
log.path("Destination", distPath);
|
|
65
|
+
|
|
66
|
+
fs.rmSync(distPath, {
|
|
67
|
+
recursive: true
|
|
68
|
+
});
|
|
69
|
+
fs.renameSync(oldPath, distPath);
|
|
70
|
+
|
|
71
|
+
log.success("Build artifacts moved successfully!");
|
|
72
|
+
|
|
73
|
+
console.log(`${colors.green}${colors.bright}`);
|
|
74
|
+
console.log("π Postinstall completed successfully!");
|
|
75
|
+
console.log(`${colors.reset}`);
|
package/run
CHANGED
|
@@ -1,10 +1,177 @@
|
|
|
1
|
+
#!/bin/bash
|
|
1
2
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
# π― Necro Dashboard Runner - Fire Edition π₯
|
|
4
|
+
# Enhanced runner script with style and robust functionality
|
|
5
|
+
|
|
6
|
+
# Colors for that fire output π
|
|
7
|
+
RED='\033[0;31m'
|
|
8
|
+
GREEN='\033[0;32m'
|
|
9
|
+
YELLOW='\033[1;33m'
|
|
10
|
+
BLUE='\033[0;34m'
|
|
11
|
+
PURPLE='\033[0;35m'
|
|
12
|
+
CYAN='\033[0;36m'
|
|
13
|
+
WHITE='\033[1;37m'
|
|
14
|
+
BOLD='\033[1m'
|
|
15
|
+
NC='\033[0m' # No Color
|
|
16
|
+
|
|
17
|
+
# Fire emojis for maximum style
|
|
18
|
+
FIRE="π₯"
|
|
19
|
+
ROCKET="π"
|
|
20
|
+
GEAR="βοΈ"
|
|
21
|
+
CHECK="β
"
|
|
22
|
+
CROSS="β"
|
|
23
|
+
LIGHTNING="β‘"
|
|
24
|
+
|
|
25
|
+
# Banner function
|
|
26
|
+
show_banner() {
|
|
27
|
+
echo -e "${PURPLE}${BOLD}"
|
|
28
|
+
echo " ββββ βββββββββββ ββββββββββββββ βββββββ "
|
|
29
|
+
echo " βββββ ββββββββββββββββββββββββββββββββββββ"
|
|
30
|
+
echo " ββββββ βββββββββ βββ βββββββββββ βββ"
|
|
31
|
+
echo " ββββββββββββββββ βββ βββββββββββ βββ"
|
|
32
|
+
echo " βββ βββββββββββββββββββββββββ ββββββββββββ"
|
|
33
|
+
echo " βββ βββββββββββββ ββββββββββ βββ βββββββ "
|
|
34
|
+
echo -e "${NC}"
|
|
35
|
+
echo -e "${CYAN}${BOLD}Dashboard Runner ${FIRE} v2.0${NC}"
|
|
36
|
+
echo -e "${WHITE}ββββββββββββββββββββββββββββββββββββββββββββ${NC}"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
# Spinner function for loading animations
|
|
40
|
+
spinner() {
|
|
41
|
+
local pid=$1
|
|
42
|
+
local delay=0.1
|
|
43
|
+
local spinstr='β β β Ήβ Έβ Όβ ΄β ¦β §β β '
|
|
44
|
+
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do
|
|
45
|
+
local temp=${spinstr#?}
|
|
46
|
+
printf " [%c] " "$spinstr"
|
|
47
|
+
local spinstr=$temp${spinstr%"$temp"}
|
|
48
|
+
sleep $delay
|
|
49
|
+
printf "\b\b\b\b\b\b"
|
|
50
|
+
done
|
|
51
|
+
printf " \b\b\b\b"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# Success message
|
|
55
|
+
success() {
|
|
56
|
+
echo -e "${GREEN}${BOLD}${CHECK} $1${NC}"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# Error message
|
|
60
|
+
error() {
|
|
61
|
+
echo -e "${RED}${BOLD}${CROSS} $1${NC}"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Info message
|
|
65
|
+
info() {
|
|
66
|
+
echo -e "${CYAN}${BOLD}${LIGHTNING} $1${NC}"
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Warning message
|
|
70
|
+
warn() {
|
|
71
|
+
echo -e "${YELLOW}${BOLD}β οΈ $1${NC}"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Check if npm is available
|
|
75
|
+
check_npm() {
|
|
76
|
+
if ! command -v npm &> /dev/null; then
|
|
77
|
+
error "npm is not installed or not in PATH"
|
|
78
|
+
exit 1
|
|
79
|
+
fi
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
# Check if node is available
|
|
83
|
+
check_node() {
|
|
84
|
+
if ! command -v node &> /dev/null; then
|
|
85
|
+
error "Node.js is not installed or not in PATH"
|
|
86
|
+
exit 1
|
|
87
|
+
fi
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
# Build function with proper error handling
|
|
91
|
+
build_project() {
|
|
92
|
+
info "Initiating build sequence ${GEAR}"
|
|
93
|
+
|
|
94
|
+
# Check dependencies
|
|
95
|
+
check_npm
|
|
96
|
+
|
|
97
|
+
echo -e "${YELLOW}${BOLD}Building production files...${NC}"
|
|
98
|
+
|
|
99
|
+
# Run build with error handling
|
|
100
|
+
if npm run build; then
|
|
101
|
+
success "Build completed successfully ${ROCKET}"
|
|
102
|
+
return 0
|
|
103
|
+
else
|
|
104
|
+
error "Build failed! Check the output above for details."
|
|
105
|
+
exit 1
|
|
106
|
+
fi
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
# Start server function
|
|
110
|
+
start_server() {
|
|
111
|
+
info "Starting Necro Dashboard server ${ROCKET}"
|
|
112
|
+
|
|
113
|
+
# Check if Node.js is available
|
|
114
|
+
check_node
|
|
115
|
+
|
|
116
|
+
# Check if index.js exists
|
|
117
|
+
if [[ ! -f "index.js" ]]; then
|
|
118
|
+
error "index.js not found in current directory"
|
|
119
|
+
exit 1
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
echo -e "${GREEN}${BOLD}Server starting...${NC}"
|
|
123
|
+
echo -e "${CYAN}Press ${WHITE}Ctrl+C${CYAN} to stop the server${NC}"
|
|
124
|
+
echo -e "${WHITE}ββββββββββββββββββββββββββββββββββββββββββββ${NC}"
|
|
125
|
+
|
|
126
|
+
# Start the server
|
|
127
|
+
node index.js
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
# Help function
|
|
131
|
+
show_help() {
|
|
132
|
+
echo -e "${WHITE}${BOLD}Usage:${NC}"
|
|
133
|
+
echo -e " ${CYAN}./run${NC} ${WHITE}Start the server${NC}"
|
|
134
|
+
echo -e " ${CYAN}./run build${NC} ${WHITE}Build project then start server${NC}"
|
|
135
|
+
echo -e " ${CYAN}./run help${NC} ${WHITE}Show this help message${NC}"
|
|
136
|
+
echo ""
|
|
137
|
+
echo -e "${WHITE}${BOLD}Examples:${NC}"
|
|
138
|
+
echo -e " ${YELLOW}./run${NC} ${GREEN}# Quick start for development${NC}"
|
|
139
|
+
echo -e " ${YELLOW}./run build${NC} ${GREEN}# Production build + start${NC}"
|
|
140
|
+
echo ""
|
|
141
|
+
echo -e "${PURPLE}Made with ${FIRE} for ticket automation${NC}"
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
# Main execution flow
|
|
145
|
+
main() {
|
|
146
|
+
# Clear screen for clean output
|
|
147
|
+
clear
|
|
148
|
+
|
|
149
|
+
# Show the fire banner
|
|
150
|
+
show_banner
|
|
151
|
+
|
|
152
|
+
case "${1:-}" in
|
|
153
|
+
"build")
|
|
154
|
+
build_project
|
|
155
|
+
echo ""
|
|
156
|
+
start_server
|
|
157
|
+
;;
|
|
158
|
+
"help"|"-h"|"--help")
|
|
159
|
+
show_help
|
|
160
|
+
;;
|
|
161
|
+
"")
|
|
162
|
+
start_server
|
|
163
|
+
;;
|
|
164
|
+
*)
|
|
165
|
+
warn "Unknown command: $1"
|
|
166
|
+
echo ""
|
|
167
|
+
show_help
|
|
168
|
+
exit 1
|
|
169
|
+
;;
|
|
170
|
+
esac
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# Error handling for script interruption
|
|
174
|
+
trap 'echo -e "\n${YELLOW}${BOLD}${LIGHTNING} Server stopped${NC}"; exit 0' INT
|
|
175
|
+
|
|
176
|
+
# Run the main function
|
|
177
|
+
main "$@"
|