Skip to content

[Improvement] Makefile for Development #1729

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

Merged
merged 12 commits into from
Aug 24, 2022
Merged

[Improvement] Makefile for Development #1729

merged 12 commits into from
Aug 24, 2022

Conversation

nikhiljohn10
Copy link
Contributor

@nikhiljohn10 nikhiljohn10 commented Jun 24, 2021

Features

  • Verifies all the dependencies and installs all of them except the node environment.
  • Provide language isolation for fast build and server reload. The build time is decreased by 90%.
  • Compatible with all languages found inside the LANGS.md file.
  • The exit command is available for restoring the LANGS.md file after the development for deployment or commit.

Make

Usage: make command [LANG=<language_short_code>]

    LANG: Language shortcodes are found in LANGS.md. Default is 'en'(English).
           ( Refer LANGS.md for shortcodes of Languages available. )

Commands:
  help      - Display make command list.
  dev       - Setup the project and start the development server with debugging enabled.
  check     - Check for the root directory for various dependencies.
  setup     - Setup the temporary language and install node dependencies for the development.
  build     - Build the honkit project.
  build-dev - Build the honkit project with debug log.
  serve     - Start honkit server locally for development.
  pdf       - Generate the PDF version of DjangoGirls tutorial.
  epub      - Generate the EPUB version of DjangoGirls tutorial.
  mobi      - Generate the MOBI version of DjangoGirls tutorial.
  mode      - Shows the development mode status.
  exit      - Exit development mode.

Example:

$ make dev LANG=es

The above command will start the development server using the language Español.
'LANG' argument is only required the first time until the exit command is executed.

#1728 Completed

Added Makefile
Added .gitignore line for LANGS.md.bak
@nikhiljohn10 nikhiljohn10 requested a review from a team as a code owner June 24, 2021 19:12
Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I do wonder why you bother with a LANGS.md.bak file. The original is in git so you can revert it.

Another thing to consider is changing the path to LANGS.md. https://honkit.netlify.app/config.html says there's structure.languages. However, other than changing book.json I'm not sure you can easily pass an override to honkit serve.

@nikhiljohn10
Copy link
Contributor Author

nikhiljohn10 commented Jun 25, 2021

@ekohl Regarding LANGS.md.bak, it is used as a marker for detecting development mode. If this file exist, this means few things -> language is isolated, make check is success and server is ready to start.

The whole idea behind this script when I begun making it was based on one thought "Why am I waiting for all the languages to build each time I run a build or serve command, while I only dealing with english?"

Using this methods, the build time is decreased by 90%. Without using the script, it take 90s-100s. WIth this script, it takes only 7s-8s. Which means that I got around 12 times faster in my development process (ideal case). This is my philosphy.

I have checked the structure.languages variable. It would be much more complicated than this one. Chances for making error inside the file is so much higher. I have been testing this script in WSL, MacOS and Ubuntu. Everything works fine now. I have added few more commands on the way. I'll post it as command before pushing it to the PR.

@nikhiljohn10
Copy link
Contributor Author

Considering all previous converstion, I have made some tweaking is the whole structure and many targets. Not fully tested.

New Commands Added

  • dev - Initialise and start the development server with debugging enabled. ( Previously init )
  • build-dev - Build the honkit project with debug log.
  • pdf - Generate PDF version of DjangoGirls tutorial.
  • epub - Generate EPUB version of DjangoGirls tutorial.
  • mobi - Generate MOBI version of DjangoGirls tutorial.
  • mode - Shows the development mode status.
  • exit - Reset the project and exit development mode. ( Previously reset )

### New Commands Added

- dev - Initialise and start the development server with debugging enabled. ( Previously init )
 -  build-dev - Build the honkit project with debug log.
 -  pdf - Generate PDF version of DjangoGirls tutorial.
 - epub - Generate EPUB version of DjangoGirls tutorial.
 - mobi - Generate MOBI version of DjangoGirls tutorial.
 - mode - Shows the development mode status.
 - exit - Reset the project and exit development mode. ( Previously reset )
Added Makefile
Added .gitignore line for LANGS.md.bak
@nikhiljohn10
Copy link
Contributor Author

@ekohl I have squashed the commits and pushed it. Let me know you thoughts.

Copy link
Collaborator

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Lets take the scenario where npm modules are already installed. npm will have to run again before start serving when make serve is ran. But it is possible since it live reload server. Personally, I dont prefer this method incase I have network problem and my local server will not running. This is waste of time. But if your method is more acceptable generally, i can change that. Let me know your thoughts on my point of view.

I generally agree with that, so another option can be to make the node_modules target fail with a message "you need to run npx install. Also note that I think should be a regular target, not a PHONY. That way, if the directory exists, make will be happy and not run anything.

@nikhiljohn10
Copy link
Contributor Author

I generally agree with that, so another option can be to make the node_modules target fail with a message "you need to run npx install. Also note that I think should be a regular target, not a PHONY. That way, if the directory exists, make will be happy and not run anything.

I'll try that out and get back to you. Thanks for the reply.

@nikhiljohn10
Copy link
Contributor Author

Lets take the scenario where npm modules are already installed. npm will have to run again before start serving when make serve is ran. But it is possible since it live reload server. Personally, I dont prefer this method incase I have network problem and my local server will not running. This is waste of time. But if your method is more acceptable generally, i can change that. Let me know your thoughts on my point of view.

I generally agree with that, so another option can be to make the node_modules target fail with a message "you need to run npx install. Also note that I think should be a regular target, not a PHONY. That way, if the directory exists, make will be happy and not run anything.

@ekohl It is fixed in c01634f

@nikhiljohn10 nikhiljohn10 requested a review from das-g August 20, 2022 11:14
@nikhiljohn10
Copy link
Contributor Author

@das-g Anymore changes required?

@das-g
Copy link
Member

das-g commented Aug 24, 2022

@das-g Anymore changes required?

Sorry, I don't have time for a review right now (maybe mid-next-week). @ekohl can you take another look?

@ekohl
Copy link
Collaborator

ekohl commented Aug 24, 2022

Sorry, also swamped with work.

@das-g
Copy link
Member

das-g commented Aug 24, 2022

As I doubt that this can break anything already existing, I'll merge now. If needed, we can improve upon that later on.

@das-g das-g merged commit 50d6da3 into DjangoGirls:master Aug 24, 2022
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.

3 participants