Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: template create automation #23

Merged
merged 5 commits into from
Dec 11, 2023
Merged

Conversation

kumiega
Copy link
Contributor

@kumiega kumiega commented Dec 6, 2023

I have created a more advanced template automation inside create-template.js script. I added two extra script paths with parameters usage. The all parameter will create tasks for whole event and with-previous do it from relative "today" to the event start date.

Also I have prepared the npm scripts for these parameters and updated the README.md docs.

Refined the create-template script to introduce additional automation
with two new arguments: "all" and "with-previous". The "all" parameter
facilitates the creation of folders for all tasks from the event's start
to its end, streamlining the process. The "with-previous" parameter
option enables the generation of missing tasks from the current date
to the event's start date.
@kumiega kumiega changed the title Template create automation feat: template create automation Dec 6, 2023
if (!fs.existsSync('tasks')) {
fs.mkdirSync('tasks');
if (!arg) {
createTaskFolder(new Date());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow-up, would be nice to reuse createTaskFoldersFromRange with just one day. I do understand it requires more work, so only FYI, not a blocker.

package.json Outdated
@@ -7,6 +7,8 @@
"license": "ISC",
"scripts": {
"create": "node ./scripts/create-template.js",
"create-all": "node ./scripts/create-template.js all",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use semicolons like with test:all and create:all if you don't mind.

README.md Outdated
@@ -14,14 +14,22 @@ Zadania są dostępne na stronie [opanujfrontend.pl/advent](https://opanujfronte

Każdego dnia wykonaj w repozytorium polecenie `npm run create` a następnie skopiuj kod ze strony.

Użyj komendy `npm run create all`, jeśli chcesz wygenerować foldery z plikami startowymi
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's best to reference explicit names of npm scripts just to be consistent.

npm run create:month as suggested by @MarcinParda
npm run create:? - I can't find any single-word name for "up until today"

@przeprogramowani
Copy link
Owner

@kumiega Thank's a lot for this PR. Just to preserve original order of requests and proposals, I just merged create:month from @MarcinParda - I think you PR is a natural extension of what's already in master so if you don't mind, please continue and let's make the "with previous" happen. Happy to merge once you review my comments.

@kumiega
Copy link
Contributor Author

kumiega commented Dec 7, 2023

Thanks for response. I will try to make changes today.

@kumiega
Copy link
Contributor Author

kumiega commented Dec 9, 2023

It took some time, but I finally pushed the changes to the repo!

@psmyrdek
Copy link
Collaborator

We'll take a look today, many thanks :)

@przeprogramowani
Copy link
Owner

@all-contributors please add @kumiega for code

Copy link
Contributor

@przeprogramowani

I've put up a pull request to add @kumiega! 🎉

@psmyrdek psmyrdek merged commit a651e9a into przeprogramowani:main Dec 11, 2023
1 check passed
artur1989 pushed a commit to artur1989/advent-of-frontend that referenced this pull request Dec 25, 2023
* feat: improve create template script

Refined the create-template script to introduce additional automation
with two new arguments: "all" and "with-previous". The "all" parameter
facilitates the creation of folders for all tasks from the event's start
to its end, streamlining the process. The "with-previous" parameter
option enables the generation of missing tasks from the current date
to the event's start date.

* feat: add new create-template scripts

* docs: update README.md with new scripts

styles: fix whitespaces

---------

Co-authored-by: Przemek Smyrdek <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants