Version txt/json
A node module which generates a txt/json file in your distribution directory which in turn gets deployed to your server and could then be viewed e.g yourdomain.com/version.txt or yourdomain.com/version.json this will then allow you to verify your deployment onto a server.
Prerequisites
- node version >= 8.0.0
Install
npm install hc-version-txt --save
Configuration
In the root of your project add a '.version-txt.json' file and insert the following:
- projectName is required (can be defined in the config or passed in through buildFile function)
- distDirectory is required (can be defined in the config or passed in through buildFile function)
- distFilename is required
- distFiletypes is required (can be the following values ["json", "txt"] || ["json"] || ["txt"]
Gulpfile task
Add the following to your gulpfile.js:
const hcVersionTxt = ; gulp;
Node script
Add the following to your node script
const hcVersionTxt = ; // picks up the projectName from the config file hcVersionTxt; // pass in the projectName as a parameter// pass in the distDirectory as a parameterhcVersionTxt;
Example txt output
Site: hc-digilab
Deployment
Date: 28/05/2018 17:48PM
Branch: develop
Hash: ef13c39
Example json output