Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use npm scripts #42

Merged
merged 5 commits into from
Oct 18, 2015
Merged
Show file tree
Hide file tree
Changes from 4 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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
root = true

[*]
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[tests.js]
indent_size = 4

[*.md]
trim_trailing_whitespace = false
15 changes: 15 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
//"validateIndentation": 2, index.js uses 2, and tests.js uses 4. https://github.com/jscs-dev/node-jscs/issues/1106
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if you want to normalize your indentation. If you do, I'll be happy to give it a whack.

"validateQuoteMarks": "'",
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowQuotedKeysInObjects": true,
"disallowMultipleLineStrings": true,
"disallowMultipleSpaces": true,
"requireLineFeedAtFileEnd": true,
"requireSemicolons": true
}
2 changes: 1 addition & 1 deletion .jshintignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node_modules/**
node_modules/**
9 changes: 4 additions & 5 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"node": true,
"mocha": true,
"strict": true,
"laxcomma": true,
"nomen": false,
"indent": 2
"strict": true,
"laxcomma": true,
"nomen": false,
"indent": 2
}
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License.
*/
;(function(root, factory) {
"use strict";
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
Expand All @@ -17,7 +17,7 @@
root.DeepDiff = factory();
}
}(this, function(undefined) {
"use strict";
'use strict';

var $scope, conflict, conflictResolution = [];
if (typeof global === 'object' && global) {
Expand Down Expand Up @@ -191,7 +191,7 @@
stack.length = stack.length - 1;
}
} else if (lhs !== rhs) {
if (!(ltype === "number" && isNaN(lhs) && isNaN(rhs))) {
if (!(ltype === 'number' && isNaN(lhs) && isNaN(rhs))) {
changes(new DiffEdit(currentPath, lhs, rhs));
}
}
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@
"devDependencies": {
"deep-equal": "~1.0.0",
"expect.js": "^0.3.1",
"mocha": "^2.2.1"
"jscs": "^1.12.0",
"jshint": "^2.6.3",
"mocha": "^2.2.1",
"uglifyjs": "^2.4.10"
},
"scripts": {
"test": "mocha -R spec"
"uglify": "uglifyjs index.js -o releases/deep-diff-$npm_package_version.min.js -r '$,require,exports,module,window,global' -m --comments '/^!/'",
"pretest": "jscs index.js test/ && jshint index.js test/",
"test": "mocha"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spec is default reporter

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep; I noticed that change a while ago - wasn't when this thing was born.

}
}
4 changes: 4 additions & 0 deletions test/.jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../.jshintrc",
"mocha": true
}
38 changes: 19 additions & 19 deletions test/tests.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*global it: false, describe: false, DeepDiffConflict: false*/
/*global DeepDiffConflict: false*/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Covered by mocha option in .jshintrc

'use strict';

if (typeof require === 'function') {
Expand Down Expand Up @@ -360,35 +360,35 @@ describe('deep-diff', function() {

describe('regression test for bug #10, ', function() {
var lhs = {
"id": "Release",
"phases": [{
"id": "Phase1",
"tasks": [{
"id": "Task1"
id: 'Release',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only place you quote keys in objects, so I removed it, and added a JSCS rule for it.
Also " vs '

phases: [{
id: 'Phase1',
tasks: [{
id: 'Task1'
}, {
"id": "Task2"
id: 'Task2'
}]
}, {
"id": "Phase2",
"tasks": [{
"id": "Task3"
id: 'Phase2',
tasks: [{
id: 'Task3'
}]
}]
};
var rhs = {
"id": "Release",
"phases": [{
id: 'Release',
phases: [{
// E: Phase1 -> Phase2
"id": "Phase2",
"tasks": [{
"id": "Task3"
id: 'Phase2',
tasks: [{
id: 'Task3'
}]
}, {
"id": "Phase1",
"tasks": [{
"id": "Task1"
id: 'Phase1',
tasks: [{
id: 'Task1'
}, {
"id": "Task2"
id: 'Task2'
}]
}]
};
Expand Down