Skip to content

Commit edf8387

Browse files
thomasruizSBoudrias
authored andcommitted
update deps and cleanup code (#32)
* update deps and cleanup code * remove node 4/6 in ci as they are unmaintained
1 parent 30c5652 commit edf8387

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
22
node_js:
3+
- '12'
4+
- '10'
35
- '8'
4-
- '6'
5-
- '4'

index.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ module.exports = (message, options) => {
4141
* Better implementations welcome :)
4242
*/
4343

44-
let maxLength = 24;
4544
const styledIndexes = {};
46-
let completedString = '';
45+
let maxLength = 24;
4746
let topOffset = 4;
47+
let completedString = '';
4848

4949
// Amount of characters of the yeoman character »column« → ` /___A___\ /`
5050
const YEOMAN_CHARACTER_WIDTH = 17;
5151

5252
// Amount of characters of the default top frame of the speech bubble → `╭──────────────────────────╮`
5353
const DEFAULT_TOP_FRAME_WIDTH = 28;
5454

55-
// Amount of characters of a total line
56-
let TOTAL_CHARACTERS_PER_LINE = YEOMAN_CHARACTER_WIDTH + DEFAULT_TOP_FRAME_WIDTH;
57-
5855
// The speech bubble will overflow the Yeoman character if the message is too long.
5956
const MAX_MESSAGE_LINES_BEFORE_OVERFLOW = 7;
6057

58+
// Amount of characters of a total line
59+
let TOTAL_CHARACTERS_PER_LINE = YEOMAN_CHARACTER_WIDTH + DEFAULT_TOP_FRAME_WIDTH;
60+
6161
if (options.maxLength) {
6262
maxLength = stripAnsi(message).toLowerCase().split(' ').sort()[0].length;
6363

@@ -104,7 +104,7 @@ module.exports = (message, options) => {
104104
let offset = 0;
105105

106106
for (let i = 0; i < spacesIndex.length; i++) {
107-
let char = completedString[spacesIndex[i] - offset];
107+
const char = completedString[spacesIndex[i] - offset];
108108
if (char) {
109109
if (char !== ' ') {
110110
offset += 1;
@@ -135,7 +135,9 @@ module.exports = (message, options) => {
135135

136136
if (styledIndexes[charIndex]) {
137137
return styledIndexes[charIndex] + char;
138-
} else if (hasContinuedStyle >= 2) {
138+
}
139+
140+
if (hasContinuedStyle >= 2) {
139141
return continuedStyle + char;
140142
}
141143

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@
2929
"ansi"
3030
],
3131
"dependencies": {
32-
"ansi-regex": "^2.0.0",
33-
"ansi-styles": "^3.0.0",
34-
"chalk": "^1.0.0",
35-
"cli-boxes": "^1.0.0",
32+
"ansi-regex": "^4.1.0",
33+
"ansi-styles": "^4.0.0",
34+
"chalk": "^2.4.2",
35+
"cli-boxes": "^2.2.0",
3636
"pad-component": "0.0.1",
37-
"string-width": "^2.0.0",
38-
"strip-ansi": "^3.0.0",
37+
"string-width": "^4.1.0",
38+
"strip-ansi": "^5.2.0",
3939
"taketalk": "^1.0.0",
40-
"wrap-ansi": "^2.0.0"
40+
"wrap-ansi": "^6.0.0"
4141
},
4242
"devDependencies": {
43-
"mocha": "^3.2.0",
44-
"xo": "^0.17.0"
43+
"mocha": "^6.2.0",
44+
"xo": "^0.24.0"
4545
},
4646
"xo": {
4747
"space": true

test/manual-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
const chalk = require('chalk');
3-
const yosay = require('../');
3+
const yosay = require('..');
44

55
/*
66
* Yo. Fire this file locally with `node test/manual-test.js` at least after you

test/test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ const assert = require('assert');
44
const fs = require('fs');
55
const path = require('path');
66
const chalk = require('chalk');
7-
const yosay = require('../');
7+
const yosay = require('..');
88

99
const getFixturePath = testName => path.join(__dirname, 'fixture', `${testName}.json`);
1010

1111
const getAssertResult = (testName, expected, done) => fs.readFile(getFixturePath(testName), (err, data) => {
1212
assert.ifError(err);
13-
assert.equal(JSON.parse(data), expected);
13+
assert.strict.equal(JSON.parse(data), expected);
1414
done();
1515
});
1616

0 commit comments

Comments
 (0)