Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#Testing, not relevant to end user
test/
.travis.yml
.jshintrc

#Not relevant to npm users
bower.json

#IDE
.idea/
39 changes: 32 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//TODO: During next major version bump change to /dist. Leaving at ./form-validator for backwards
//compatibility
const DIST_DIR = './form-validator';
const MAIN_PLUGIN_FILE = './form-validator/jquery.form-validator.js';
const MAIN_PLUGIN_FILE = './form-validator/jquery.form-validator';
const SRC_DIR = './src';
const MAIN_DIR = '/main/';
const MODULE_DIR = '/modules/';
Expand Down Expand Up @@ -79,7 +79,29 @@ function initializeGruntConfig(grunt, filesToBuild) {
}
},

clean: [DIST_DIR + '/']
clean: [DIST_DIR + '/'],
umd: {
main: {
options: {
src: MAIN_PLUGIN_FILE + '.js',
deps: {
default: ['jQuery'],
amd: [{'jquery': 'jQuery'}],
cjs: [{'jquery': 'jQuery'}]
}
}
},
minified: {
options: {
src: MAIN_PLUGIN_FILE + '.min.js',
deps: {
default: ['$'],
amd: [{'jquery': 'jQuery'}],
cjs: [{'jquery': 'jQuery'}]
}
}
}
}
});
}

Expand All @@ -89,7 +111,7 @@ module.exports = function (grunt) {
concat: {
main:{
src: [SRC_DIR + MAIN_DIR+'core-validators.js'],
dest: MAIN_PLUGIN_FILE
dest: MAIN_PLUGIN_FILE + '.js'
}
}
};
Expand Down Expand Up @@ -140,8 +162,8 @@ module.exports = function (grunt) {
};

// Add main script to uglify
filesToBuild.uglify[MAIN_PLUGIN_FILE] = {
src: MAIN_PLUGIN_FILE,
filesToBuild.uglify[MAIN_PLUGIN_FILE + '.js'] = {
src: MAIN_PLUGIN_FILE + '.js',
expand: true,
extDot: 'last',
ext: '.min.js'
Expand Down Expand Up @@ -183,7 +205,10 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.registerTask("build-production", ["version", "cssmin", "test", "uglify"]);
grunt.registerTask('test', ['concat', 'cssmin','jshint', 'qunit']);
grunt.loadNpmTasks('grunt-umd');

grunt.registerTask("build-production", ["version", "test", "uglify"]);
grunt.registerTask('test', ['concat', 'umd', 'cssmin','jshint', 'qunit']);
grunt.registerTask("default", ["test", "watch"]);
grunt.registerTask("prepublish", ["test", "uglify"]);
};
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"url": "git+https://github.com/victorjonsson/jQuery-Form-Validator.git"
},
"bugs": {
"url": "https://github.com/jquery-boilerplate/jquery-boilerplate/issues"
"url": "https://github.com/victorjonsson/jQuery-Form-Validator/issues"
},
"author": {
"name": "Victor Jonsson",
Expand All @@ -33,6 +33,7 @@
"grunt-contrib-qunit": "^0.7.0",
"grunt-contrib-uglify": "~0.11.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-umd": "~2.3.5",
"jquery": "^2.1.4",
"numeral": "~1.5.3",
"qunitjs": "^1.20.0"
Expand All @@ -41,6 +42,7 @@
"jquery": ">1.8.0"
},
"scripts": {
"prepublish": "grunt prepublish",
"test": "grunt test"
}
}