webpack-auto-inject-version
Advanced tools
Comparing version 0.0.11 to 0.0.12
var chalk = require('chalk'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
function ProjectVersionInject(options) { } | ||
var getVersion = function () { | ||
var package = JSON.parse(fs.readFileSync(path.normalize('./package.json'), 'utf8')); | ||
return package.version; | ||
}; | ||
ProjectVersionInject.prototype.apply = function (compiler) { | ||
compiler.plugin('emit', function (compilation, cb) { | ||
}); | ||
}; | ||
module.exports = ProjectVersionInject; | ||
var WebpackAutoInject = (function () { | ||
function WebpackAutoInject(options) { | ||
this.options = WebpackAutoInject.options; | ||
var packageFile = JSON.parse(fs.readFileSync(path.normalize('./package.json'), 'utf8')); | ||
this.version = packageFile.version; | ||
} | ||
WebpackAutoInject.prototype.apply = function (compiler) { | ||
this.compiler = compiler; | ||
if (this.options.injectIntoHtml) { | ||
var comp = new (require('./components/inject-into-html'))(this); | ||
comp.apply(); | ||
} | ||
}; | ||
WebpackAutoInject.options = { | ||
injectIntoHtml: true | ||
}; | ||
return WebpackAutoInject; | ||
}()); | ||
module.exports = WebpackAutoInject; |
{ | ||
"name": "webpack-auto-inject-version", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Webpack plugin for auto inject version from package.json", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -8,15 +8,27 @@ /// <reference path='../typings/index.d.ts' /> | ||
constructor(options) { | ||
private options; | ||
private compiler; | ||
private version; | ||
static options = { | ||
injectIntoHtml : true | ||
} | ||
static getVersion = function(){ | ||
var package = JSON.parse(fs.readFileSync(path.normalize('./package.json'), 'utf8')); | ||
return package.version; | ||
constructor(options) { | ||
this.options = WebpackAutoInject.options; | ||
var packageFile = JSON.parse(fs.readFileSync(path.normalize('./package.json'), 'utf8')); | ||
this.version = packageFile.version; | ||
} | ||
protected apply(compiler) { | ||
compiler.plugin('emit', function(compilation, cb) { | ||
}); | ||
this.compiler = compiler; | ||
// Component: Inject-into-html | ||
// if: injectIntoHtml : true | ||
if(this.options.injectIntoHtml) { | ||
let comp = new (require('./components/inject-into-html'))(this); | ||
comp.apply(); | ||
} | ||
} | ||
@@ -23,0 +35,0 @@ } |
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
3928
7
105