|
@@ -12,10 +12,12 @@ module.exports = function (grunt) {
|
|
|
function createUglifyConfig(path) {
|
|
function createUglifyConfig(path) {
|
|
|
function stripModuleLoaders(src, dst) {
|
|
function stripModuleLoaders(src, dst) {
|
|
|
var srcFile = grunt.file.read(src);
|
|
var srcFile = grunt.file.read(src);
|
|
|
- srcFile = srcFile.replace(new RegExp("\\(function\\s?\\(factory\\)[\\s\\S]*\\(function\\s?\\(\\$"), "(function ($");
|
|
|
|
|
- if (src.indexOf("extensions") === -1 && src.indexOf("jquery.inputmask") === -1) {
|
|
|
|
|
- srcFile = srcFile.replace(new RegExp("\\}\\)\\);[\\s]*$"), "})(jQuery);");
|
|
|
|
|
- } else srcFile = srcFile.replace(new RegExp("\\}\\)\\);[\\s]*$"), "})(jQuery, Inputmask);");
|
|
|
|
|
|
|
+ if (src.indexOf("inputmask.config") === -1) {
|
|
|
|
|
+ srcFile = srcFile.replace(new RegExp("\\(function\\s?\\(factory\\)[\\s\\S]*\\(function\\s?\\(\\$"), "(function ($");
|
|
|
|
|
+ if (src.indexOf("extensions") === -1 && src.indexOf("jquery.inputmask") === -1) {
|
|
|
|
|
+ srcFile = srcFile.replace(new RegExp("\\}\\)\\);[\\s]*$"), "})(jQuery);");
|
|
|
|
|
+ } else srcFile = srcFile.replace(new RegExp("\\}\\)\\);[\\s]*$"), "})(jQuery, Inputmask);");
|
|
|
|
|
+ }
|
|
|
grunt.file.write(dst, srcFile);
|
|
grunt.file.write(dst, srcFile);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -47,6 +49,7 @@ module.exports = function (grunt) {
|
|
|
|
|
|
|
|
stripModuleLoaders("js/" + dstFile, "build/" + dstFile);
|
|
stripModuleLoaders("js/" + dstFile, "build/" + dstFile);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
srcFiles = grunt.file.expand("build/*.extensions.js");
|
|
srcFiles = grunt.file.expand("build/*.extensions.js");
|
|
|
srcFiles.splice(0, 0, "build/jquery.inputmask.js");
|
|
srcFiles.splice(0, 0, "build/jquery.inputmask.js");
|
|
|
srcFiles.splice(0, 0, "build/inputmask.js");
|
|
srcFiles.splice(0, 0, "build/inputmask.js");
|
|
@@ -66,7 +69,7 @@ module.exports = function (grunt) {
|
|
|
src: srcFiles,
|
|
src: srcFiles,
|
|
|
options: {
|
|
options: {
|
|
|
banner: createBanner("jquery.inputmask.bundle.js"),
|
|
banner: createBanner("jquery.inputmask.bundle.js"),
|
|
|
- preserveComments: "some",
|
|
|
|
|
|
|
+ preserveComments: false,
|
|
|
ASCIIOnly: true
|
|
ASCIIOnly: true
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -74,7 +77,7 @@ module.exports = function (grunt) {
|
|
|
return uglifyConfig;
|
|
return uglifyConfig;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Project configuration.
|
|
|
|
|
|
|
+// Project configuration.
|
|
|
grunt.initConfig({
|
|
grunt.initConfig({
|
|
|
pkg: grunt.file.readJSON("package.json"),
|
|
pkg: grunt.file.readJSON("package.json"),
|
|
|
uglify: createUglifyConfig("js"),
|
|
uglify: createUglifyConfig("js"),
|
|
@@ -142,7 +145,7 @@ module.exports = function (grunt) {
|
|
|
tasks: {
|
|
tasks: {
|
|
|
options: {
|
|
options: {
|
|
|
filter: 'exclude',
|
|
filter: 'exclude',
|
|
|
- tasks: ['availabletasks', 'default'],
|
|
|
|
|
|
|
+ tasks: ['availabletasks', 'default', 'updateDistConfig'],
|
|
|
showTasks: ['user']
|
|
showTasks: ['user']
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -158,14 +161,23 @@ module.exports = function (grunt) {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // Load the plugin that provides the tasks.
|
|
|
|
|
|
|
+// Load the plugin that provides the tasks.
|
|
|
require('load-grunt-tasks')(grunt);
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
|
|
|
|
- grunt.registerTask('publish:patch', ['clean', 'bump:patch', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
|
|
|
|
|
- grunt.registerTask('publish:minor', ['clean', 'bump:minor', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
|
|
|
|
|
- grunt.registerTask('publish:major', ['clean', 'bump:major', 'uglify', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
|
|
|
|
|
|
|
+ grunt.registerTask('publish:patch', ['clean', 'bump:patch', 'uglify', 'updateDistLoader', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
|
|
|
|
|
+ grunt.registerTask('publish:minor', ['clean', 'bump:minor', 'uglify', 'updateDistLoader', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
|
|
|
|
|
+ grunt.registerTask('publish:major', ['clean', 'bump:major', 'uglify', 'updateDistLoader', 'shell:gitcommitchanges', 'release', 'nugetpack', 'nugetpush']);
|
|
|
grunt.registerTask('validate', ['eslint', 'browserify', 'karma']);
|
|
grunt.registerTask('validate', ['eslint', 'browserify', 'karma']);
|
|
|
- grunt.registerTask('build', ['bump:prerelease', 'clean', 'uglify']);
|
|
|
|
|
|
|
+ grunt.registerTask('build', ['bump:prerelease', 'clean', 'uglify', 'updateDistLoader']);
|
|
|
grunt.registerTask('default', ["availabletasks"]);
|
|
grunt.registerTask('default', ["availabletasks"]);
|
|
|
-
|
|
|
|
|
|
|
+ grunt.registerTask('updateDistLoader', "Update the inputmask.loader in the dist folder", function () {
|
|
|
|
|
+ var configjs = grunt.file.read("dist/inputmask/inputmask.loader.js");
|
|
|
|
|
+ configjs = configjs.replace(/\/js\//, "/dist/inputmask/");
|
|
|
|
|
+ grunt.file.write("dist/inputmask/inputmask.loader.js", configjs);
|
|
|
|
|
+ console.log("dist/inputmask.loader.js updated");
|
|
|
|
|
+ var configjs = grunt.file.read("dist/min/inputmask/inputmask.loader.min.js");
|
|
|
|
|
+ configjs = configjs.replace(/\/js\//, "/dist/min/inputmask/");
|
|
|
|
|
+ grunt.file.write("dist/min/inputmask/inputmask.loader.min.js", configjs);
|
|
|
|
|
+ console.log("dist/min/inputmask/inputmask.loader.js updated");
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|