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 fix method #43

Merged
merged 2 commits into from
Jul 5, 2023
Merged

feat: add fix method #43

merged 2 commits into from
Jul 5, 2023

Conversation

wraithgar
Copy link
Member

No description provided.

@wraithgar wraithgar requested a review from a team as a code owner June 29, 2023 16:00
@wraithgar
Copy link
Member Author

typo fix commit is in this PR too

Copy link
Contributor

@hashtagchris hashtagchris left a comment

Choose a reason for hiding this comment

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

Looks good. Left some minor non-blocking comments.

'devDependencies',
'scriptpath',
])

static prepareSteps = Object.freeze([
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to have a comment that prepare's behavior is well-defined at this point and shouldn't grow or change beyond bug fixes.

}),
})
const { content } = await PackageJson.fix(path)
t.strictSame(content.name, '@npmcli/test-package')
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding a fix then prepare test and confirming prepare is a noop with regard to fixed fields.

t.strictSame(content.version, '1.0.0')
t.strictSame(content.bin, { 'test-package': '@npmcli/test-package' })
t.strictSame(content.dependencies, { lodash: '' })
t.strictSame(content.repository, { type: 'git', url: 'github.com/npm/test-package' })
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm probably opening a big can of worms, but should the repository url be prefixed with https:// or git+https://?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

      if (hosted) {
        r = data.repository.url
          = hosted.getDefaultRepresentation() === 'shortcut' ? hosted.https() : hosted.toString()
      }

We rely on that module to know if this was a "shortcut" or not, and change our representation accordingly.

@wraithgar wraithgar merged commit ed68a28 into main Jul 5, 2023
@wraithgar wraithgar deleted the gar/normalize branch July 5, 2023 17:05
@github-actions github-actions bot mentioned this pull request Jul 5, 2023
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