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

fix: update to create packages folder when it doesn't already exist #1395

Merged
merged 1 commit into from
Feb 19, 2019

Conversation

jkmdev
Copy link
Contributor

@jkmdev jkmdev commented Feb 17, 2019

Description

Fixes #1392
Makes it so that the copy-package-readme.js script creates the docs/en/packages folder if it doesn't exist, instead of generating an error.

Motivation & context

Without this change running npm run docs:build or npm run docs:dry-run would fail if the docs/en/packages folder didn't exist.

Issue type checklist

  • Chore: A change that does not impact distributed packages.
  • Bug fix: A change that fixes an issue, link to the issue above.
  • New feature: A change that adds functionality.

Is this a breaking change?

  • This change causes current functionality to break.

Process & policy checklist

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

*/
function createPackagesDir() {

if (!fs.existsSync(destDir)) {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Feb 17, 2019

Code Climate has analyzed commit 3be6988 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 88.3% (0.0% change).

View more on Code Climate.

Copy link
Member

@chrisdholt chrisdholt left a comment

Choose a reason for hiding this comment

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

Thanks @jkmdev! This looks good, although I do think we should consider renaming the utility currently named createDirectory

* Utility function that creates new folders
* based off dir argument
*/
function createDirectory(dir) {
Copy link
Member

Choose a reason for hiding this comment

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

This is somewhat of a naming nit, but I think it may be helpful - perhaps we should consider renaming this function to something more along the lines of ensureDirectoryExists. This is really a function that checks to ensure a directory exists and if it doesn't, it creates it. I think naming it to better align with that will help clarify it's purpose when reading through the copy and create functions above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh! Yes that's a much clearer name, I'll make that change

Copy link
Member

Choose a reason for hiding this comment

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

@jkmdev Looks like this was merged prior to you being able to push the change here - would you mind pushing a new PR to address the name change here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's named appropriately. The assurance is included in the conditional creation.

@awentzel awentzel changed the title fix: create docs/en/packages folder in copy-package-readme.js script if said folder doesn't exist fix: update to create packages folder when it doesn't already exist Feb 19, 2019
@awentzel awentzel merged commit 9ac7543 into microsoft:master Feb 19, 2019
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.

copy readme script fails if packages folder name is missing
3 participants