Skip to content

Commit

Permalink
Merge branch 'deps'
Browse files Browse the repository at this point in the history
* deps:
  Replace underscore with specific lodash libraries
  Update seq and passerror
  Update all devDependencies
  Pin dependencies
  • Loading branch information
Munter committed Oct 25, 2015
2 parents f7e6bad + f90fe7f commit 826f3e3
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 22 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
save-exact=true
4 changes: 2 additions & 2 deletions lib/packers/horizontal.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var _ = require('underscore');
var extend = require('lodash.assign');

exports.pack = function (imageInfos) {
var previousRightPadding = 0,
Expand All @@ -8,7 +8,7 @@ exports.pack = function (imageInfos) {
imageInfos: []
};
imageInfos.forEach(function (existingImageInfo) {
var imageInfo = _.extend({}, existingImageInfo);
var imageInfo = extend({}, existingImageInfo);
packingData.width += Math.max(previousRightPadding, imageInfo.padding[3]);
imageInfo.x = packingData.width;
imageInfo.y = 0;
Expand Down
6 changes: 3 additions & 3 deletions lib/packers/jimScott.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* the passed rectangles by dividing the partitions into filled and empty.
*/

var _ = require('underscore');
var extend = require('lodash.assign');

function findCoords(node, width, height) {
// If we are not at a leaf then go deeper
Expand Down Expand Up @@ -81,7 +81,7 @@ exports.pack = function (imageInfos, config) {
};

imageInfos.forEach(function (existingImageInfo) {
var imageInfo = _.extend({}, existingImageInfo);
var imageInfo = extend({}, existingImageInfo);
if (imageInfo.padding && imageInfo.padding.some(function (v) {return v > 0;})) {
throw new Error('jimScott.pack: Sprite padding not supported');
}
Expand All @@ -94,7 +94,7 @@ exports.pack = function (imageInfos, config) {
} else {
throw new Error('jimScott.pack: Cannot fit image');
}
_.extend(imageInfo, coords);
extend(imageInfo, coords);
packingData.imageInfos.push(imageInfo);
});
return packingData;
Expand Down
4 changes: 2 additions & 2 deletions lib/packers/vertical.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var _ = require('underscore');
var extend = require('lodash.assign');

exports.pack = function (imageInfos) {
var previousBottomPadding = 0,
Expand All @@ -8,7 +8,7 @@ exports.pack = function (imageInfos) {
imageInfos: []
};
imageInfos.forEach(function (existingImageInfo) {
var imageInfo = _.extend({}, existingImageInfo);
var imageInfo = extend({}, existingImageInfo);
packingData.height += Math.max(previousBottomPadding, imageInfo.padding[0]);
imageInfo.y = packingData.height;
imageInfo.x = 0;
Expand Down
11 changes: 6 additions & 5 deletions lib/spriteBackgroundImages.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var URL = require('url'),
queryString = require('querystring'),
_ = require('underscore'),
extend = require('lodash.assign'),
values = require('lodash.values'),
seq = require('seq'),
passError = require('passerror'),
packers = require('./packers'),
Expand Down Expand Up @@ -174,7 +175,7 @@ module.exports = function () {
}
redefinitionErrors[spriteGroupName].push(cssAsset);

group.placeHolders.push(_.extend(spriteInfo, {
group.placeHolders.push(extend(spriteInfo, {
asset: cssAsset,
cssRule: cssRule
}));
Expand All @@ -186,7 +187,7 @@ module.exports = function () {
}

} else {
group.placeHolders.push(_.extend(spriteInfo, {
group.placeHolders.push(extend(spriteInfo, {
asset: cssAsset,
cssRule: cssRule
}));
Expand Down Expand Up @@ -215,7 +216,7 @@ module.exports = function () {
.seqEach(function (spriteGroupName) {
var callback = this,
spriteGroup = spriteGroups[spriteGroupName],
imageInfos = _.values(spriteGroup.imageInfosById),
imageInfos = values(spriteGroup.imageInfosById),
spriteInfo = spriteGroup.placeHolders && spriteGroup.placeHolders[0] || {},
packingData;

Expand All @@ -224,7 +225,7 @@ module.exports = function () {
getCanvasImageFromImageAsset(imageInfo.asset, this);
})
.seqEach(function (canvasImage, i) {
_.extend(imageInfos[i], {
extend(imageInfos[i], {
canvasImage: canvasImage,
width: canvasImage.width,
height: canvasImage.height
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,23 @@
"lib"
],
"dependencies": {
"passerror": "=0.0.1",
"seq": "=0.3.5",
"underscore": "1.8.3"
"lodash.assign": "3.2.0",
"lodash.values": "3.0.0",
"passerror": "1.1.0",
"seq": "0.3.5"
},
"optionalDependencies": {
"canvas": "1.2.11"
},
"devDependencies": {
"assetgraph": "1.20.1",
"coveralls": "^2.11.1",
"istanbul": "^0.4.0",
"assetgraph": "1.23.1",
"coveralls": "2.11.4",
"istanbul": "0.4.0",
"jshint": "2.8.0",
"lodash.pluck": "3.1.2",
"mocha": "2.3.3",
"unexpected": "8.5.0",
"urltools": "=0.1.0"
"unexpected": "10.0.2",
"urltools": "0.2.0"
},
"directories": {
"lib": "./lib"
Expand Down
4 changes: 2 additions & 2 deletions test/spriteBackgroundImages.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*global describe, it*/
var _ = require('underscore'),
var pluck = require('lodash.pluck'),
expect = require('./unexpected-with-plugins'),
AssetGraph = require('assetgraph'),
spriteBackgroundImages = require('../lib/spriteBackgroundImages');
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('spriteBackgroundImages', function () {
expect(assetGraph, 'to contain assets', 'Png', 2);
expect(assetGraph, 'to contain relations', 'CssImage', 2);

var cssImageHrefs = _.pluck(assetGraph.findRelations({type: 'CssImage'}), 'href').sort();
var cssImageHrefs = pluck(assetGraph.findRelations({type: 'CssImage'}), 'href').sort();
expect(cssImageHrefs[0], 'to equal', 'myImage.png?pngquant=128');
expect(cssImageHrefs[1], 'to match', /^sprite-.*?-\d+\.png\?pngquant=128$/);
})
Expand Down

0 comments on commit 826f3e3

Please sign in to comment.