webpack-auto-inject-version
Advanced tools
Comparing version 0.0.18 to 0.0.19
module.exports = { | ||
NAME: 'Auto Inject Version', | ||
SHORT: 'AIV' | ||
SHORT: 'AIV', | ||
PATH_PACKAGE: './package.json' | ||
}; |
var chalk = require('chalk'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var config = require('./config'); | ||
'use strict'; | ||
@@ -8,5 +9,4 @@ var WebpackAutoInject = (function () { | ||
this.options = WebpackAutoInject.options; | ||
var packageFile = JSON.parse(fs.readFileSync(path.normalize('./package.json'), 'utf8')); | ||
var packageFile = JSON.parse(fs.readFileSync(path.normalize(config.PATH_PACKAGE), 'utf8')); | ||
this.version = packageFile.version; | ||
console.log('versioooon: ' + this.version); | ||
} | ||
@@ -16,5 +16,9 @@ WebpackAutoInject.prototype.apply = function (compiler) { | ||
if (this.options.injectIntoHtml) { | ||
var comp_1 = new (require('./components/inject-into-html'))(this); | ||
var comp_1 = new (require('./components/auto-inc-version'))(this); | ||
comp_1.apply(); | ||
} | ||
if (this.options.injectIntoHtml) { | ||
var comp_2 = new (require('./components/inject-into-html'))(this); | ||
comp_2.apply(); | ||
} | ||
var comp = new (require('./components/inject-into-any-file'))(this); | ||
@@ -24,3 +28,4 @@ comp.apply(); | ||
WebpackAutoInject.options = { | ||
injectIntoHtml: true | ||
autoIncrease: true, | ||
injectIntoHtml: true, | ||
}; | ||
@@ -27,0 +32,0 @@ return WebpackAutoInject; |
{ | ||
"name": "webpack-auto-inject-version", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Webpack plugin for auto inject version from package.json", | ||
@@ -14,3 +14,6 @@ "main": "dist/main.js", | ||
"typings": "^1.4.0" | ||
}, | ||
"dependencies": { | ||
"semver": "^5.3.0" | ||
} | ||
} |
@@ -1,1 +0,25 @@ | ||
# In development | ||
# In development | ||
# Installation | ||
npm i webpack-auto-inject-version --save-dev | ||
# Usage | ||
Add plugin to your webpack configuration. | ||
Require it by: | ||
var WebpackAutoInject = require('webpack-auto-inject-version'); | ||
And add to plugins array as one of the last items ( further = better ). | ||
plugins: [ | ||
new WebpackAutoInject(options) | ||
] | ||
# Options | ||
NOT SUPPORTED YET! | ||
autoIncrease : boolean, | ||
injectIntoHtml : boolean, | ||
# Auto Increase Version | ||
Option: autoIncrease : true | ||
- run webpack with --release major|minor|patch | ||
DO NOT RUN IT WITH WATCH! |
module.exports = { | ||
NAME : 'Auto Inject Version', | ||
SHORT : 'AIV' | ||
SHORT : 'AIV', | ||
PATH_PACKAGE : './package.json' | ||
} |
@@ -5,2 +5,3 @@ /// <reference path='../typings/index.d.ts' /> | ||
var path = require('path'); | ||
var config = require('./config'); | ||
@@ -16,3 +17,4 @@ 'use strict'; | ||
static options = { | ||
injectIntoHtml : true | ||
autoIncrease : true, | ||
injectIntoHtml : true, | ||
} | ||
@@ -22,5 +24,4 @@ | ||
this.options = WebpackAutoInject.options; | ||
var packageFile = JSON.parse(fs.readFileSync(path.normalize('./package.json'), 'utf8')); | ||
var packageFile = JSON.parse(fs.readFileSync(path.normalize(config.PATH_PACKAGE), 'utf8')); | ||
this.version = packageFile.version; | ||
console.log('versioooon: ' + this.version); | ||
} | ||
@@ -32,2 +33,10 @@ | ||
// Component: auto-inc-version | ||
// if: autoIncrease : true | ||
if(this.options.injectIntoHtml) { | ||
let comp = new (require('./components/auto-inc-version'))(this); | ||
comp.apply(); | ||
} | ||
// Component: Inject-into-html | ||
@@ -34,0 +43,0 @@ // if: injectIntoHtml : true |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
184244
18
3782
25
1
+ Addedsemver@^5.3.0
+ Addedsemver@5.7.2(transitive)