tutorial
tutorial copied to clipboard
[Improvement] Makefile for Development
Features
- [x] Verifies all the dependencies and installs all of them except the node environment.
- [x] Provide language isolation for fast build and server reload. The build time is decreased by 90%.
- [x] Compatible with all languages found inside the
LANGS.mdfile. - [x] The
exitcommand 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
@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.
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)
@ekohl I have squashed the commits and pushed it. Let me know you thoughts.
I generally agree with that, so another option can be to make the
node_modulestarget fail with a message "you need to runnpx install. Also note that I think should be a regular target, not aPHONY. 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.
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_modulestarget fail with a message "you need to runnpx install. Also note that I think should be a regular target, not aPHONY. That way, if the directory exists, make will be happy and not run anything.
@ekohl It is fixed in c01634f
@das-g Anymore changes required?
@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?
Sorry, also swamped with work.
As I doubt that this can break anything already existing, I'll merge now. If needed, we can improve upon that later on.