Image for post
Image for post

After another case of the need of making changes in Bash script and battling with its syntax and docs I banged myself: “Enough! Let’s use the power of JavaScript!”. Since the rest of codebase in project using JS, that seemed a good idea.

All the code below will work mostly only in Unix-like OSes as MacOS and Linux.

Requirements to solution

  • lightweight, no deps or minimum
  • easy to write
  • same console output as if using Bash

Investigation

I started from searching inside Node.js API. exec appeared to be not so good choice for several reasons, but spawn seemed promising because of one important feature: ability to inherit stdio and immediately echo all the command output right to the console during command execution when using {stdio: 'inherit'} in options. …


Image for post
Image for post

Disclaimer: that’s not another holy war article about “what’s better?”, that’s an article which draws parallels between Angular 2 and React concepts and should help to quickly start with React if you know Angular 2.

Core differences

Main difference between Angular 2 and React lies in the fact that Angular 2 is a framework, but React is an UI library. I.e. to build common application with React you will need to use other libraries, which will provide:

  • routing (react-router)
  • state management (Redux, MobX .. but you can go without state manager (not really recommended). …

Hi there! If you’re using TypeScript in your JS-workflow you should already know about d.ts files where 3rd-party libraries store public definitions for your IDE and TypeScript compiler could do their job. Today we will talk about how to generate typings for your custom npm library. I write this because not found solution on the internet, hope that will help to someone else too :)

Ok, straight to the business. Hope you already setted up Webpack to work with TypeScript, that article not about it, but you can check config in the end if needed.

Firstly, enable d.ts file emission by ts-compiler in tsconfig.json …

About

Vladimir Tolstikov

Full Stack Web Developer passionate about interesting projects and challenges. http://bobrosoft.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store