Skip to content

Commit

Permalink
Change project structure
Browse files Browse the repository at this point in the history
Renamed directories to use lowecase letters. Some of the renames were
made to have a structure similar to other repositories, eg. dist directory.

* Rename directory Tests → test
* Rename directory Dist → dist
* Rename directory Src → src
* Rename directory Localization → localization
* Move directory Lib → test/lib because its usage is for tests only
* Upgrade test libraries

Closes Knockout-Contrib#488
  • Loading branch information
crissdev committed Jan 20, 2015
1 parent 56b3468 commit b4b1a66
Show file tree
Hide file tree
Showing 62 changed files with 511 additions and 8,406 deletions.
17 changes: 0 additions & 17 deletions Dist/Knockout-Validation.nuspec

This file was deleted.

11 changes: 0 additions & 11 deletions Dist/knockout.validation.min.js

This file was deleted.

1 change: 0 additions & 1 deletion Dist/knockout.validation.min.js.map

This file was deleted.

5,299 changes: 0 additions & 5,299 deletions Lib/knockout-latest.debug.js

This file was deleted.

27 changes: 0 additions & 27 deletions Src/ko.validation.start.frag

This file was deleted.

2,670 changes: 0 additions & 2,670 deletions Tests/Qunit/jquery-2.1.1.intellisense.js

This file was deleted.

8 changes: 3 additions & 5 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
{
"name": "knockout-validation",
"description": "A KnockoutJS Plugin for model and property validation",
"main": "Dist/knockout.validation.js",
"main": "dist/knockout.validation.js",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"Lib",
"Src",
"Scripts",
"Tests",
"src",
"test",
"gruntfile.js"
],
"keywords": [
Expand Down
42 changes: 22 additions & 20 deletions Dist/knockout.validation.js → dist/knockout.validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,28 @@
/*globals require: false, exports: false, define: false, ko: false */

(function (factory) {
// Module systems magic dance.

if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
// CommonJS or Node: hard-coded dependency on "knockout"
factory(require("knockout"), exports);
} else if (typeof define === "function" && define["amd"]) {
// AMD anonymous module with hard-coded dependency on "knockout"
define(["knockout", "exports"], factory);
} else {
// <script> tag: use the global `ko` object, attaching a `mapping` property
factory(ko, ko.validation = {});
}
// Module systems magic dance.

if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
// CommonJS or Node: hard-coded dependency on "knockout"
factory(require("knockout"), exports);
} else if (typeof define === "function" && define["amd"]) {
// AMD anonymous module with hard-coded dependency on "knockout"
define(["knockout", "exports"], factory);
} else {
// <script> tag: use the global `ko` object, attaching a `mapping` property
factory(ko, ko.validation = {});
}
}(function ( ko, exports ) {

if (typeof (ko) === 'undefined') { throw 'Knockout is required, please ensure it is loaded before loading this validation plug-in'; }
if (typeof (ko) === 'undefined') {
throw new Error('Knockout is required, please ensure it is loaded before loading this validation plug-in');
}

// create our namespace object
ko.validation = exports;
// create our namespace object
ko.validation = exports;

var kv = ko.validation,
var kv = ko.validation,
koUtils = ko.utils,
unwrap = koUtils.unwrapObservable,
forEach = koUtils.arrayForEach,
Expand Down Expand Up @@ -781,8 +783,8 @@ function minMaxValidatorFactory(validatorName) {
regex = /^(\d{4})-W(\d{2})$/;
valMatches = val.match(regex);
if (valMatches === null) {
throw "Invalid value for " + validatorName + " attribute for week input. Should look like " +
"'2000-W33' http://www.w3.org/TR/html-markup/input.week.html#input.week.attrs.min";
throw new Error("Invalid value for " + validatorName + " attribute for week input. Should look like " +
"'2000-W33' http://www.w3.org/TR/html-markup/input.week.html#input.week.attrs.min");
}
comparisonValueMatches = comparisonValue.match(regex);
// If no regex matches were found, validation fails
Expand All @@ -805,8 +807,8 @@ function minMaxValidatorFactory(validatorName) {
regex = /^(\d{4})-(\d{2})$/;
valMatches = val.match(regex);
if (valMatches === null) {
throw "Invalid value for " + validatorName + " attribute for month input. Should look like " +
"'2000-03' http://www.w3.org/TR/html-markup/input.month.html#input.month.attrs.min";
throw new Error("Invalid value for " + validatorName + " attribute for month input. Should look like " +
"'2000-03' http://www.w3.org/TR/html-markup/input.month.html#input.month.attrs.min");
}
comparisonValueMatches = comparisonValue.match(regex);
// If no regex matches were found, validation fails
Expand Down
11 changes: 11 additions & 0 deletions dist/knockout.validation.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/knockout.validation.min.js.map

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function (grunt) {
options: {
separator: ";",
banner: "<%= meta.banner %>",
process: function (src, filepath) {
process: function (src) {
return src
.replace(/ko\.validation\./g, 'kv.')
.replace(/ko\.utils\.arrayForEach/g, 'forEach')
Expand All @@ -30,18 +30,18 @@ module.exports = function (grunt) {
dist: {
src: [
"<%= meta.banner %>",
"Src/ko.validation.start.frag",
"Src/configuration.js",
"Src/utils.js",
"Src/api.js",
"Src/rules.js",
"Src/bindingHandlers.js",
"Src/extenders.js",
"Src/localization.js",
"Src/ko.extensions.js",
"Src/ko.validation.end.frag"
"src/ko.validation.start.frag",
"src/configuration.js",
"src/utils.js",
"src/api.js",
"src/rules.js",
"src/bindingHandlers.js",
"src/extenders.js",
"src/localization.js",
"src/ko.extensions.js",
"src/ko.validation.end.frag"
],
dest: "Dist/<%= pkg.name %>.js"
dest: "dist/<%= pkg.name %>.js"
}
},
uglify: {
Expand All @@ -52,23 +52,23 @@ module.exports = function (grunt) {
},
dist: {
files: {
"Dist/<%= pkg.name %>.min.js": ["<%= concat.dist.dest %>"]
"dist/<%= pkg.name %>.min.js": ["<%= concat.dist.dest %>"]
}
}
},
qunit: {
files: ["Tests/test-runner.htm"]
files: ["test/test-runner.htm"]
},
jshint: {
files: ["gruntfile.js", "Src/**/*.js", "Tests/*.js", "Localization/*.js"],
files: ["gruntfile.js", "src/**/*.js", "test/*.js", "localization/*.js"],
options: {
jshintrc: ".jshintrc",
reporter: require('jshint-stylish')
}
},
watch: {
clear: {
files: ["Src/**/*.js", "Tests/*.js"],
files: ["src/**/*.js", "test/*.js"],
tasks: ["clear", "test"]
}
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
"name": "knockout.validation",
"version": "2.0.0-pre.3",
"description": "A KnockoutJS Plugin for model and property validation",
"main": "Dist/knockout.validation.js",
"files": ["Dist/knockout.validation.js"],
"dependencies": {},
"main": "dist/knockout.validation.js",
"files": ["dist/knockout.validation.js"],
"dependencies": {
"knockout": ">=2.3.0"
},
"devDependencies": {
"grunt": "~0.4.5",
"grunt-cli": "~0.1.13",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions src/ko.validation.start.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*globals require: false, exports: false, define: false, ko: false */

(function (factory) {
// Module systems magic dance.

if (typeof require === "function" && typeof exports === "object" && typeof module === "object") {
// CommonJS or Node: hard-coded dependency on "knockout"
factory(require("knockout"), exports);
} else if (typeof define === "function" && define["amd"]) {
// AMD anonymous module with hard-coded dependency on "knockout"
define(["knockout", "exports"], factory);
} else {
// <script> tag: use the global `ko` object, attaching a `mapping` property
factory(ko, ko.validation = {});
}
}(function ( ko, exports ) {

if (typeof (ko) === 'undefined') {
throw new Error('Knockout is required, please ensure it is loaded before loading this validation plug-in');
}

// create our namespace object
ko.validation = exports;

var kv = ko.validation,
koUtils = ko.utils,
unwrap = koUtils.unwrapObservable,
forEach = koUtils.arrayForEach,
extend = koUtils.extend;
File renamed without changes.
8 changes: 4 additions & 4 deletions Src/rules.js → src/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function minMaxValidatorFactory(validatorName) {
regex = /^(\d{4})-W(\d{2})$/;
valMatches = val.match(regex);
if (valMatches === null) {
throw "Invalid value for " + validatorName + " attribute for week input. Should look like " +
"'2000-W33' http://www.w3.org/TR/html-markup/input.week.html#input.week.attrs.min";
throw new Error("Invalid value for " + validatorName + " attribute for week input. Should look like " +
"'2000-W33' http://www.w3.org/TR/html-markup/input.week.html#input.week.attrs.min");
}
comparisonValueMatches = comparisonValue.match(regex);
// If no regex matches were found, validation fails
Expand All @@ -102,8 +102,8 @@ function minMaxValidatorFactory(validatorName) {
regex = /^(\d{4})-(\d{2})$/;
valMatches = val.match(regex);
if (valMatches === null) {
throw "Invalid value for " + validatorName + " attribute for month input. Should look like " +
"'2000-03' http://www.w3.org/TR/html-markup/input.month.html#input.month.attrs.min";
throw new Error("Invalid value for " + validatorName + " attribute for month input. Should look like " +
"'2000-03' http://www.w3.org/TR/html-markup/input.month.html#input.month.attrs.min");
}
comparisonValueMatches = comparisonValue.match(regex);
// If no regex matches were found, validation fails
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b4b1a66

Please sign in to comment.