top of page

Beautification of a console with npm dependency

  • Writer: khyati sehgal
    khyati sehgal
  • Jul 22, 2014
  • 2 min read

While submitting a paper in one of the conferences I have observed that it’s not just the code which they see while accepting the submission, but also the efforts you have added to show that the code has different elements which makes it unique And I am not talking about the DS, dynamic programming concepts which are by no choice are important and shall be considered while creating a framework.

I will discuss in this post about a console beautification dependency of which can be added to the project in very little time and presents a very beautiful welcome note before the run. This can be a simple and quick add on to your framework, so I thought of adding the same in my project as well.

What have I used?

I have used print-message library to make this happen in my project which provides very simple configuration to integrate the same in the code. This is used for printing out beautiful messages in console.

How to add it?

npm i print-message --save-dev 

Check if it is installed properly by looking in package-json file

"print-message": "^3.0.1"
 

Configurations

There are couple of other variations which you can apply to this configuration but here I will be focusing on what I have done in my current project.

printMessage([" * Welcome to the automation suite of ORBCR * "], {
    border: true, // Enable border
    color: 'green', // Text color
    borderColor: 'blue', // Border color is blue
    borderSymbol: '│', // Symbol that uses for border
    sideSymbol: '│', // Symbol that uses for side separators
    leftTopSymbol: '└', // Symbol for left top corner
    leftBottomSymbol: '┌', // Symbol for left bottom corner
    rightTopSymbol: '┘', // Symbol for right top corner
    rightBottomSymbol: '┐', // Symbol for right bottom corner
    marginTop: 3, // Margin before border is begins
    marginBottom: 3, // Margin after border is end
    paddingTop: 2, // Padding top after border begins
    paddingBottom: 2, // Padding bottom before border ends
    printFn: function (message) {
        // Custom function that accepts generated message as argument and print it
        process.stdout.write(message);
    }
});
 

How does it look like?

By these simple steps you will be able to see the beautiful console execution start message

Thanks and happy sharing!!

Comments


bottom of page