Giter Site home page Giter Site logo

wbc-version's Introduction

wbc-version

a hook into npm's version control to create a app.wbc-version.ts.

It will do the following steps:

  • bump up the version number (f.e. 'patch' increments 0.0.1 -> 0.0.2)
  • start the wbc-version.js script, that will
    • get the new version number
    • get the current branch
    • get the latest commit hash
    • get a new Date() and
    • write them all to the file app.wbc-version.ts in scr/app
  • git add scr/app/app.wbc-version.ts
  • git push
  • git push --tags

src/app/wbc-version.ts file output:

export const appVersion = {
  version: '0.0.69',
  branch: '* master',
  commit: 'de8998f',
  date: 'Thu Feb 01 2018 14:48:56 GMT+0100 (CET)'
};

install

Download wbc-version.js to root of your project. In the projects package.json add:

  [...]
  "scripts": {
    [...]
    "version": "node ./wbc-version.js && git add ./src/app/app.wbc-version.ts",
    "postversion": "git push && git push --tags"
  },

usage

Code & commit as usual. When ready to release a new version, use npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git].

Inside your app, f.e. in app.component.ts you can

import { appVersion } from './app.wbc-version';
console.log(appVersion);

wbc-version's People

Contributors

tobbyte avatar

Watchers

James Cloos avatar Timo Lundelius avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.