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

feat: add command line option for choosing between double and single quotes #39

Merged
merged 1 commit into from
Oct 8, 2017
Merged

Conversation

markuseckstein
Copy link
Contributor

Some people prefer single quotes for their imports. This PR add the -q option to use single quotes in the generated imports/exports.

Copy link
Owner

@bencoveney bencoveney left a comment

Choose a reason for hiding this comment

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

Couple of small tweaks but overall looks good. Useful feature and thorough pull request. Thanks for contributing 👍

.version()
.alias("v", "version")
.default("v", false)

.boolean("V")
.alias("V", "verbose")
.describe("V", "Display additional logging information")
.default("D", false);
.default("V", false);
}

export function getOptions(): Options {
Copy link
Owner

Choose a reason for hiding this comment

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

Seeing as the quote character is going to be constant throughout execution of the program, you can evaluate it once here and add it to the options object rather than resolving it each time using getQuoteCharacter.


import {buildImportPath} from "../builder";

export function buildFlatBarrel(directory: Directory, modules: Location[], options: Options): string {
const quoteChar = getQuoteCharacter(options);
Copy link
Owner

Choose a reason for hiding this comment

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

Would prefer quoteCharacter

package.json Outdated
@@ -1,6 +1,6 @@
{
"name": "barrelsby",
"version": "0.0.4",
Copy link
Owner

Choose a reason for hiding this comment

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

Don't need to resolve this (as I can do it when I release) but there is already a v0.0.5 I released a beta for #34 so this will be released as v0.0.6.

@markuseckstein
Copy link
Contributor Author

Thank you for reviewing so quickly! I refactored so that we're using a quoteCharacter property on the options object now.

@bencoveney bencoveney merged commit db63bdf into bencoveney:master Oct 8, 2017
@bencoveney
Copy link
Owner

Thanks 👍 Published to NPM as version 0.0.7

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.

None yet

2 participants