📜 ⬆️ ⬇️

easymake - “almost” regular task-runner for building, testing and other tasks for node.js

Today, there are many task-runners, boilerplates for a quick start of development, but often even in this case, you have to refine, write, and understand a bunch of configuration files, and the root of the project often looks like a bunch of various configs. Working in different projects, even within the same company, often in each project everything is arranged differently and before you start working with it, you first need to read a handful of, often weighty, configs to figure out where things are happening and how and where they grow from.

And you just want to - take and start writing code right away . And just write tests, easy to run them, see the coverage. And also get the final build.


If you want the same thing, you may be interested in learning about easymake.


In this article, I will describe the main problems that easymake can help you solve.


1. Starting speed. Just take it and start working.


easymake for simplicity can be compared with a capsule coffee maker. By itself, easymake is of no benefit to the end user, presets are all valuable, and easymake only ensures their implementation.


easymake is an executable file with a command line parameter analyzer, task orchestrator and API (which is used when performing tasks and working with config files).


At startup, the passed parameters are analyzed and the appropriate actions are performed, usually it is either copying the configuration files to the project or performing the task.


A preset contains a set of tasks and a set of configuration files, as well as an enumeration of the packages that are required to ensure its operation.


Thus, to start developing with easymake you usually need to complete 5 simple steps:


  1. npm init
  2. add the required preset to devDependencies (easymake is specified in dependencies to the preset, there is no need to explicitly prescribe it)
  3. in package.json in the config.easymake.preset section specify the name of the used preset from item 2.
  4. if there is a task in the preset to create the initial structure of the project - execute it (for example, easymake --run create-folders )
  5. Run the build build task for development (for example, easymake --run bundle )

BEGIN WORKING!


Want to test and get coverage? - no problem: easymake --run test-units (command for default-preset)


We want to get a build for production - no problem: easymake --run bundle --production (command for default-preset)


With easymake, only 5 simple steps separate you from the idea to the beginning of implementation.

2. Order in work. We follow accepted approaches and best practices.


I have now opened 2 large projects in which I took part, in one - 12 configuration and auxiliary files: startup scripts, builds, publishing, Gulp, Babel, EsLint, Webpack, Karma, etc. scripts. Scripts use environment variables, end commands on The project build (npm run bundle) may be off screen. In the other - 11, the tasks are almost the same, the implementation is completely different. Projects are launched in absolutely different ways.


Now imagine that you have such 2 projects, not 22. Someone collects with the help of Gulp, someone with the help of Grunt, someone tests with the help of Jasmine, someone with the help of Mocha.


How to control this all? Boilerplate? Well, you wrote it, distributed it, everyone capped it, began to develop the project, as time goes on - configs swell up. You decide to add some rule to the linter, change the build, or the testing framework - how to synchronize it with existing projects? 22 times go into each project and update the configs with your hands and then watch if it works and if it’s broken.


With the approach based on easymake presets, you make a preset (or use an existing one) with typical tasks, with standard rules, configurations and utilities. Everyone who starts a project takes a preset and just starts working in the environment and with those practices that are accepted.


Have you found what can be improved? What other actions can be automated? One of the projects redefined the configuration of the preset and it became better? - Update preset. Further, in each project, the participants will execute only one command - npm update - and your improvements are already with them.


One preset - solving hundreds of problems for many projects. Decided one hundred and first? - 1 team - and your solution is used by everyone.

3. Clean workplace. I don't want this copy-paste anymore


How does a project start? Of course with the arrangement of the infrastructure with which you will collect, test, run and perform other related activities. Do you write these configs from scratch every time? Ctrl-C + Ctrl-V (or F5 for fans :)) not tired? And when you open the project and in the root of the pieces 5 different. Rc?


If you have a suitable preset, all configs are in it, no garbage. If you need to redefine something, it can of course be made in the form of a change to the desired configuration, and if this change is useful for the whole preset, it can be easily made into the preset.


No more copying configs from project to project, no zoo settings. We keep the project clean and tidy.

Once again about the use of easymake:


  1. We start work in 5 easy steps.
  2. We use one preset - some approaches and development methods, we improve them quickly and without problems.
  3. We do not copy-paste configs and generally it would be better not to see them in the project.

easymake is just an "almost" regular task-runner


but perhaps it will help you change your development processes for the better and spend more time on what is really important, and of course, get more pleasure from the development process.

In conclusion, I note that the project was created relatively recently and is in the development stage, but currently it is already working stably and actively used personally. Easymake itself is unlikely to change much already, but presets are a living thing.

Currently there are 2 presets: for library development and for developing a web application on React . If you have a desire to develop your own preset or improve an existing one, I will be glad.


easymake is available in npm and github.


Links to existing presets: https://github.com/madcode-tech/easymake/wiki


')

Source: https://habr.com/ru/post/324286/


All Articles