Skip to content

Commit

Permalink
rajout du plugin webpack 'replace-bundle' pour remplacer les __GPVERS…
Browse files Browse the repository at this point in the history
…ION__ par la version du package

(par ex. pour le parametre gp-ol-ext dans les urls des requetes WMTS)
  • Loading branch information
lboulanger committed Aug 9, 2018
1 parent 1925281 commit abc2859
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"mocha-webpack": "^1.1.0",
"nyc": "^12.0.2",
"path": "^0.12.7",
"replace-bundle-webpack-plugin": "^1.0.0",
"requirejs": "^2.3.5",
"speed-measure-webpack-plugin": "^1.2.2",
"string-template": "^1.0.0",
Expand Down
20 changes: 20 additions & 0 deletions webpack.config.itowns.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var DefineWebpackPlugin = webpack.DefinePlugin;
var ExtractTextWebPackPlugin = require("extract-text-webpack-plugin");
var BannerWebPackPlugin = webpack.BannerPlugin;
var UglifyJsWebPackPlugin = webpack.optimize.UglifyJsPlugin;
var ReplaceWebpackPlugin = require("replace-bundle-webpack-plugin");
var JsDocWebPackPlugin = require("jsdoc-webpack-plugin");
var HandlebarsPlugin = require("./scripts/webpackPlugins/handlebars-plugin");
var HandlebarsLayoutPlugin = require("handlebars-layouts");
Expand Down Expand Up @@ -132,6 +133,25 @@ module.exports = env => {
]
},
plugins : [
/** REPLACEMENT DE VALEURS */
new ReplaceWebpackPlugin(
[
{
partten : /__GPITOWNSEXTVERSION__/g,
/** replacement de la clef __GPVERSION__ par la version du package */
replacement : function () {
return pkg.itownsExtVersion;
}
},
{
partten : /__GPDATE__/g,
/** replacement de la clef __GPDATE__ par la date du build */
replacement : function () {
return date;
}
}
]
),
/** GESTION DU LOGGER */
new DefineWebpackPlugin({
__PRODUCTION__ : JSON.stringify(production)
Expand Down
26 changes: 26 additions & 0 deletions webpack.config.leaflet.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var DefineWebpackPlugin = webpack.DefinePlugin;
var ExtractTextWebPackPlugin = require("extract-text-webpack-plugin");
var BannerWebPackPlugin = webpack.BannerPlugin;
var UglifyJsWebPackPlugin = webpack.optimize.UglifyJsPlugin;
var ReplaceWebpackPlugin = require("replace-bundle-webpack-plugin");
var JsDocWebPackPlugin = require("jsdoc-webpack-plugin");
var HandlebarsPlugin = require("./scripts/webpackPlugins/handlebars-plugin");
var HandlebarsLayoutPlugin = require("handlebars-layouts");
Expand Down Expand Up @@ -142,6 +143,31 @@ module.exports = env => {
]
},
plugins : [
/** REPLACEMENT DE VALEURS */
new ReplaceWebpackPlugin(
[
{
partten : /__GPLEAFLETEXTVERSION__/g,
/**
* replacement de la clef __GPVERSION__ par la version du package
* @returns {String} leafletExtVersion
*/
replacement : function () {
return pkg.leafletExtVersion;
}
},
{
partten : /__GPDATE__/g,
/**
* replacement de la clef __GPDATE__ par la date du build
* @returns {String} date
*/
replacement : function () {
return date;
}
}
]
),
/** GESTION DU LOGGER */
new DefineWebpackPlugin({
__PRODUCTION__ : JSON.stringify(production)
Expand Down
27 changes: 27 additions & 0 deletions webpack.config.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var DefineWebpackPlugin = webpack.DefinePlugin;
var ExtractTextWebPackPlugin = require("extract-text-webpack-plugin");
var BannerWebPackPlugin = webpack.BannerPlugin;
var UglifyJsWebPackPlugin = webpack.optimize.UglifyJsPlugin;
var ReplaceWebpackPlugin = require("replace-bundle-webpack-plugin");

// -- performances
var SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
Expand Down Expand Up @@ -133,6 +134,32 @@ module.exports = env => {
]
},
plugins : [
/** REPLACEMENT DE VALEURS */
new ReplaceWebpackPlugin(
[
{
partten : /__GPITOWNSEXTVERSION__/g,
/** replacement de la clef __GPVERSION__ par la version du package */
replacement : function () {
return pkg.itownsExtVersion;
}
},
{
partten : /__GPOLEXTVERSION__/g,
/** replacement de la clef __GPVERSION__ par la version du package */
replacement : function () {
return pkg.olExtVersion;
}
},
{
partten : /__GPDATE__/g,
/** replacement de la clef __GPDATE__ par la date du build */
replacement : function () {
return date;
}
}
]
),
/** GESTION DU LOGGER */
new DefineWebpackPlugin({
__PRODUCTION__ : JSON.stringify(production)
Expand Down
20 changes: 20 additions & 0 deletions webpack.config.openlayers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var DefineWebpackPlugin = webpack.DefinePlugin;
var ExtractTextWebPackPlugin = require("extract-text-webpack-plugin");
var BannerWebPackPlugin = webpack.BannerPlugin;
var UglifyJsWebPackPlugin = webpack.optimize.UglifyJsPlugin;
var ReplaceWebpackPlugin = require("replace-bundle-webpack-plugin");
var JsDocWebPackPlugin = require("jsdoc-webpack-plugin");
var HandlebarsPlugin = require("./scripts/webpackPlugins/handlebars-plugin");
var HandlebarsLayoutPlugin = require("handlebars-layouts");
Expand Down Expand Up @@ -141,6 +142,25 @@ module.exports = env => {
]
},
plugins : [
/** REPLACEMENT DE VALEURS */
new ReplaceWebpackPlugin(
[
{
partten : /__GPOLEXTVERSION__/g,
/** replacement de la clef __GPVERSION__ par la version du package */
replacement : function () {
return pkg.olExtVersion;
}
},
{
partten : /__GPDATE__/g,
/** replacement de la clef __GPDATE__ par la date du build */
replacement : function () {
return date;
}
}
]
),
/** GESTION DU LOGGER */
new DefineWebpackPlugin({
__PRODUCTION__ : JSON.stringify(production)
Expand Down

0 comments on commit abc2859

Please sign in to comment.