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

ComponentsPath may/may not end with a slash #8

Closed
wants to merge 1 commit into from

Conversation

jslovan
Copy link
Contributor

@jslovan jslovan commented Oct 31, 2018

Fixes #5

@CLAassistant
Copy link

CLAassistant commented Oct 31, 2018

CLA assistant check
All committers have signed the CLA.

if (file !== '.' && file !== '..') {
this.findComponents(
`${componentsPath}${file}/`,
`${componentsPathSanit}${file}/`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use path.join and avoid this string juggling?

Suggested change
`${componentsPathSanit}${file}/`,
path.join(componentsPath, file),

const componentsPathSanit = componentsPath.endsWith('/')
? componentsPath
: `${componentsPath}/`;
const files = fs.readdirSync(componentsPathSanit);
Copy link
Contributor

Choose a reason for hiding this comment

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

Another option would be to delegate this to module like glob or globby to recursively list files inside the directory.

@jnv jnv changed the title ComponentsPath may/may not end with a slash. Fixes #5. ComponentsPath may/may not end with a slash Oct 31, 2018
@jnv
Copy link
Contributor

jnv commented Nov 29, 2018

I''l branch-off this PR and replace the custom recursive loading logic with some existing module.

@jnv
Copy link
Contributor

jnv commented Dec 17, 2018

Replaced by #31

@jnv jnv closed this Dec 17, 2018
@jnv jnv deleted the i5_ending_slash branch December 19, 2018 15:51
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