In this post I’ll cover my workflow of creating env-inject-file, a command line utility for populating config files with environment variable placeholders and my first published npm package.

Version management

My advice is protect your branch, write descriptive commit messages, use branch management.

Branch Protection

To enable branch protection, go to repository Settings -> Branches -> Add Rule.

Protect master branch

Project structure

├── bin
│   └── env-inject-file.js
├── env-inject-file.js
├── package.json
├── .travis.yml
├── .npmignore
└── test
    ├── cmdline.spec.js
    └── program.spec.js

First thing that users see should contain project description, instructions to install and use. Badges in README make it stand out.


Write unit tests. Tests confirm that code is valid and enrich project documentation.


MIT is a good choice for opensource. Choosing an opensource license is easier with


Initialized with npm init, contains project information for npm.


Configuration for excluding files from your package. Check that exclusion works with npm pack.


Configuration for travis continuous integration:

language: node_js
- v10
- v8
- v6
- npm i npm@^6 -g
- npm install
- npm test
email: false

On every build travis will install dependencies, run tests for 3 versions of node, then update Github PR status to pass or fail.


  • Create an account with npm, then authenticate in root project console type:
    npm login
  • After PR merge, you can bump your project version.
    npm version patch|minor|major

    Command will bump version in package.json, create a git commit with <version> message, and git tag v<version>.

  • Push version commit and tag, merge to master
    git push && git push --tags
  • Publish to npm
    npm publish


Often can happen that you accidentally published your library. For packages published less than 72 hours ago, you can use this command:

npm unpublish [email protected] --force

Other reading

You might be interested into publishing to a private github registry.

Categories: Programming

Notify of
Inline Feedbacks
View all comments