Skip to content

Use an alias system instead of camelCase function - #3101

Merged
arcanis merged 2 commits into
yarnpkg:masterfrom
voxsim:camel-case
Apr 20, 2017
Merged

arcanis merged 2 commits into
yarnpkg:masterfrom
voxsim:camel-case

Conversation

@voxsim

@voxsim voxsim commented Apr 11, 2017

Copy link
Copy Markdown
Contributor

Summary
In this pull request I try to remove the camelCase function from src/cli/commands/index.js and
src/cli/commands/help.js and instead I use an alias system.
I move the existing aliases to unsupported-aliases.
We can't still remove the entire dependency camelCase because global command use it.
Finally I move every command-related stuff in src/cli/commands/index.js.

Test plan

  • tests camelised comand
  • tests command with hyphen
  • tests every case above and some weird cases with --help option

@bestander
bestander requested a review from arcanis April 11, 2017 10:52
- tests properly camelised comand
- tests properly command with hyphen
- move generation of documentation in src/cli/commands/index.js
- move every command related stuff in src/cli/commands/index.js
- tests some corner cases
- delete every camelCase use in src/cli/commands/index.js and
src/cli/commands/help.js
@voxsim

voxsim commented Apr 20, 2017

Copy link
Copy Markdown
Contributor Author

@arcanis I rebased after the last commits ;)

Comment thread src/cli/commands/index.js Outdated
import * as version from './version.js'; commands['version'] = version;
import * as versions from './versions.js'; commands['versions'] = versions;
import * as why from './why.js'; commands['why'] = why;
import * as upgradeInteractive from './upgrade-interactive.js'; commands['upgradeInteractive'] = upgradeInteractive;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It might be clearer to do something like this:

import * as bar from './bar';
import * as foo from './foo';
...

let commands = {
    bar,
    foo,
    ...
};

What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think is A LOT clearer; i will change it!

Comment thread __tests__/index.js Outdated
);
});

test.concurrent('should show help and ignore unsopported aliases', async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unsopported? :p

(same typo on 214 and 221 :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

aaaah thanks and sorry XD

@arcanis

arcanis commented Apr 20, 2017

Copy link
Copy Markdown
Member

Nice work! Just a typo to fix and I merge this 👍

I really feel like github should offer a way to edit PRs from the review interface, for cases like this ...

@voxsim

voxsim commented Apr 20, 2017

Copy link
Copy Markdown
Contributor Author

@arcanis done!

@arcanis
arcanis merged commit 6d8dcec into yarnpkg:master Apr 20, 2017
This was referenced Apr 28, 2017
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.

2 participants