Skip to content

Commit 3340d85

Browse files
committed
fix: deploy "dist"
1 parent e92daab commit 3340d85

File tree

9 files changed

+71
-51
lines changed

9 files changed

+71
-51
lines changed

__tests__/bins.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { promisify } = require('util');
44
const readFile = promisify(fs.readFile);
55
const base = __dirname + '/fixtures/bins';
66
const fixtures = readdir(base);
7-
const binToFile = require('../');
7+
const binToFile = require('../lib');
88

99
describe('bin fixtures', () => {
1010
fixtures

__tests__/empty.test.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
'use strict';
22
/*global describe, it, beforeEach */
33
var assert = require('assert');
4-
var toFile = require('../');
4+
var toFile = require('../lib');
55
var fs = require('fs');
66
var path = require('path');
77

8-
describe('empty bin', function () {
8+
describe('empty bin', function() {
99
var html = '';
1010

11-
beforeEach(function () {
12-
html = fs.readFileSync(path.join(__dirname, 'fixtures', 'simple.html'), 'utf8');
11+
beforeEach(function() {
12+
html = fs.readFileSync(
13+
path.join(__dirname, 'fixtures', 'simple.html'),
14+
'utf8'
15+
);
1316
});
1417

15-
it('should insert JS at end when missing </body>', function () {
18+
it('should insert JS at end when missing </body>', function() {
1619
var file = toFile({ html: html, javascript: '', css: '' });
1720

1821
file = file.replace(/<!--hash:.*?-->\n/, '');
1922

2023
assert(file === html, 'output is exactly the same');
2124
});
22-
});
25+
});

__tests__/full.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
/*global describe, it, beforeEach */
33
var assert = require('assert');
4-
var toFile = require('../');
4+
var toFile = require('../lib');
55
var fs = require('fs');
66
var path = require('path');
77
var cheerio = require('cheerio');

__tests__/html-only.test.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
'use strict';
22
/*global describe, it, beforeEach */
33
var assert = require('assert');
4-
var toFile = require('../');
4+
var toFile = require('../lib');
55
var fs = require('fs');
66
var path = require('path');
77

8-
describe('simple html', function () {
8+
describe('simple html', function() {
99
var html = '';
1010

11-
beforeEach(function () {
12-
html = fs.readFileSync(path.join(__dirname, 'fixtures', 'simple.html'), 'utf8');
11+
beforeEach(function() {
12+
html = fs.readFileSync(
13+
path.join(__dirname, 'fixtures', 'simple.html'),
14+
'utf8'
15+
);
1316
});
1417

15-
it('should have fixtures', function () {
18+
it('should have fixtures', function() {
1619
assert(html.length > 0, 'fixture HTML has content');
1720
});
1821

19-
it('does nothing to plain html', function () {
22+
it('does nothing to plain html', function() {
2023
var file = toFile({ html: html });
2124

2225
file = file.replace(/<!--hash:.*?-->\n/, '');
2326

2427
assert(html === file, 'content matches');
2528
});
26-
});
29+
});

__tests__/insert.test.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
/*global describe, it, beforeEach */
33
var assert = require('assert');
4-
var toFile = require('../');
4+
var toFile = require('../lib');
55
var fs = require('fs');
66
var path = require('path');
77

@@ -45,12 +45,8 @@ describe('content insert', function() {
4545
var css = 'body { background: red; }';
4646
var file = toFile({ html: html, css: css });
4747

48-
assert(file.indexOf(css) !== -1, 'contains the css: ' + file);
49-
50-
var lines = file.split('\n');
51-
var pos = lines.indexOf(css);
52-
53-
assert(lines[pos + 2].indexOf('</title>') === 0, lines[pos + 2]);
48+
expect(file).toEqual(expect.stringContaining(css));
49+
expect(file).toEqual(expect.stringContaining('</title>'));
5450
});
5551

5652
it('should insert JS at end when missing </body>', function() {

__tests__/integrity.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
/*global describe, it, beforeEach, after */
33
var w3cjs = require('w3cjs');
4-
var toFile = require('../');
4+
var toFile = require('../lib');
55
var fs = require('fs');
66
var path = require('path');
77

__tests__/protocol.test.js

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,65 @@
11
'use strict';
22
/*global describe, it, beforeEach */
33
var assert = require('assert');
4-
var toFile = require('../');
4+
var toFile = require('../lib');
55
var fs = require('fs');
66
var path = require('path');
77
var cheerio = require('cheerio');
88

9-
describe('protocol-less bin', function () {
9+
describe('protocol-less bin', function() {
1010
var html = '';
1111

12-
beforeEach(function () {
13-
html = fs.readFileSync(path.join(__dirname, 'fixtures', 'protocol.html'), 'utf8');
12+
beforeEach(function() {
13+
html = fs.readFileSync(
14+
path.join(__dirname, 'fixtures', 'protocol.html'),
15+
'utf8'
16+
);
1417
});
1518

16-
it('should be the same without a protocol', function () {
17-
var file = toFile({ html: html, javascript: '', css: ''}, { proto: '' });
19+
it('should be the same without a protocol', function() {
20+
var file = toFile({ html: html, javascript: '', css: '' }, { proto: '' });
1821
assert(file.trim() === html.trim(), 'output is exactly the same');
1922
});
2023

21-
it('should insert http', function () {
22-
var file = toFile({ html: html, javascript: '', css: ''}, { proto: 'http' });
24+
it('should insert http', function() {
25+
var file = toFile(
26+
{ html: html, javascript: '', css: '' },
27+
{ proto: 'http' }
28+
);
2329

2430
var $ = cheerio.load(html);
25-
$('script').each(function () {
31+
$('script').each(function() {
2632
var src = $(this).attr('src');
2733

2834
if (src.slice(0, 2) === '//') {
29-
assert(file.indexOf('http:' + src) !== -1, 'relative protocol on ' + src);
35+
assert(
36+
file.indexOf('http:' + src) !== -1,
37+
'relative protocol on ' + src
38+
);
3039
}
3140
});
3241

3342
assert(file.trim() !== html.trim(), 'output is different');
3443
});
3544

36-
it('should insert https', function () {
37-
var file = toFile({ html: html, javascript: '', css: ''}, { proto: 'https' });
45+
it('should insert https', function() {
46+
var file = toFile(
47+
{ html: html, javascript: '', css: '' },
48+
{ proto: 'https' }
49+
);
3850

3951
var $ = cheerio.load(html);
40-
$('script').each(function () {
52+
$('script').each(function() {
4153
var src = $(this).attr('src');
4254

4355
if (src.slice(0, 2) === '//') {
44-
assert(file.indexOf('https:' + src) !== -1, 'relative protocol on ' + src);
56+
assert(
57+
file.indexOf('https:' + src) !== -1,
58+
'relative protocol on ' + src
59+
);
4560
}
4661
});
4762

4863
assert(file.trim() !== html.trim(), 'output is different');
4964
});
50-
});
65+
});

__tests__/single-field-only.test.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
'use strict';
22
/*global describe, it, beforeEach */
33
var assert = require('assert');
4-
var toFile = require('../');
4+
var toFile = require('../lib');
55
var fs = require('fs');
66
var path = require('path');
77
var cheerio = require('cheerio');
88

9-
describe('js only', function () {
9+
describe('js only', function() {
1010
var js = '';
1111

12-
beforeEach(function () {
12+
beforeEach(function() {
1313
js = fs.readFileSync(path.join(__dirname, 'fixtures', 'simple.js'), 'utf8');
1414
});
1515

16-
it('should have fixtures', function () {
16+
it('should have fixtures', function() {
1717
assert(js.length > 0, 'fixture js has content');
1818
});
1919

20-
it('does nothing to plain js', function () {
20+
it('does nothing to plain js', function() {
2121
var file = toFile({ javascript: js, url: 'foo', revision: 10 });
2222

2323
var $ = cheerio.load(file);
@@ -27,23 +27,26 @@ describe('js only', function () {
2727
});
2828
});
2929

30-
describe('css only', function () {
30+
describe('css only', function() {
3131
var css = '';
3232

33-
beforeEach(function () {
34-
css = fs.readFileSync(path.join(__dirname, 'fixtures', 'simple.css'), 'utf8');
33+
beforeEach(function() {
34+
css = fs.readFileSync(
35+
path.join(__dirname, 'fixtures', 'simple.css'),
36+
'utf8'
37+
);
3538
});
3639

37-
it('should have fixtures', function () {
40+
it('should have fixtures', function() {
3841
assert(css.length > 0, 'fixture css has content');
3942
});
4043

41-
it('does nothing to plain css', function () {
44+
it('does nothing to plain css', function() {
4245
var file = toFile({ css: css });
4346

4447
var $ = cheerio.load(file);
4548
var outputCSS = $('#jsbin-css').text();
4649

4750
assert(outputCSS.trim() === css.trim(), 'content matches');
4851
});
49-
});
52+
});

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "bin-to-file",
3-
"version": "1.0.3",
3+
"version": "1.0.4",
44
"description": "Converts JS Bin object to static HTML",
5-
"main": "lib/index.js",
5+
"main": "dist/index.js",
66
"babel": {
77
"presets": [
88
"env",

0 commit comments

Comments
 (0)