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

[DOCS] Inconsistent package.json repository example use of https and git+https #7614

Closed
2 tasks done
MikeMcC399 opened this issue Jun 27, 2024 · 3 comments · Fixed by #7615
Closed
2 tasks done

[DOCS] Inconsistent package.json repository example use of https and git+https #7614

MikeMcC399 opened this issue Jun 27, 2024 · 3 comments · Fixed by #7615
Labels
Documentation documentation related issue Needs Triage needs review for next steps

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jun 27, 2024

Is there an existing issue for this?

This is a CLI Docs Problem, not another kind of Docs Problem.

  • This is a CLI Docs Problem.

Description of Problem

The Repository documentation example shows:

{
  "repository": {
    "type": "git",
    "url": "https:/npm/cli.git"
  }
}

The same section (Repository) also shows a similar example:

{
  "repository": {
    "type": "git",
    "url": "https:/facebook/react.git",
    "directory": "packages/react-dom"
  }
}
  • npm pkg fix changes the protocol from https to git+https

If npm pkg fix is set up so that https is not accepted as correct, then no examples should be showing https.

The Repository section should provide examples:

  • which are not found to be invalid by npm pkg fix
  • are consistent with the live contents of any example repo it refers to.

Potential Solution

Change to

"url": "git+https:/npm/cli.git"

Instead of the (incorrect?) Facebook example (using only https) use one of the npm/cli examples with a directory. For example

  "repository": {
    "type": "git",
    "url": "git+https:/npm/cli.git",
    "directory": "workspaces/libnpmpublish"
  },

Affected URL

https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository

@MikeMcC399 MikeMcC399 added Documentation documentation related issue Needs Triage needs review for next steps labels Jun 27, 2024
@MikeMcC399
Copy link
Contributor Author

@MikeMcC399
Copy link
Contributor Author

wraithgar pushed a commit that referenced this issue Jun 27, 2024
- closes #7614

## Issue

Examples in the
[repository](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository)
section of the [npm CI > Configuring npm >
package.json](https://docs.npmjs.com/cli/v10/configuring-npm/package-json)
reference page use the protocol `https`. The examples are:

```json
"url": "https:/npm/cli.git"
```
```json
"url": "https:/facebook/react.git"
```

Executing `npm pkg fix` in a repo with a `url` definition and `protocol`
using `https` normalizes the protocol to `git+https`.

Examples should be aligned with what `npm pkg fix` considers correct and
should also be aligned to the list of valid protocols in the [Git URLs
as
Dependencies](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#git-urls-as-dependencies)
section, which states:

> `<protocol>` is one of `git`, `git+ssh`, `git+http`, `git+https`, or
`git+file`.

## Change

1. `npm/cli.git`
    Change to
    ```json
    "url": "git+https:/npm/cli.git"
    ```
2. `facebook/react.git`
Since the source example of
https:/facebook/react/blob/main/packages/react-dom/package.json
does not use the correct `git+https` protocol, use instead
    ```json
    "url": "git+https:/npm/cli.git",
    "directory": "workspaces/libnpmpublish"
    ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation documentation related issue Needs Triage needs review for next steps
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant