Skip to content

Replace fs.existsSync calls with wrapped fs.statSync#204

Closed
jskrzypek wants to merge 3 commits intostrongloop:masterfrom
jskrzypek:replace-exists-sync
Closed

Replace fs.existsSync calls with wrapped fs.statSync#204
jskrzypek wants to merge 3 commits intostrongloop:masterfrom
jskrzypek:replace-exists-sync

Conversation

@jskrzypek
Copy link
Copy Markdown
Contributor

Fixes #201

@slnode
Copy link
Copy Markdown

slnode commented Aug 10, 2016

Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test."

@slnode
Copy link
Copy Markdown

slnode commented Aug 10, 2016

Can one of the admins verify this patch?

1 similar comment
@slnode
Copy link
Copy Markdown

slnode commented Aug 10, 2016

Can one of the admins verify this patch?

lib/compiler.js Outdated
} catch (e) {
return false;
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you put move this function to a shared lib such as ./lib/utils.js?

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 thought about that but didn't at first because the logic was only used more than once in compiler.js, and the function it's used in in config-loader.js, and there wasn't already a util file for shared logic.

Anyhow, I'm happy to do move it. I'll do it now.

@superkhau
Copy link
Copy Markdown
Contributor

Your commit message is too long too.

fs.existsSync calls with wrapped fs.statSyn: First line should be 50 characters or less (saw 52)

See https://github.com/strongloop/loopback-contributor-docs/blob/master/git-commit-messages.md

@jskrzypek jskrzypek force-pushed the replace-exists-sync branch from 69261a4 to a47774b Compare August 11, 2016 10:17
@jskrzypek
Copy link
Copy Markdown
Contributor Author

@superkhau Do you need me to write a test file for lib/utils.js as well?

@superkhau
Copy link
Copy Markdown
Contributor

@jskrzypek Yes please.

@jskrzypek
Copy link
Copy Markdown
Contributor Author

Tests added & green 😄

lib/utils.js Outdated

var fs = require('fs');

exports.fileExists = fileExists;
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.

Please call the method fileExistsSync to follow the naming convention used by Node core for sync methods.

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.

👍

@bajtos bajtos self-assigned this Sep 2, 2016
@bajtos
Copy link
Copy Markdown
Member

bajtos commented Sep 2, 2016

@slnode ok to test

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Sep 2, 2016

@jskrzypek thank you for the pull request. I left few minor comments to address, the rest LGTM.

@jskrzypek
Copy link
Copy Markdown
Contributor Author

@bajtos done :)

@jskrzypek
Copy link
Copy Markdown
Contributor Author

@bajtos I can't see why it's failing... the tests pass when I try to run npm run test local

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Sep 5, 2016

I can't see why it's failing... the tests pass when I try to run npm run test local

The failures are in downstream dependencies. We are working on getting them fixed, but it's a long-term project. You can ignore them for now.

@bajtos
Copy link
Copy Markdown
Member

bajtos commented Sep 5, 2016

Landed, thank you for the contribution!

@jskrzypek jskrzypek deleted the replace-exists-sync branch September 5, 2016 12:59
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.

5 participants