yeoman / yosay

Tell Yeoman what to say
BSD 2-Clause "Simplified" License
205 stars 43 forks source link

Fix glitches #24

Closed mischah closed 8 years ago

mischah commented 8 years ago

Yo @yeoman/yosay,

This PR fixes two (not so edgy) edge case issues I introcuded with #23.

First of all let me say how sorry and ashamed I am for creating these bugs :confounded:

Bug No. 1

The overflowing of messages that are too long is producing corrupted output of speech bubble when using the maxLength option.

broken-overflow-with-maxlength

This is fixed with:

4ed86625 Fix overflowing messages when using maxLength

See screenshot:

fixed-overflow-with-maxlength

Bug No. 2

Calling yosay more than once within a script adapting topOffset causes corrupted output of the latter speech bubbles.

broken-multiple-spechbubbles

This is fixed with:

03a990aa Fix problem with top offset and left padding …

See screenshot:

fixed-multiple-spechbubbles

Conclusion

As said before I am terribly sorry to messed this up with the introduction of the speech bubble tip.

It was caused by not thoroughly hand testing and the auto generating of test fixtures :anguished:

I made sure to hand test the fixes of this PR by with this node file:

const yosay = require('yosay');
const chalk = require('chalk');

console.log(yosay('Hello, and welcome to my fantastic generator full of whimsy and bubble gum!'));

console.log(yosay('Hi'));

console.log(yosay('Welcome to Yeoman, ladies and gentlemen!'));

console.log(yosay('Hi', {maxLength: 8}));

console.log(yosay('Hello, buddy!', {maxLength: 4}));

console.log(yosay(chalk.red.bgWhite('Hi')));

console.log(yosay(chalk.red.bgWhite('Hi') + ' there, sir!'));

console.log(yosay(chalk.red.bgWhite('Hi') + ' there, sir! ' + chalk.bgBlue.white('you are looking') + ' swell today!'));

console.log(yosay('first line\nsecond line\n\nfourth line'));

console.log(yosay('项目可以更新了'));

console.log(yosay('iloveunicornsiloveunicornsiloveunicornsiloveunicornsiloveunicornsiloveunicorns'));

console.log(yosay('Lie on your belly and purr when you are asleep shove bum in owner’s face like camera lens. Cough furball.', {maxLength: 11}));
console.log(yosay('Lie on your belly and purr when you are asleep shove bum in owner’s face like camera lens. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball.'));
console.log(yosay('Lie on your belly and purr when you are asleep shove bum in owner’s face like camera lens. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball.', {maxLength: 11}));
console.log(yosay('Lie on your belly and purr when you are asleep shove bum in owner’s face like camera lens. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball.', {maxLength: 26}));

console.log(yosay(
    'That’s it. Feel free to fire up the server with ' +
    chalk.green('`npm run start:dev`') +
    'or use our subgenerator to create endpoints.'
));

console.log(yosay ('That’s it. Feel free to fire up the server with `npm run start:dev` or use our subgenerator to create endpoints.'));

console.log(yosay(
    'That’s it. Feel free to fire up the server with ' +
    chalk.green('`npm run start:dev`') + '.'
));

console.log(yosay(
    'That’s it. Feel free to fire up the server with ' +
    '`npm run start:dev`.'
));

And this bash file:

yosay 'Hi' && 
yosay 'Welcome to Yeoman, ladies and gentlemen!' && 
yosay 'Hi' --maxLength 8 &&
yosay 'Hello, buddy!' --maxLength 4 && 
yosay '项目可以更新了' && 
yosay 'iloveunicornsiloveunicornsiloveunicornsiloveunicornsiloveunicornsiloveunicorns' &&
yosay 'Lie on your belly and purr when you are asleep shove bum in owner’s face like camera lens. Cough furball.' --maxLength 11 && 
yosay 'Lie on your belly and purr when you are asleep shove bum in owner’s face like camera lens. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball.' && 
yosay 'Lie on your belly and purr when you are asleep shove bum in owner’s face like camera lens. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball. Cough furball.' --maxLength 26 && 
yosay 'That’s it. Feel free to fire up the server with `npm run start:dev`.'
mischah commented 8 years ago

I would be super happy if @sindresorhus could review that as soon as possible (He’s the one who helped me with #23)

Cause I would love to merge that into master and prepare a release as soon as possible to get these bugfixes out on the street.

mischah commented 8 years ago

You want me to squash the 3 commits before that PR lands into master?

sindresorhus commented 8 years ago

No worries at all. The code here is very complex.

Could you add the above Node.js script as manual-test.js to the repo? So we can run the manual tests to verify whenever.

sindresorhus commented 8 years ago

You want me to squash the 3 commits before that PR lands into master?

No need. GitHub has a squash and merge button now.

mischah commented 8 years ago

I’ve just added the manual-test.jsfile. Let me know if there is anything else I can do.

Otherwise I would:

  1. Squash and merge
  2. Bump version
  3. Tag Release
  4. Add Release notes to the Release tab here on Github
  5. Ping to npm publish that thing.
sindresorhus commented 8 years ago

Awesome. Thanks for fixing :)

mischah commented 8 years ago

opps. you’ve done that while I was typing.

sindresorhus commented 8 years ago

Published.

@mischah Could you do 4.? I'm out of time.

mischah commented 8 years ago

You were too fast. Build fails in older node versions because I used const in manual-test.js :dizzy_face:

sindresorhus commented 8 years ago

Already fixed

mischah commented 8 years ago

ah. okay. man you’re fast like a 🚀

mischah commented 8 years ago

Add Release notes to the Release tab here on Github

Done. Thanks for everything. Highly appreciated what you are doing 💖