initial commit

This commit is contained in:
ihatenodejs 2024-10-12 19:18:53 -04:00 committed by GitHub
parent 6ecdf306f0
commit 1168da72d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 2980 additions and 0 deletions

43
app.js Normal file
View File

@ -0,0 +1,43 @@
const express = require('express');
const path = require('path');
const app = express();
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', (req, res) => {
res.render('index', { req: req });
});
app.get('/about', (req, res) => {
res.render('about', { req: req });
});
app.get('/contact', (req, res) => {
res.render('contact', { req: req });
});
app.get('/verify', (req, res) => {
res.render('verify', { req: req });
});
app.get('/status', (req, res) => {
res.render('status', { req: req });
});
app.get('/design', (req, res) => {
res.render('design', { req: req });
});
app.get('/projects', (req, res) => {
res.render('projects', { req: req });
});
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`Server running on http://localhost:${PORT}`);
});

270
manage Normal file
View File

@ -0,0 +1,270 @@
#!/bin/bash
PORT=3000
SCREEN_NAME="aidxnfun"
SETUP_FILE=".setup_complete"
function install_tools() {
if ! command -v screen &> /dev/null; then
echo -e "\033[1;31mScreen is not installed. Installing now...\033[0m"
echo -e "\033[1;33mYou may need to enter your sudo password.\033[0m"
echo
sudo apt-get update
sudo apt-get install -y screen
echo
echo -e "\033[1;32mScreen installed successfully.\033[0m"
echo
touch $SETUP_FILE
else
echo -e "\033[1;32mScreen is already installed.\033[0m"
touch $SETUP_FILE
fi
}
function show_help() {
echo -e "\033[1;34mUsage:\033[0m ./manage [command]"
echo ""
echo -e "\033[1;33mCommands:\033[0m"
echo -e " \033[1;36m-h, --help, help\033[0m Shows this help message."
echo -e " \033[1;36mup\033[0m Builds the project and starts the server."
echo -e " \033[1;36mdown\033[0m Stops the server and deletes public directory."
echo -e " \033[1;36mrestart\033[0m Restarts the server and recreates public directory."
echo -e " \033[1;36m-s, --status\033[0m Checks if server is running."
echo ""
}
function check_dirs() {
action=$1
created_count=0
deleted_count=0
if [ "$action" == "create" ]; then
for dir in "./public" "./public/js" "./public/css" "./src" "./src/css" "./src/img" "./src/js"; do
if [ ! -d "$dir" ]; then
echo -e "\033[1;34mDeleting the $dir directories...\033[0m"
echo -e "\033[1;34m$dir does not exist, creating...\033[0m"
mkdir -p "$dir"
created_count=$((created_count + 1))
fi
done
if [ "$created_count" -gt 0 ]; then
echo -e "\033[0;32mDone.\033[0m"
fi
elif [ "$action" == "delete" ]; then
if [ -d "./public" ]; then
echo -e "\033[1;34mCreating $dir...\033[0m"
rm -rf "./public"
deleted_count=$((deleted_count + 1))
fi
if [ "$deleted_count" -gt 0 ]; then
echo -e "\033[0;32mDone.\033[0m"
fi
else
echo -e "\033[0;31mInvalid action: $action. Use 'create' or 'delete'.\033[0m"
fi
}
function restart_server() {
clear
check_setup
if [ -f './public' ]; then
echo -e "\033[1;34mDeleting the public directories...\033[0m"
check_dirs "delete"
fi
if [ -f './src/css/main.css' ]; then
echo -e "\033[1;34mDeleting the Tailwind CSS...\033[0m"
rm ./src/css/main.css
echo -e "\033[0;32mDone.\033[0m"
fi
PIDS=$(lsof -t -i:$PORT) # Capture all PIDs on this port
if [ -n "$PIDS" ]; then
echo -e "\033[1;34mStopping server...\033[0m"
for PID in $PIDS; do
kill "$PID" || echo -e "\033[1;31mFailed to kill PID: $PID\033[0m"
done
screen -S "$SCREEN_NAME" -X quit 2>/dev/null || echo -e "\033[1;33mNo screen session to quit.\033[0m"
echo -e "\033[0;32mDone.\033[0m"
else
echo -e "\033[1;33mNo process found on port $PORT.\033[0m"
fi
if [ -f './public' ]; then
echo -e "\033[1;34mCreating the public directories...\033[0m"
check_dirs "create"
fi
echo -e "\033[1;34mBuilding the project...\033[0m"
if ! npm run build > /dev/null; then
echo -e "\033[0;31mBuild failed. Please check for errors above.\033[0m"
exit 1
fi
if [ -f './public/css/base.css' ]; then
echo -e "\033[1;34mCleaning up base Tailwind CSS file...\033[0m"
rm ./public/css/base.css
echo -e "\033[0;32mDone.\033[0m"
fi
echo -e "\033[1;34mStarting the server in a screen session...\033[0m"
screen -dmS $SCREEN_NAME npm start
echo -e "\033[1;32mDone. Server is up and running on port $PORT!\033[0m"
}
function start_server() {
clear
check_setup
PID=$(lsof -t -i:$PORT)
if [ -n "$PID" ]; then
echo -e "\033[1;33mA server process is already running on port $PORT. Skipping server start.\033[0m"
return
fi
if screen -list | grep -q "$SCREEN_NAME"; then
echo -e "\033[1;33mA screen session named '$SCREEN_NAME' is already running. Skipping server start.\033[0m"
return
fi
if [ -f './public' ]; then
echo -e "\033[1;34mCreating the public directories...\033[0m"
check_dirs "create"
fi
if [ -f './src/css/main.css' ]; then
echo -e "\033[1;34mDeleting the Tailwind CSS...\033[0m"
rm ./src/css/main.css
echo -e "\033[0;32mDone.\033[0m"
fi
echo -e "\033[1;34mBuilding the project...\033[0m"
if ! npm run build > /dev/null; then
echo -e "\033[0;31mBuild failed. Please check for errors above.\033[0m"
exit 1
fi
if [ -f './public/css/base.css' ]; then
echo -e "\033[1;34mCleaning up base Tailwind CSS file...\033[0m"
rm ./public/css/base.css
echo -e "\033[0;32mDone.\033[0m"
fi
echo -e "\033[1;34mStarting the server in a screen session...\033[0m"
screen -dmS "$SCREEN_NAME" npm start
echo -e "\033[1;32mDone. Server is up and running on port $PORT!\033[0m"
}
function stop_server() {
clear
check_setup
PID=$(lsof -t -i:$PORT)
if [ -f './public' ]; then
echo -e "\033[1;34mDeleting the public directories...\033[0m"
check_dirs "delete"
fi
if [ -f './src/css/main.css' ]; then
echo -e "\033[1;34mDeleting the Tailwind CSS...\033[0m"
rm ./src/css/main.css
echo -e "\033[0;32mDone.\033[0m"
fi
PIDS=$(lsof -t -i:$PORT)
if [ -n "$PIDS" ]; then
echo -e "\033[1;34mStopping server...\033[0m"
for PID in $PIDS; do
kill "$PID" || echo -e "\033[1;31mFailed to kill PID: $PID\033[0m"
done
screen -S "$SCREEN_NAME" -X quit 2>/dev/null || echo -e "\033[1;33mNo screen session to quit.\033[0m"
echo -e "\033[0;32mDone.\033[0m"
else
echo -e "\033[1;33mNo process found on port $PORT.\033[0m"
fi
}
function check_status() {
check_setup
PID=$(lsof -t -i:$PORT)
if [ -n "$PID" ]; then
echo -e "\033[0;32mServer is running with PID: $PID\033[0m"
else
echo -e "\033[0;31mServer is not running.\033[0m"
fi
}
function setup_screen() {
clear
echo -e "\033[1;34mWelcome to the aidxnFUNbeta 'manage' script setup!\033[0m"
echo
echo -e "\033[1;32mA custom script built by ihatenodejs\033[0m"
echo -e "\033[1;33mand presented by forkers like you...\033[0m"
echo
read -n 1 -s -r -p "Press any key to continue..."
clear
echo -e "\n\nThis script requires Node.js and NPM to be installed on your system."
echo "Please ensure you have them installed before proceeding."
echo
read -n 1 -s -r -p "Press any key to continue..."
clear
echo -e "\n\nThis script requires Node.js and NPM to be installed on your system."
echo "Please ensure you have them installed before proceeding."
echo
echo -e "\n\nTo install Node.js and NPM, you can visit: https://nodejs.org/"
echo "Follow the instructions for your specific operating system."
echo
read -n 1 -s -r -p "Press any key to continue..."
clear
echo -e "\n\nThe script will now check if 'screen' is installed."
echo "You may need to enter your sudo password."
echo
install_tools
echo
touch $SETUP_FILE
read -n 1 -s -r -p "Press any key to finish..."
clear
echo "Have a nice day!"
echo
}
function check_setup() {
if [ ! -f $SETUP_FILE ]; then
echo "Setup has not been completed. Please run './manage setup' first."
exit 1
fi
}
case $1 in
help|-h|--help)
show_help
;;
up)
start_server
;;
down)
stop_server
;;
restart)
restart_server
;;
-s|--status)
check_status
;;
setup)
setup_screen
;;
*)
echo "Unknown command."
show_help
;;
esac

2543
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

115
package.json Normal file
View File

@ -0,0 +1,115 @@
{
"name": "aidxnfunbeta",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"build:css": "npx tailwindcss -i ./src/css/base.css -o ./src/css/main.css && cp -r ./src/css ./public/",
"build:js": "cp -r ./src/js ./public/",
"build:img": "cp -r ./src/img ./public/",
"build": "npm run build:css && npm run build:js && npm run build:img",
"start": "node app.js"
},
"private": true,
"devDependencies": {
"autoprefixer": "^10.4.20",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.6.0",
"ansi-regex": "^6.1.0",
"ansi-styles": "^6.2.1",
"any-promise": "^1.3.0",
"anymatch": "^3.1.3",
"arg": "^5.0.2",
"balanced-match": "^1.0.2",
"binary-extensions": "^2.3.0",
"brace-expansion": "^2.0.1",
"braces": "^3.0.3",
"camelcase-css": "^2.0.1",
"chokidar": "^3.6.0",
"color-convert": "^2.0.1",
"color-name": "^1.1.4",
"commander": "^4.1.1",
"cross-spawn": "^7.0.3",
"cssesc": "^3.0.0",
"didyoumean": "^1.2.2",
"dlv": "^1.1.3",
"eastasianwidth": "^0.2.0",
"ejs": "^3.1.10",
"emoji-regex": "^9.2.2",
"express": "^4.21.1",
"fast-glob": "^3.3.2",
"fastq": "^1.17.1",
"fill-range": "^7.1.1",
"foreground-child": "^3.3.0",
"function-bind": "^1.1.2",
"glob": "^10.4.5",
"glob-parent": "^6.0.2",
"hasown": "^2.0.2",
"is-binary-path": "^2.1.0",
"is-core-module": "^2.15.1",
"is-extglob": "^2.1.1",
"is-fullwidth-code-point": "^3.0.0",
"is-glob": "^4.0.3",
"is-number": "^7.0.0",
"isexe": "^2.0.0",
"jackspeak": "^3.4.3",
"jiti": "^1.21.6",
"lilconfig": "^2.1.0",
"lines-and-columns": "^1.2.4",
"lru-cache": "^10.4.3",
"merge2": "^1.4.1",
"micromatch": "^4.0.8",
"minimatch": "^9.0.5",
"minipass": "^7.1.2",
"mz": "^2.7.0",
"nanoid": "^3.3.7",
"normalize-path": "^3.0.0",
"object-assign": "^4.1.1",
"object-hash": "^3.0.0",
"package-json-from-dist": "^1.0.1",
"path-key": "^3.1.1",
"path-parse": "^1.0.7",
"path-scurry": "^1.11.1",
"picocolors": "^1.1.0",
"picomatch": "^2.3.1",
"pify": "^2.3.0",
"pirates": "^4.0.6",
"postcss-import": "^15.1.0",
"postcss-js": "^4.0.1",
"postcss-load-config": "^4.0.2",
"postcss-nested": "^6.2.0",
"postcss-selector-parser": "^6.1.2",
"postcss-value-parser": "^4.2.0",
"queue-microtask": "^1.2.3",
"read-cache": "^1.0.0",
"readdirp": "^3.6.0",
"resolve": "^1.22.8",
"reusify": "^1.0.4",
"run-parallel": "^1.2.0",
"shebang-command": "^2.0.0",
"shebang-regex": "^3.0.0",
"signal-exit": "^4.1.0",
"source-map-js": "^1.2.1",
"string-width": "^5.1.2",
"string-width-cjs": "^4.2.3",
"strip-ansi": "^7.1.0",
"strip-ansi-cjs": "^6.0.1",
"sucrase": "^3.35.0",
"supports-preserve-symlinks-flag": "^1.0.0",
"thenify": "^3.3.1",
"thenify-all": "^1.6.0",
"to-regex-range": "^5.0.1",
"ts-interface-checker": "^0.1.13",
"util-deprecate": "^1.0.2",
"which": "^2.0.2",
"wrap-ansi": "^8.1.0",
"wrap-ansi-cjs": "^7.0.0",
"yaml": "^2.5.1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": ""
}

0
postcss.config.js Normal file
View File

9
tailwind.config.js Normal file
View File

@ -0,0 +1,9 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./views/**/*.{ejs,js}"],
theme: {
extend: {},
},
plugins: [],
}