From 2a4fbd7d1d35a239037f3978f6bd8aa5a4bdb692 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Thu, 15 Jan 2026 23:35:57 +0100 Subject: [PATCH 01/16] final draft --- task-1/setup.sh | 44 +++++++++++++++++++++++++++++++++++++- task-2/github-username.txt | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/task-1/setup.sh b/task-1/setup.sh index 4067509..232a85a 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -1 +1,43 @@ -# Write your code here \ No newline at end of file +#!/bin/bash +echo "Hello, world!" +mkdir project +cd project +git init +mkdir README.md resources settings.conf src +cd resources +touch family picture.jpg icon.png logo.png +cd .. +cd src +touch database profile program.java +cd .. +git add . +git commit -m "initial commit" +echo "Setup project..." +cd README.md +echo "Welcome to my project" >> README.md +cd .. +cd src +rm profile +cd .. +cd resources +rm family picture.jpg +cd .. +git add . +git commit -m "delete files" +pwd +cd resources +pwd +ls -a +echo "Setup javascript..." +cd .. +cd src +pwd +mv program.java program.js +echo "console.log('Javascript works!');" >> program.js +node program.js +cd .. +pwd +git add . +git commit -m "model runs" +ls -a +echo "All done!" \ No newline at end of file diff --git a/task-2/github-username.txt b/task-2/github-username.txt index 5eabca7..8c77991 100644 --- a/task-2/github-username.txt +++ b/task-2/github-username.txt @@ -1 +1 @@ - \ No newline at end of file +hannahwn From 538e8a7841983cda20005226aca782f80470a527 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 12:51:47 +0100 Subject: [PATCH 02/16] removed the placeholder --- task-2/github-username.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task-2/github-username.txt b/task-2/github-username.txt index 8c77991..987de4a 100644 --- a/task-2/github-username.txt +++ b/task-2/github-username.txt @@ -1 +1 @@ -hannahwn +hannahwn From 9690a065c9d4d2dc2ece5404afaafdcbfdabd3eb Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 12:56:07 +0100 Subject: [PATCH 03/16] inserted creating project --- task-1/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task-1/setup.sh b/task-1/setup.sh index 232a85a..4509715 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -echo "Hello, world!" +echo "Creating project..." mkdir project cd project git init From d8fc3e74864cf5f16a62956eb0168827462c36fb Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 12:57:45 +0100 Subject: [PATCH 04/16] used touch to create files --- task-1/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task-1/setup.sh b/task-1/setup.sh index 4509715..3b00694 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -3,7 +3,7 @@ echo "Creating project..." mkdir project cd project git init -mkdir README.md resources settings.conf src +touch README.md resources settings.conf src cd resources touch family picture.jpg icon.png logo.png cd .. From d50eea6c71a36ef9c51b6edc6849dde4a72d0ef3 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 12:59:09 +0100 Subject: [PATCH 05/16] added quatations to a file with spaces --- task-1/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task-1/setup.sh b/task-1/setup.sh index 3b00694..54f1e24 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -5,7 +5,7 @@ cd project git init touch README.md resources settings.conf src cd resources -touch family picture.jpg icon.png logo.png +touch "family picture.jpg" icon.png logo.png cd .. cd src touch database profile program.java From 6eca585da2f04c93fd007a1df95cbd8a42b80d00 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 13:02:07 +0100 Subject: [PATCH 06/16] used the right command for making folders --- task-1/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task-1/setup.sh b/task-1/setup.sh index 54f1e24..7bb333b 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -8,7 +8,7 @@ cd resources touch "family picture.jpg" icon.png logo.png cd .. cd src -touch database profile program.java +mkdir database profile program.java cd .. git add . git commit -m "initial commit" From 0a66dfe7715cc3c4d308abececb3bcb162719dd4 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 13:06:42 +0100 Subject: [PATCH 07/16] corrected the remove command --- task-1/setup.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/task-1/setup.sh b/task-1/setup.sh index 7bb333b..616314c 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -13,14 +13,13 @@ cd .. git add . git commit -m "initial commit" echo "Setup project..." -cd README.md echo "Welcome to my project" >> README.md cd .. cd src -rm profile +rm -r profile cd .. cd resources -rm family picture.jpg +rm -r family picture.jpg cd .. git add . git commit -m "delete files" From bb7f9e01f7df7a7b898e6d89aaac253dd97e526c Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 13:08:00 +0100 Subject: [PATCH 08/16] showed the contents of resources only --- task-1/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task-1/setup.sh b/task-1/setup.sh index 616314c..a524f48 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -26,7 +26,7 @@ git commit -m "delete files" pwd cd resources pwd -ls -a +ls resources echo "Setup javascript..." cd .. cd src From a1f5438900dfad305ce01454f3eec19fad220648 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 13:11:59 +0100 Subject: [PATCH 09/16] adde the sleep command --- task-1/setup.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/task-1/setup.sh b/task-1/setup.sh index a524f48..01bc481 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -19,11 +19,11 @@ cd src rm -r profile cd .. cd resources -rm -r family picture.jpg +rm -r "family picture.jpg" cd .. git add . -git commit -m "delete files" -pwd +git commit -m "deleted files" +sleep 3 cd resources pwd ls resources @@ -37,6 +37,6 @@ node program.js cd .. pwd git add . -git commit -m "model runs" +git commit -m "checked the script runs" ls -a echo "All done!" \ No newline at end of file From c97561ffd96f7cfb31a9e31e5c0af5e0adceedc9 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 13:24:53 +0100 Subject: [PATCH 10/16] initial commit --- task-1/README.md | 0 task-1/family picture.jpg | 0 task-1/icon.png | 0 task-1/logo.png | 0 task-1/resources | 0 task-1/settings.conf | 0 task-1/setup.sh | 1 + task-1/src | 0 8 files changed, 1 insertion(+) create mode 100644 task-1/README.md create mode 100644 task-1/family picture.jpg create mode 100644 task-1/icon.png create mode 100644 task-1/logo.png create mode 100644 task-1/resources create mode 100644 task-1/settings.conf create mode 100644 task-1/src diff --git a/task-1/README.md b/task-1/README.md new file mode 100644 index 0000000..e69de29 diff --git a/task-1/family picture.jpg b/task-1/family picture.jpg new file mode 100644 index 0000000..e69de29 diff --git a/task-1/icon.png b/task-1/icon.png new file mode 100644 index 0000000..e69de29 diff --git a/task-1/logo.png b/task-1/logo.png new file mode 100644 index 0000000..e69de29 diff --git a/task-1/resources b/task-1/resources new file mode 100644 index 0000000..e69de29 diff --git a/task-1/settings.conf b/task-1/settings.conf new file mode 100644 index 0000000..e69de29 diff --git a/task-1/setup.sh b/task-1/setup.sh index 01bc481..051d2b5 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -1,5 +1,6 @@ #!/bin/bash echo "Creating project..." +rm -rf project mkdir project cd project git init diff --git a/task-1/src b/task-1/src new file mode 100644 index 0000000..e69de29 From 00a1b19121ea09784665bdf66fd596d82486fa11 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 13:26:01 +0100 Subject: [PATCH 11/16] initial commit --- README.md | 1 + task-1/setup.sh | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0e5a6b..e6d497d 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,4 @@ Write your github username in the file `task-2/github-username.txt`. Do not include the `@` symbol before your username. Do not paste the URL of your github profile. +Welcome to my project diff --git a/task-1/setup.sh b/task-1/setup.sh index 051d2b5..899e86b 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -4,7 +4,10 @@ rm -rf project mkdir project cd project git init -touch README.md resources settings.conf src +touch README.md +touch resources +touch settings.conf +touch src cd resources touch "family picture.jpg" icon.png logo.png cd .. From 32d7cf1fe4f6a003b37158484be9d62fe9a40fe0 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 17:47:39 +0100 Subject: [PATCH 12/16] initial commit --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e6d497d..a019518 100644 --- a/README.md +++ b/README.md @@ -11,3 +11,4 @@ Write your github username in the file `task-2/github-username.txt`. Do not include the `@` symbol before your username. Do not paste the URL of your github profile. Welcome to my project +Welcome to my project From 6f3685ef3e8ad6018dd3e6fc99ab957006e20bef Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 17:49:58 +0100 Subject: [PATCH 13/16] initial commit --- README.md | 1 + task-1/setup.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a019518..a27d3fe 100644 --- a/README.md +++ b/README.md @@ -12,3 +12,4 @@ Do not include the `@` symbol before your username. Do not paste the URL of your github profile. Welcome to my project Welcome to my project +Welcome to my project diff --git a/task-1/setup.sh b/task-1/setup.sh index 899e86b..2ed24b6 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -1,6 +1,6 @@ #!/bin/bash echo "Creating project..." -rm -rf project + mkdir project cd project git init From 701ef140bd6dc900391c0a94d4d1ca1b84c7ac52 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 17:55:40 +0100 Subject: [PATCH 14/16] initial commit --- README.md | 1 + task-1/README.md | 0 task-1/family picture.jpg | 0 task-1/icon.png | 0 task-1/logo.png | 0 task-1/resources | 0 task-1/settings.conf | 0 task-1/src | 0 8 files changed, 1 insertion(+) delete mode 100644 task-1/README.md delete mode 100644 task-1/family picture.jpg delete mode 100644 task-1/icon.png delete mode 100644 task-1/logo.png delete mode 100644 task-1/resources delete mode 100644 task-1/settings.conf delete mode 100644 task-1/src diff --git a/README.md b/README.md index a27d3fe..5cdcb5c 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,4 @@ Do not paste the URL of your github profile. Welcome to my project Welcome to my project Welcome to my project +Welcome to my project diff --git a/task-1/README.md b/task-1/README.md deleted file mode 100644 index e69de29..0000000 diff --git a/task-1/family picture.jpg b/task-1/family picture.jpg deleted file mode 100644 index e69de29..0000000 diff --git a/task-1/icon.png b/task-1/icon.png deleted file mode 100644 index e69de29..0000000 diff --git a/task-1/logo.png b/task-1/logo.png deleted file mode 100644 index e69de29..0000000 diff --git a/task-1/resources b/task-1/resources deleted file mode 100644 index e69de29..0000000 diff --git a/task-1/settings.conf b/task-1/settings.conf deleted file mode 100644 index e69de29..0000000 diff --git a/task-1/src b/task-1/src deleted file mode 100644 index e69de29..0000000 From 0b293d451d19a8e08b7198c78d1bc5b6612b2968 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 21 Jan 2026 17:58:24 +0100 Subject: [PATCH 15/16] initial commit --- README.md | 1 + task-1/setup.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5cdcb5c..985fcee 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,4 @@ Welcome to my project Welcome to my project Welcome to my project Welcome to my project +Welcome to my project diff --git a/task-1/setup.sh b/task-1/setup.sh index 2ed24b6..f8e7f79 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -5,9 +5,9 @@ mkdir project cd project git init touch README.md -touch resources +mkdir resources touch settings.conf -touch src +mkdir src cd resources touch "family picture.jpg" icon.png logo.png cd .. From 47653ac6c7ba5582c839981c4da659cc23be921d Mon Sep 17 00:00:00 2001 From: hannahwn Date: Sun, 25 Jan 2026 16:30:22 +0100 Subject: [PATCH 16/16] Assignment Hannah1 --- .github/workflows/grade-assignment.yml | 13 -- .hyf/package.json | 12 -- .hyf/task1.js | 166 ------------------------- .hyf/task2.js | 79 ------------ .hyf/test.sh | 5 - .hyf/tester.js | 32 ----- README.md | 17 --- family picture.jpg | 0 icon.png | 0 logo.png | 0 resources | 0 settings.conf | 0 src | 0 task-1/setup.sh | 20 +-- task-2/github-username.txt | 1 - 15 files changed, 10 insertions(+), 335 deletions(-) delete mode 100644 .github/workflows/grade-assignment.yml delete mode 100644 .hyf/package.json delete mode 100644 .hyf/task1.js delete mode 100644 .hyf/task2.js delete mode 100644 .hyf/test.sh delete mode 100644 .hyf/tester.js create mode 100644 family picture.jpg create mode 100644 icon.png create mode 100644 logo.png create mode 100644 resources create mode 100644 settings.conf create mode 100644 src delete mode 100644 task-2/github-username.txt diff --git a/.github/workflows/grade-assignment.yml b/.github/workflows/grade-assignment.yml deleted file mode 100644 index d06dc2d..0000000 --- a/.github/workflows/grade-assignment.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: Grade Assignment - -on: - pull_request_target: - branches: - - main - -jobs: - grade: - permissions: - issues: write - pull-requests: write - uses: HackYourFuture/github-actions/.github/workflows/auto-grade.yml@main diff --git a/.hyf/package.json b/.hyf/package.json deleted file mode 100644 index ac1bb20..0000000 --- a/.hyf/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "hyf", - "version": "1.0.0", - "description": "HackYourFuture assignment", - "license": "ISC", - "author": "", - "type": "module", - "main": "tester.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - } -} \ No newline at end of file diff --git a/.hyf/task1.js b/.hyf/task1.js deleted file mode 100644 index e43ef28..0000000 --- a/.hyf/task1.js +++ /dev/null @@ -1,166 +0,0 @@ -import fs from 'fs/promises'; -import { exec } from 'child_process'; -import { promisify } from 'util'; - -const execPromise = promisify(exec); - -const setup = async () => { - await fs.rm('project', { recursive: true, force: true }); - await execPromise('git config --global user.name "Tester"'); - await execPromise('git config --global user.email "tester@example.com"'); -} - -const checkPath = async (filePath, shouldExist) => { - let score = 0; - try { - await fs.access(filePath); - let icon = shouldExist ? "✅" : "❌"; - if (shouldExist) { - score = 2; - } - console.log(`${icon} Path exists:`, filePath); - } catch { - let icon = shouldExist ? "❌" : "✅"; - if (!shouldExist) { - score = 2; - } - console.log(`${icon} Path does not exist:`, filePath); - } - return score; -} - -const checkFileContent = async (filePath, expectedContent) => { - let score = 0; - try { - const content = await fs.readFile(filePath, 'utf-8'); - if (content.trim() === expectedContent.trim()) { - score += 3; - console.log(`✅ File content is correct:`, filePath); - } else { - console.log(`❌ File content does not match:`, filePath); - console.log(`Expected: "${expectedContent.trim()}"`); - console.log(`Found: "${content.trim()}"`); - } - } catch (error) { - console.log(`❌ Error reading file:`, filePath); - } - return score; -} - -const checkStringInOutput = (output, pattern) => { - let score = 0; - const regex = new RegExp(pattern, 'i'); - if (regex.test(output)) { - console.log(`✅ Output has: "${pattern}"`); - score += 1; - } else { - console.log(`❌ Output does not have: "${pattern}"`); - } - return score; -} - -const checkGitCommits = async () => { - let score = 0; - const workDir = 'project'; - try { - // Check number of commits - const { stdout: countOutput } = await execPromise('git rev-list --count HEAD', { cwd: workDir }); - const commitCount = Number.parseInt(countOutput.trim()) ?? 0; - if (commitCount === 3) { - console.log(`✅ Found 3 commits`); - } else { - console.log(`❌ Expected 3 commits, found ${commitCount}`); - } - score += Math.max(commitCount, 0) * 3; - - // Check first commit message - const { stdout: firstCommitMsg } = await execPromise('git log --format=%s $(git rev-list --max-parents=0 HEAD)', { cwd: workDir }); - const message = firstCommitMsg.trim(); - - if (message.toLowerCase() === 'initial commit') { - console.log(`✅ First commit message is "initial commit"`); - score += 1; - } else { - console.log(`❌ First commit message is "${message}", expected "initial commit"`); - } - } catch (error) { - console.log(`❌ Error checking git commits:`, error.message); - } - return score; -} - -export const task1 = async () => { - // Setup - let score = 0; - let maxScore = 0; - await setup(); - - // Run - console.error('▶️ Running setup.sh...'); - let output = null; - const startTime = performance.now(); - try { - let result = await execPromise('bash ../task-1/setup.sh'); - output = result.stdout; - console.log(`✅ Successfully executed setup.sh.`); - } catch (error) { - console.error(`❌ Error executing setup.sh (Exit code ${error.code})`); - output = error.stdout + error.stderr; - } - - // check execution time (5 points) - maxScore += 5; - const executionTime = (performance.now() - startTime) / 1000; - if (executionTime >= 6) { - console.log(`✅ Script ran for at least 6 seconds`); - score += 5; - } else { - console.log(`❌ Script ran for less than 6 seconds (${executionTime.toFixed(2)}s)`); - } - - // Check paths (26 points) - maxScore += 26; - const expectedPaths = [ - 'project', - 'project/README.md', - 'project/settings.conf', - 'project/resources', - 'project/resources/icon.png', - 'project/resources/logo.png', - 'project/src', - 'project/src/program.js', - 'project/src/database', - 'project/.git' - ]; - const expectedPathsNotToExist = [ - 'project/resources/family picture.jpg', - 'project/src/profile', - 'project/src/program.java', - ]; - for (const path of expectedPaths) { - score += await checkPath(path, true); - } - for (const path of expectedPathsNotToExist) { - score += await checkPath(path, false); - } - - // Check file contents (6 points) - maxScore += 6; - score += await checkFileContent('project/src/program.js', `console.log('JavaScript works!');`); - score += await checkFileContent('project/README.md', `Welcome to my project`); - - // Check output content (6 points) - maxScore += 6; - score += checkStringInOutput(output, 'Creating project'); - score += checkStringInOutput(output, 'Setup project'); - score += checkStringInOutput(output, 'Setup JavaScript'); - score += checkStringInOutput(output, 'JavaScript works!'); - score += checkStringInOutput(output, 'icon.png'); - score += checkStringInOutput(output, 'All done!'); - - // Check git commits (10 points) - maxScore += 10; - score += await checkGitCommits(); - - return Math.round((score / maxScore) * 100); -}; diff --git a/.hyf/task2.js b/.hyf/task2.js deleted file mode 100644 index 32b5afa..0000000 --- a/.hyf/task2.js +++ /dev/null @@ -1,79 +0,0 @@ -import fs from 'fs/promises'; - -const readGithubUsername = async () => { - try { - - const content = await fs.readFile('../task-2/github-username.txt', 'utf-8'); - return content.trim(); - } catch (error) { - console.log('❌ Error reading github-username.txt:', error.message); - return null; - } -}; - -const fetchGithubProfile = async (username) => { - const readmeUrl = `https://raw.githubusercontent.com/${username}/${username}/main/README.md`; - console.log('▶️ Downloading profile README from:', readmeUrl); - - try { - const response = await fetch(readmeUrl); - if (!response.ok) { - throw new Error(`HTTP ${response.status}: ${response.statusText}`); - } - return await response.text(); - } catch (error) { - console.log('❌ Failed to download profile README:', error.message); - return null; - } -}; - -export const task2 = async () => { - let score = 0; - let maxScore = 30; - - // Read the GitHub username - const username = await readGithubUsername(); - - if (!username) { - console.log('❌ No username found in file'); - return score; - } - - console.log('Your GitHub username:', username); - - const profileContent = (await fetchGithubProfile(username)) ?? ""; - - // Check if profile contains GitHub top languages widget (10 points) - maxScore += 10; - const expectedStatsUrl = `https://github-readme-stats.vercel.app/api/top-langs/?username=${username}`; - if (profileContent.includes(expectedStatsUrl)) { - console.log('✅ Profile contains GitHub top languages widget'); - score += 10; - } else { - console.log('❌ Profile does not contain GitHub top languages widget'); - } - - - // Check if profile contains GitHub top languages widget (10 points) - maxScore += 10; - const expectedStreaksUrl = `https://streak-stats.demolab.com?user=${username}`; - if (profileContent.includes(expectedStreaksUrl)) { - console.log('✅ Profile contains GitHub streaks widget'); - score += 10; - } else { - console.log('❌ Profile does not contain GitHub streaks widget'); - } - - // Check if profile contains GitHub top languages widget (10 points) - maxScore += 10; - const expectedTitleUrl = `https://readme-typing-svg.demolab.com`; - if (profileContent.includes(expectedTitleUrl)) { - console.log('✅ Profile contains an animated title'); - score += 10; - } else { - console.log('❌ Profile does not contain an animated title'); - } - - return Math.round((score / maxScore) * 100); -} - diff --git a/.hyf/test.sh b/.hyf/test.sh deleted file mode 100644 index 901a19a..0000000 --- a/.hyf/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -# Run the Node.js tester and capture stdout/stderr to the expected output file -/usr/bin/env node tester.js diff --git a/.hyf/tester.js b/.hyf/tester.js deleted file mode 100644 index d58b663..0000000 --- a/.hyf/tester.js +++ /dev/null @@ -1,32 +0,0 @@ -import { task1 } from './task1.js'; -import { task2 } from './task2.js'; -import fs from 'fs/promises'; - -const main = async () => { - console.log('======================= Task 1 ======================='); - const score1 = await task1(); - - console.log('\n======================= Task 2 ======================='); - const score2 = await task2(); - - console.log('\n======================= Summary ======================='); - const totalScore = Math.min(100, Math.round(score1 * 0.7 + score2 * 0.3)); - const passingScore = 50; - console.log(`- Task 1 Score: ${score1}%`); - console.log(`- Task 2 Score: ${score2}%`); - console.log(`Total Score: ${totalScore}%`); - console.log(`Min passing score: ${passingScore}%`); - const results = { - score: totalScore, - pass: totalScore >= passingScore, - passingScore: passingScore - }; - - await fs.writeFile('score.json', JSON.stringify(results, null, 2)); -} - -try { - await main(); -} catch (error) { - console.error(`❌ Something went wrong:\n${error}`); -} diff --git a/README.md b/README.md index 985fcee..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,17 +0,0 @@ -# Core program week 1 assignment -HackYourFuture core program week 1 assignment - -## Submission Instructions -### Task 1 -Complete the script `task-1/setup.sh` according to the assignment instructions. - -### Task 2 -Write your github username in the file `task-2/github-username.txt`. - -Do not include the `@` symbol before your username. -Do not paste the URL of your github profile. -Welcome to my project -Welcome to my project -Welcome to my project -Welcome to my project -Welcome to my project diff --git a/family picture.jpg b/family picture.jpg new file mode 100644 index 0000000..e69de29 diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..e69de29 diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..e69de29 diff --git a/resources b/resources new file mode 100644 index 0000000..e69de29 diff --git a/settings.conf b/settings.conf new file mode 100644 index 0000000..e69de29 diff --git a/src b/src new file mode 100644 index 0000000..e69de29 diff --git a/task-1/setup.sh b/task-1/setup.sh index f8e7f79..4ed3054 100644 --- a/task-1/setup.sh +++ b/task-1/setup.sh @@ -12,34 +12,34 @@ cd resources touch "family picture.jpg" icon.png logo.png cd .. cd src -mkdir database profile program.java +touch database profile program.java cd .. git add . git commit -m "initial commit" echo "Setup project..." echo "Welcome to my project" >> README.md -cd .. + cd src rm -r profile cd .. cd resources rm -r "family picture.jpg" -cd .. + git add . -git commit -m "deleted files" +git commit -m "deleted 2 files" sleep 3 -cd resources -pwd -ls resources + +ls + echo "Setup javascript..." cd .. cd src -pwd -mv program.java program.js + +mv "program.java" "program.js" echo "console.log('Javascript works!');" >> program.js node program.js cd .. -pwd + git add . git commit -m "checked the script runs" ls -a diff --git a/task-2/github-username.txt b/task-2/github-username.txt deleted file mode 100644 index 987de4a..0000000 --- a/task-2/github-username.txt +++ /dev/null @@ -1 +0,0 @@ -hannahwn