Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bumping tabtab to 2.2.2 #595

Closed
wants to merge 23 commits into from

Conversation

willmendesneto
Copy link
Contributor

@willmendesneto willmendesneto commented Jul 15, 2018

Purpose of this pull request?

  • Documentation update
  • Bug fix
  • Enhancement
  • Other, please explain: upgrade a package dependency

What changes did you make?

Upgrade tabtab to v2 and, since the default the old method was deprecated, some code changes were applied to support this version.

Is there anything you'd like reviewers to focus on?

Refers to #508

Ping @SBoudrias @mischah @mklabs @sindresorhus

@willmendesneto
Copy link
Contributor Author

willmendesneto commented Jul 15, 2018

Folks, I can't simulate this issue on Travis-CI locally, the tests are passing for me. Could you take a look at that, please?

NodeJS: v8.9.4
NPM: 5.6.0
YO: 2.0.3
OS: macOS High Sierra 10.13.5

@willmendesneto willmendesneto force-pushed the bumping-tabtab branch 6 times, most recently from c8f1760 to 91ae562 Compare July 16, 2018 13:00
@mklabs
Copy link
Contributor

mklabs commented Jul 16, 2018

@willmendesneto Thanks for dealing with this issue. I really appreciate that. 👍

@willmendesneto
Copy link
Contributor Author

@mklabs My pleasure, mate. Do you know if the is there any system dependency that we need to install in this new version?

@mklabs
Copy link
Contributor

mklabs commented Jul 16, 2018

@willmendesneto I don't think so. But maybe Travis prevents tabtab from touching files like ~/.bashrc. Tabtab needs to add a line in there.

@mklabs
Copy link
Contributor

mklabs commented Jul 16, 2018

@willmendesneto I'm available right now if you'd like to talk about this issue, if you can have a call I can hangout maybe.

@mklabs
Copy link
Contributor

mklabs commented Jul 16, 2018

I forked your fork @willmendesneto Trying to run these tests on Windows 10 (git bash on windows) and got an error.

@willmendesneto
Copy link
Contributor Author

@mklabs If you don't mind, can we try that tomorrow? These tests are passing locally, but they're not passing on Travis-CI. I'm suspecting that can be related to some OS dependency that are not installed on Travis-CI agent. The problem is that I can't check that running on debug mode.

In the meantime, that will be great if you can check the changes between the versions 1.3.2 and 2.0.0 later. The code start to break on Travis after this version (which was the release after the one that yo is currently using, based on npm website).

@mklabs
Copy link
Contributor

mklabs commented Jul 16, 2018

@willmendesneto No worries, we can do that tomorrow. Meanwhile, I'm trying to run them on Windows. I may open up a pull request on your repository to test out Travis. Have a great day or night ^^

@mklabs
Copy link
Contributor

mklabs commented Jul 16, 2018

After hours fighting against git bash and npm links, I finally managed to reproduce the error locally (with Bash on Windows). There is indeed an issue I can't figure out right now. I'll take a close look tomorrow.

@mklabs
Copy link
Contributor

mklabs commented Jul 17, 2018

I'm still not sure what to do exactly, but it seems like we can't use both package.json completion and event emitter in https://github.com/willmendesneto/yo/blob/bumping-tabtab/lib/completion/index.js#L16

If I comment out this line, I get completion results based on package.json file.

cmd: DEBUG="tabtab*" COMP_POINT="4" COMP_LINE="yo " COMP_CWORD="1" node /mnt/c/Users/mk/dev/yo/lib/completion/index.js completion -- yo
error null
OUTPUT -f
--force
--version
--no-color
--no-insight
--insight
--generators

STDERR Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete handle: options {"name":"yo","cache":true,"ttl":300000}
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete handle: env {"args":["completion","--","yo"],"complete":true,"words":1,"point":4,"line":"yo ","partial":"yo ","last":"","lastPartial":"","prev":"yo"}
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete handle: env.line yo
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete complete package {"args":["completion","--","yo"],"complete":true,"words":1,"point":4,"line":"yo ","partial":"yo ","last":"","lastPartial":"","prev":"yo"}
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete TEST Received ["-f","--force","--version","--no-color","--no-insight","--insight","--generators"]
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete completion item -f string
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete completion item --force string
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete completion item --version string
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete completion item --no-color string
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete completion item --no-insight string
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete completion item --insight string
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete completion item --generators string
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete TEST results ["-f","--force","--version","--no-color","--no-insight","--insight","--generators"]
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete results: ["-f","--force","--version","--no-color","--no-insight","--insight","--generators"] {"args":["completion","--","yo"],"complete":true,"words":1,"point":4,"
line":"yo ","partial":"yo ","last":"","lastPartial":"","prev":"yo"}
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete Sendind events yo
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete With env {"args":["completion","--","yo"],"complete":true,"words":1,"point":4,"line":"yo ","partial":"yo ","last":"","lastPartial":"","prev":"yo"}
Tue, 17 Jul 2018 14:06:39 GMT tabtab:complete Emit event (yo)

      ✓ Returns the completion candidates for both options and installed generators (1717ms)

I need more time working on this, but I feel like those completion results should be handled in the completer file instead of in package.json

@mklabs
Copy link
Contributor

mklabs commented Jul 17, 2018

Related pull request on @willmendesneto repository: willmendesneto#1

Copy link
Contributor

@mklabs mklabs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work

.travis.yml Outdated
- npm install -s --no-progress
before_script:
- npm run tabtab-install
- source /home/travis/.bashrc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell (now that I worked a bit on this, sorry for my previous answers), and unless I didn't understood the expected installation step, I'm not sure you need this anymore. It'll be done by yo completion and up to the user to choose when and how to setup the bridge in its bashrc (or zshrc, or fish config).

The tests don't really test the autocompletion but the actual output of yo-completer (on yo completion -- yo <command or options>)

lib/cli.js Outdated
name: 'yo',
completer: 'yo-complete'
completer: 'yo-complete',
cache: !process.env.YO_TEST
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache was a nightmare to test and to prone for errors, I decided to remove this feature in the upcoming tabtab version

package.json Outdated
@@ -19,6 +19,7 @@
"postupdate": "yodoctor",
"pretest": "xo",
"test": "nyc mocha --timeout=10000",
"tabtab-install": "tabtab install --auto --name yo --completer yo-complete",
Copy link
Contributor

@mklabs mklabs Jul 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user is intended to use yo completion command to install the completion mechanism, I think this is not needed anymore.

@@ -64,7 +65,7 @@
"root-check": "^1.0.0",
"sort-on": "^3.0.0",
"string-length": "^2.0.0",
"tabtab": "^1.3.2",
"tabtab": "^2.2.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As soon as it's ready (probably this weekend), it'll need to be bumped to ^3.0.0

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, we'll hold off merging until then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me 👍 I want to take a little bit more time. I won't be able to work much more this weekend, and I want to take time with Wilson to coordinate our efforts. Thanks @SBoudrias

@@ -29,28 +29,26 @@ describe('Completion', () => {
});

describe('Test completion STDOUT output', () => {
it('Returns the completion candidates for both options and installed generators', done => {
it.only('Returns the completion candidates for both options and installed generators', () => {
const yocomplete = path.join(__dirname, '../lib/completion/index.js');
const yo = path.join(__dirname, '../lib/cli');

let cmd = 'export cmd="yo" && YO_TEST=true DEBUG="tabtab*" COMP_POINT="4" COMP_LINE="$cmd" COMP_CWORD="$cmd"';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, you probably need to add a space at the end of the line, otherwise the cmd will look like something along these lines:

... COMP_CWORD="$cmd"node ...

return;
exec(cmd, (error, out, stderr) => {
console.log('stdout: ', out);
console.log('stderr: ', stderr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing and logging stderr here indeed helps a ton, you might get debugging statement this way.

@willmendesneto
Copy link
Contributor Author

Closing this pull request since it needs more time to apply some changes on tabtab package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants