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(format): don't transform 'repository' property when it has a child 'directory' property #93

Closed
wants to merge 1 commit into from
Closed

Conversation

jodyheavener
Copy link
Contributor

@jodyheavener jodyheavener commented Aug 26, 2022

Closes #91

Description (What)

This PR modifies the "format" command to prevent it from formatting the repository property when its value is an object that has a directory property.

Justification (Why)

When a package exists in a mono-repo its repository property can have a directory property to denote its location within the repo. Currently syncpack will transform the repository property to its shortform version, but this ignores the directory property.

How Can This Be Tested?

Set up a package.json that has a repository property with the value of:

{
  "url": "git://gitlab.com/User/repo",
  "type": "git"
}

Run the "format" command and observe that it converts to shortform.

Now, change its value to the following:

{
  "url": "git://gitlab.com/User/repo",
  "type": "git",
  "directory": "packages/foo"
}

Run the command again and observe that this property is not modified.

@JamieMason
Copy link
Owner

Excellent @jodyheavener, thanks a lot

@JamieMason
Copy link
Owner

(finally) released in 8.2.5, thanks a lot @jodyheavener

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.

Format command removes "directory" property when converting "repository" to shorthand
2 participants