From e40741ab876a23c2ace23c4a59fbd95268ce0903 Mon Sep 17 00:00:00 2001
From: "allcontributors[bot]"
<46447321+allcontributors[bot]@users.noreply.github.com>
Date: Thu, 7 Dec 2023 08:40:46 +0100
Subject: [PATCH 1/2] docs: add MarcinParda as a contributor for code (#24)
* docs: update README.md [skip ci]
* docs: update .all-contributorsrc [skip ci]
---------
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
---
.all-contributorsrc | 9 +++++++++
README.md | 5 +++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/.all-contributorsrc b/.all-contributorsrc
index e183ba3..9ea1211 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -34,6 +34,15 @@
"contributions": [
"maintenance"
]
+ },
+ {
+ "login": "MarcinParda",
+ "name": "Marcin Parda",
+ "avatar_url": "https://avatars.githubusercontent.com/u/32539248?v=4",
+ "profile": "https://marcinparda.vercel.app/",
+ "contributions": [
+ "code"
+ ]
}
],
"contributorsPerLine": 7,
diff --git a/README.md b/README.md
index 66bf540..77991ea 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ Teraz możesz skupić się na wykonaniu zadania i weryfikacji testów poprzez po
Nasz projekt wspierają ([zobacz typ kontrybucji](https://allcontributors.org/docs/en/emoji-key)):
-[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
+[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
@@ -31,8 +31,9 @@ Nasz projekt wspierają ([zobacz typ kontrybucji](https://allcontributors.org/do
Oskar Puchalski 🐛 |
- Stanisław Synowiec 💻 |
+ Stanisław Synowiec 💻 🐛 |
Adrian Polak 🚧 |
+ Marcin Parda 💻 |
From 5434aad06dbd6660f723fdd87867fac1d729286b Mon Sep 17 00:00:00 2001
From: Marcin Parda
Date: Thu, 7 Dec 2023 08:40:58 +0100
Subject: [PATCH 2/2] feat: Create script to create templates for whole mont in
current year (#22)
* * feat(package.json): add "create:month" script to create month templates
* feat(create-month-templates.js): add script to create month templates in tasks folder
* feat: update README with new script
* fix: readme.md formatting
---------
Co-authored-by: przeprogramowani <51264853+przeprogramowani@users.noreply.github.com>
---
README.md | 2 ++
package.json | 1 +
scripts/create-month-templates.js | 42 +++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 scripts/create-month-templates.js
diff --git a/README.md b/README.md
index 77991ea..03f01b0 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,8 @@ Każdego dnia wykonaj w repozytorium polecenie `npm run create` a następnie sko
Teraz możesz skupić się na wykonaniu zadania i weryfikacji testów poprzez polecenie `npm test`.
+Możesz również wykonać polecenie `npm run create:month`, aby przygotować puste pliki do zadań na wszystkie 24 dni w kalendarzu.
+
## 💜 Kontrybutorzy
Nasz projekt wspierają ([zobacz typ kontrybucji](https://allcontributors.org/docs/en/emoji-key)):
diff --git a/package.json b/package.json
index 91df7ad..fb5f548 100644
--- a/package.json
+++ b/package.json
@@ -7,6 +7,7 @@
"license": "ISC",
"scripts": {
"create": "node ./scripts/create-template.js",
+ "create:month": "node ./scripts/create-month-templates.js",
"test": "jest ./tasks/$(date +'%Y-%m-%d')/index.test.ts",
"test:all": "jest"
},
diff --git a/scripts/create-month-templates.js b/scripts/create-month-templates.js
new file mode 100644
index 0000000..19c8820
--- /dev/null
+++ b/scripts/create-month-templates.js
@@ -0,0 +1,42 @@
+import fs from 'fs';
+import path from 'path';
+
+const today = new Date();
+const year = today.getFullYear();
+const month = 12;
+const daysInCalendar = 24;
+const daysToGenerate = Array.from({ length: daysInCalendar }, (_, i) =>
+ String(i + 1).padStart(2, '0')
+);
+
+if (!fs.existsSync('tasks')) {
+ fs.mkdirSync('tasks');
+}
+
+let atLeastOneFolderCreated = false;
+
+daysToGenerate.forEach((day) => {
+ const folderName = `${year}-${month}-${day}`;
+ const folderPath = path.join('tasks', folderName);
+
+ if (!fs.existsSync(folderPath)) {
+ fs.mkdirSync(folderPath);
+ const indexFilePath = path.join(folderPath, 'index.ts');
+ fs.writeFileSync(indexFilePath, '// Tutaj skopiuj kod zadania');
+
+ const testFilePath = path.join(folderPath, 'index.test.ts');
+ fs.writeFileSync(
+ testFilePath,
+ '// Tutaj skopiuj testy dla zadania. Uruchom je poleceniem `npm test`'
+ );
+ atLeastOneFolderCreated = true;
+
+ console.log(
+ `Przygotowano szablon na zadanie w folderze tasks/${folderName} 🎄`
+ );
+ }
+});
+
+if (!atLeastOneFolderCreated) {
+ console.log('Foldery na tegoroczne zadania już istnieją 🤔');
+}