Skip to content

Commit 25be3ea

Browse files
author
Phillip Clark
committed
Merge pull request #42 from SimenB/use-npm-scripts
Use npm scripts; good all-around cleanup.
2 parents 1f7a0c1 + 6da6588 commit 25be3ea

8 files changed

+71
-30
lines changed

.editorconfig

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
root = true
2+
3+
[*]
4+
insert_final_newline = true
5+
charset = utf-8
6+
indent_style = space
7+
indent_size = 2
8+
trim_trailing_whitespace = true
9+
10+
[tests.js]
11+
indent_size = 4
12+
13+
[*.md]
14+
trim_trailing_whitespace = false

.jscsrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
//"validateIndentation": 2, index.js uses 2, and tests.js uses 4. https://github.com/jscs-dev/node-jscs/issues/1106
3+
"validateQuoteMarks": "'",
4+
"requireSpacesInFunctionExpression": {
5+
"beforeOpeningCurlyBrace": true
6+
},
7+
"disallowSpacesInFunctionExpression": {
8+
"beforeOpeningRoundBrace": true
9+
},
10+
"disallowQuotedKeysInObjects": true,
11+
"disallowMultipleLineStrings": true,
12+
"disallowMultipleSpaces": true,
13+
"requireLineFeedAtFileEnd": true,
14+
"requireSemicolons": true
15+
}

.jshintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
node_modules/**
1+
node_modules/**

.jshintrc

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"node": true,
3-
"mocha": true,
4-
"strict": true,
5-
"laxcomma": true,
6-
"nomen": false,
7-
"indent": 2
3+
"strict": true,
4+
"laxcomma": true,
5+
"nomen": false,
6+
"indent": 2
87
}

index.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License.
44
*/
55
;(function(root, factory) {
6-
"use strict";
6+
'use strict';
77
if (typeof define === 'function' && define.amd) {
88
// AMD. Register as an anonymous module.
99
define([], factory);
@@ -17,7 +17,7 @@
1717
root.DeepDiff = factory();
1818
}
1919
}(this, function(undefined) {
20-
"use strict";
20+
'use strict';
2121

2222
var $scope, conflict, conflictResolution = [];
2323
if (typeof global === 'object' && global) {
@@ -191,7 +191,7 @@
191191
stack.length = stack.length - 1;
192192
}
193193
} else if (lhs !== rhs) {
194-
if (!(ltype === "number" && isNaN(lhs) && isNaN(rhs))) {
194+
if (!(ltype === 'number' && isNaN(lhs) && isNaN(rhs))) {
195195
changes(new DiffEdit(currentPath, lhs, rhs));
196196
}
197197
}

package.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"sonstone",
1616
"ravishivt"
1717
],
18+
"files": [
19+
"index.js",
20+
"releases/"
21+
],
1822
"repository": {
1923
"type": "git",
2024
"url": "git://github.com/flitbit/diff.git"
@@ -28,9 +32,14 @@
2832
"devDependencies": {
2933
"deep-equal": "~1.0.0",
3034
"expect.js": "^0.3.1",
31-
"mocha": "^2.2.1"
35+
"jscs": "^1.12.0",
36+
"jshint": "^2.6.3",
37+
"mocha": "^2.2.1",
38+
"uglifyjs": "^2.4.10"
3239
},
3340
"scripts": {
34-
"test": "mocha -R spec"
41+
"uglify": "uglifyjs index.js -o releases/deep-diff-$npm_package_version.min.js -r '$,require,exports,module,window,global' -m --comments '/^!/'",
42+
"pretest": "jscs index.js test/ && jshint index.js test/",
43+
"test": "mocha"
3544
}
3645
}

test/.jshintrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "../.jshintrc",
3+
"mocha": true
4+
}

test/tests.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*global it: false, describe: false, DeepDiffConflict: false*/
1+
/*global DeepDiffConflict: false*/
22
'use strict';
33

44
if (typeof require === 'function') {
@@ -360,35 +360,35 @@ describe('deep-diff', function() {
360360

361361
describe('regression test for bug #10, ', function() {
362362
var lhs = {
363-
"id": "Release",
364-
"phases": [{
365-
"id": "Phase1",
366-
"tasks": [{
367-
"id": "Task1"
363+
id: 'Release',
364+
phases: [{
365+
id: 'Phase1',
366+
tasks: [{
367+
id: 'Task1'
368368
}, {
369-
"id": "Task2"
369+
id: 'Task2'
370370
}]
371371
}, {
372-
"id": "Phase2",
373-
"tasks": [{
374-
"id": "Task3"
372+
id: 'Phase2',
373+
tasks: [{
374+
id: 'Task3'
375375
}]
376376
}]
377377
};
378378
var rhs = {
379-
"id": "Release",
380-
"phases": [{
379+
id: 'Release',
380+
phases: [{
381381
// E: Phase1 -> Phase2
382-
"id": "Phase2",
383-
"tasks": [{
384-
"id": "Task3"
382+
id: 'Phase2',
383+
tasks: [{
384+
id: 'Task3'
385385
}]
386386
}, {
387-
"id": "Phase1",
388-
"tasks": [{
389-
"id": "Task1"
387+
id: 'Phase1',
388+
tasks: [{
389+
id: 'Task1'
390390
}, {
391-
"id": "Task2"
391+
id: 'Task2'
392392
}]
393393
}]
394394
};

0 commit comments

Comments
 (0)