Creates a new NodeJS app

هذا الالتزام موجود في:
2025-09-28 18:03:25 +03:00
الأصل 814a655262
التزام e7b0744ad8
3 ملفات معدلة مع 40 إضافات و0 حذوفات

10
package.json Normal file
عرض الملف

@@ -0,0 +1,10 @@
{
"name": "simple-node-app",
"version": "1.0.0",
"description": "A simple Node.js app for GitHub Actions PR testing",
"main": "src/app.js",
"scripts": {
"test": "bash src/test.sh"
},
"dependencies": {}
}

11
src/app.js Normal file
عرض الملف

@@ -0,0 +1,11 @@
function greet(name) {
return `Hello, ${name}!`;
}
module.export = greet;
if (require.main === module){
console.log(greet("World"))
}

19
src/test.sh Normal file
عرض الملف

@@ -0,0 +1,19 @@
#!/bin/bash
#src/test.sj
EXPECTED=$"Hello, Test!"
OUTPUT=${node -e "console.log(require('./src/app'))('Test)"}
if [ "$OUTPUT" == $"$EXPECTED" ]; then
echo "Test passed!"
exit 0
else
echo "Test failed! Expected '$EXPECTED' but got '$OUTPUT'"
exit 1
fi