Skip to content

Commit acd5cce

Browse files
authored
Merge pull request #53 from sprynm/update-packages
Update packages
2 parents be791d9 + ce321c7 commit acd5cce

File tree

8 files changed

+50
-41
lines changed

8 files changed

+50
-41
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ language: node_js
22
node_js:
33
- "8.0"
44
- "6.0"
5-
- "4.0"
65
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"

gulpfile.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ gulp.task('lint', function() {
1616
.pipe(jshint.reporter( 'jshint-stylish' ))
1717
});
1818

19-
gulp.task('test', ['lint'], function(done) {
19+
gulp.task('test', gulp.series('lint', function(done) {
2020
return gulp.src('test/*.spec.js', {read: false})
2121
.pipe(mocha());
22-
});
22+
}));
2323

2424
// create the polymer script for the handlebars template to use
2525
gulp.task('vulcanize', function() {
@@ -61,9 +61,12 @@ gulp.task('sass', function() {
6161
});
6262

6363
gulp.task('watch', function() {
64-
gulp.watch(src, ['lint']);
65-
gulp.watch('assets/polymer.html', ['vulcanize']);
66-
gulp.watch('assets/*.scss', ['sass']);
64+
gulp.watch(src, gulp.series('lint'));
65+
//gulp.watch('assets/polymer.html', gulp.series('vulcanize'));
66+
gulp.watch('assets/*.scss', gulp.series('sass'));
6767
});
6868

69-
gulp.task('default', ['connect', 'sass', 'lint', 'test', 'watch']);
69+
gulp.task('default',
70+
gulp.series( gulp.parallel('test', 'sass'), gulp.parallel('watch','connect') )
71+
);
72+

lib/tags.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ var fs = require('fs');
22
var path = require('path');
33
var marked = require('marked');
44
var utils = require('./utils');
5+
var normalizeNewline = require('normalize-newline');
56

67
var validFileRegex = /\.[\w]+$/;
78
var firstLineRegex = /^[\n\r]?([^\n\r]+)/;
8-
var trailingNewline = /[\n\r]+$/;
9+
var trailingNewline = /\s+$/;
910

1011
var forwardReferenceSections = {};
1112

@@ -35,16 +36,18 @@ var tags = {
3536
section: function () {
3637
var name, description;
3738

38-
if (!this.tag.description && !this.comment.description) {
39+
//added trim() to normalize returns on different OSs
40+
if (!this.tag.description && !this.comment.description.trim() ) {
3941
throw new SyntaxError('unnamed section (' + this.file + ':' +
4042
(this.tag.line+1) + ')');
4143
}
4244

4345
// @section did not define the name so use the first line of the comment
4446
// description as the section name and use the rest as the section description
4547
if (!this.tag.description) {
46-
name = this.comment.description.match(firstLineRegex)[1];
47-
description = this.comment.description.substr(name.length + 1);
48+
var normDescription = normalizeNewline(this.comment.description);
49+
name = normDescription.match(firstLineRegex)[1];
50+
description = normDescription.substr(name.length + 1);
4851
}
4952

5053
// @section defined the name so use the comment description as the section
@@ -300,7 +303,7 @@ var tags = {
300303
var result, parsedResult, isCode, isHeading, tag;
301304

302305
try {
303-
file = fs.readFileSync(resolvedPath, 'utf-8');
306+
file = normalizeNewline(fs.readFileSync(resolvedPath, 'utf-8'));
304307
} catch (e) {
305308
throw new ReferenceError('File not found \'' + resolvedPath + '\' (' +
306309
this.file + ':' + (this.tag.line+1) + ')');

package.json

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,31 @@
2323
},
2424
"homepage": "https://github.com/straker/livingcss",
2525
"dependencies": {
26-
"comment-parser": "0.4.0",
27-
"glob": "^6.0.4",
28-
"handlebars": "^4.0.5",
29-
"html-minifier": "^1.1.1",
30-
"marked": "^0.3.5",
26+
"comment-parser": "^0.5.0",
27+
"glob": "^7.1.2",
28+
"handlebars": "^4.0.11",
29+
"html-minifier": "^3.5.8",
30+
"marked": "^0.3.12",
31+
"normalize-newline": "^3.0.0",
3132
"mkdirp": "^0.5.1"
3233
},
3334
"devDependencies": {
34-
"chai": "^3.5.0",
35+
"chai": "^4.1.2",
3536
"coveralls": "^2.11.8",
36-
"gulp": "^3.9.0",
37-
"gulp-connect": "^2.3.1",
37+
"gulp": "^4.0.0",
38+
"gulp-connect": "^5.2.0",
3839
"gulp-insert": "^0.5.0",
39-
"gulp-jshint": "^2.0.0",
40-
"gulp-mocha": "^2.2.0",
40+
"gulp-jshint": "^2.1.0",
41+
"gulp-mocha": "^5.0.0",
4142
"gulp-rename": "^1.2.2",
42-
"gulp-replace": "^0.5.4",
43-
"gulp-sass": "^2.3.2",
44-
"gulp-vulcanize": "^6.1.0",
45-
"istanbul": "^0.4.2",
46-
"jshint": "^2.9.1",
47-
"jshint-stylish": "^2.1.0",
48-
"mocha": "^2.4.5",
49-
"node-sass": "^3.8.0",
50-
"proxyquire": "^1.7.4",
51-
"sinon": "^1.17.3"
43+
"gulp-replace": "^0.6.1",
44+
"gulp-sass": "^3.1.0",
45+
"gulp-vulcanize": "^7.0.0",
46+
"istanbul": "^0.4.5",
47+
"jshint": "^2.9.5",
48+
"jshint-stylish": "^2.2.1",
49+
"mocha": "^5.0.0",
50+
"proxyquire": "^1.8.0",
51+
"sinon": "^4.2.2"
5252
}
5353
}

test/generate.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ var utils = require('../lib/utils');
77
var path = require('path');
88

99
// stubs
10+
var stub = sinon.stub().throws();
1011
var minifyCalled = 0;
1112
var fsStub = {
1213
writeFile: function(file, data, options, callback) { callback(null); },
@@ -32,7 +33,7 @@ var generate = proxyquire('../lib/generate', {
3233
describe('generate', function() {
3334

3435
before(function() {
35-
sinon.stub(utils, 'readFileGlobs', function() {
36+
sinon.stub(utils, 'readFileGlobs').callsFake( function() {
3637
return Promise.resolve();
3738
});
3839
});

test/parseComments.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var expect = require('chai').expect;
44
var fs = require('fs');
55
var path = require('path');
66
var parseComments = require('../lib/parseComments');
7+
var normalizeNewline = require('normalize-newline');
78

89
describe('parseComments', function() {
910

@@ -164,7 +165,7 @@ describe('parseComments', function() {
164165

165166
parseComments(data, file, {}, {}, function(block) {
166167
expect(block.testTag.description).to.equal('<p><em>Will</em> be parsed as <code>markdown</code>.</p>');
167-
expect(block.multipleLines.description).to.equal('<h3 id="header">Header</h3>\n<p>paragraph</p>');
168+
expect( normalizeNewline(block.multipleLines.description) ).to.equal('<h3 id="header">Header</h3>\n<p>paragraph</p>');
168169
});
169170

170171
done();

test/tags.spec.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ var fs = require('fs');
55
var path = require('path');
66
var parseComments = require('../lib/parseComments');
77
var tags = require('../lib/tags');
8+
var normalizeNewline = require('normalize-newline');
89

910
describe('tags', function() {
1011

@@ -376,7 +377,7 @@ describe('tags', function() {
376377

377378
parseComments(data, file, tags, {sections: sections, pages: pages}, function(block) {
378379
expect(block.example).to.exist;
379-
expect(block.example.description).to.equal('/**\n * @example example-with-file.css\n */');
380+
expect( normalizeNewline(block.example.description) ).to.equal('/**\n * @example example-with-file.css\n */');
380381
});
381382

382383
done();
@@ -444,7 +445,7 @@ describe('tags', function() {
444445
}
445446

446447
parseComments(data, file, tags, {sections: sections, pages: pages}, function(block) {
447-
expect(block.code.description).to.equal('.example {\n @extend %placeholder-selector;\n}');
448+
expect( normalizeNewline(block.code.description) ).to.equal('.example {\n @extend %placeholder-selector;\n}');
448449
});
449450

450451
done();
@@ -521,7 +522,7 @@ describe('tags', function() {
521522

522523
parseComments(data, file, tags, {sections: sections, pages: pages});
523524

524-
expect(sections[0].name).to.equal('Doc Example');
525+
expect( sections[0].name.trim() ).to.equal('Doc Example');
525526

526527
done();
527528
});
@@ -557,7 +558,7 @@ describe('tags', function() {
557558

558559
parseComments(data, file, tags, {sections: sections, pages: pages});
559560

560-
expect(sections[0].description).to.equal('<p>Description of the section.</p>\n<h2 id="secondary-heading">Secondary Heading</h2>\n<h1 id="l-heading">L Heading</h1>\n<ul>\n<li>list item 1</li>\n<li>list item 2</li>\n</ul>\n<pre><code>Code in the description\n</code></pre>');
561+
expect( normalizeNewline(sections[0].description).trim() ).to.equal('<p>Description of the section.</p>\n<h2 id="secondary-heading">Secondary Heading</h2>\n<h1 id="l-heading">L Heading</h1>\n<ul>\n<li>list item 1</li>\n<li>list item 2</li>\n</ul>\n<pre><code>Code in the description\n</code></pre>');
561562

562563
done();
563564
});

test/utils.spec.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
var expect = require('chai').expect;
44
var sinon = require('sinon');
55
var proxyquire = require('proxyquire');
6+
var normalizeNewline = require('normalize-newline');
67

78
// stubs
89
var fsStub = {
@@ -269,22 +270,22 @@ describe('utils', function() {
269270
expect(utils.fixSVGIssue(testString)).to.equal('url("data:image\/svg+xml;%27")');
270271

271272
// Case for a closing paren inside url
272-
var testString = 'url("data:image/svg+xml;<svg xmlns=\'blah\'><g transform=\'translate(-1, -1)\'>")';
273+
testString = 'url("data:image/svg+xml;<svg xmlns=\'blah\'><g transform=\'translate(-1, -1)\'>")';
273274
expect(utils.fixSVGIssue(testString)).to.equal(
274275
'url("data:image/svg+xml;<svg xmlns=%27blah%27><g transform=%27translate(-1, -1)%27>")'
275276
);
276277
});
277278

278279
it('should only replace single quotes in svg url expressions', function() {
279280
var testString = 'url("data:image\/svg+xml;\'")\nurl("data:image\/svg+xml;\'")\n\'Arial\'';
280-
expect(utils.fixSVGIssue(testString)).to.equal(
281+
expect( normalizeNewline( utils.fixSVGIssue(testString) ) ).to.equal(
281282
'url("data:image\/svg+xml;%27")\nurl("data:image\/svg+xml;%27")\n\'Arial\''
282283
);
283284

284285
testString = 'url("data:image/svg+xml;\'...\'"), url(\'non-svg-url\')';
285286
expect(utils.fixSVGIssue(testString)).to.equal(
286287
'url("data:image/svg+xml;%27...%27"), url(\'non-svg-url\')'
287-
)
288+
);
288289
});
289290

290291
it('should leave regular urls alone', function() {

0 commit comments

Comments
 (0)