Release NPM package with git-flow

Having an NPM package in an enterprise environment and wanting to release that package using the git-flow model? Then using the node-generate-release can be very helpful.
This blog shows how to execute an integrated git flow release from your NPM package, even if your master and develop branches are protected.

Install plugin

Let’s assume we have all changes in the develop branch and we would like to create a release with all the current changes in develop. With the git-flow release the result will be that all changes will be merged into master and a tag for the release version is created with correct version. Before we can finish the release the correct version in NPM package.json needs to be set. This can all be nicely done with node-generate-release plugin.

Continue reading

PlantUML Pleasantness: Create diagrams from NPM and Typedoc

What if you have created an awesome diagram with PlantUML, and you would like to include that diagram in your documentation?


In this small tutorial we can include a generated PlantUML diagram in typedoc (a way of documenting typescript packages). Note: Graphiz needs to be installed to run this diagram generation.
First install the typedoc plugin:
npm install typedoc –saveDev
Now, create a typedoc.json in the root of your project. This file describes how typedoc should generate the documentation.
{
  “emitDecoratorMetadata”: true,
  “excludeExternals”: true,
  “experimentalDecorators”: true,
  “hideGenerator”: true,
  “ignoreCompilerErrors”: true,
  “includeDeclarations”: false,
  “mode”: “file”,
  “module”: “commonjs”,
  “moduleResolution”: “node”,
  “out”: “./build/docs”,
  “preserveConstEnums”: true,
  “stripInternal”: true,
  “suppressExcessPropertyErrors”: true,
  “suppressImplicitAnyIndexErrors”: true,
  “target”: “ES5”
}
Next install node-plantuml http://ift.tt/1EOlnfx globally. We should install this globally so we can also use the CLI as a NPM script later.
npm install -g node-plantuml
Go ahead and put the following snippet in your package.json
“scripts”: {
     “docs”: “typedoc –options typedoc.json ./src/ && puml generate my-diagram.puml -o build/docs/my-diagram.png”
}
Finally we are able to create typescript documentation with our generated PNG diagram. If we would include the image in our README as follows:
<a href=”./my-diagram.png” target=”_blank”>![Diagram](./my-diagram.png)</a>
and run the following command from the command-line:
npm run docs
Our documentation at ./build/docs our index page shows the README with our generated diagram.