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: Install an exact version of @github/prettier-config #464

Closed
wants to merge 1 commit into from

Conversation

hashtagchris
Copy link
Contributor

@hashtagchris hashtagchris commented Jul 22, 2024

This matches what I've seen us install in practice. See

"@github/prettier-config": "0.0.6",
and
prettier: '^3.0.0',
'eslint-config-prettier': '^9.0.0',
'@github/prettier-config': '0.0.6',

Sample postlint guidance

Instead of @github/prettier-config@*, it tells you to install @github/[email protected] with the --save-exact flag.

% npm uninstall prettier && npm uninstall @github/prettier-config
...

% npm run postlint
> @npmcli/[email protected] postlint
> template-oss-check


Some problems were detected:

-------------------------------------------------------------------

The following required devDependencies were not found:

  prettier
  @github/[email protected]

To correct it: npm rm prettier @github/prettier-config && npm i prettier@* --save-dev && npm i @github/[email protected] --save-dev --save-exact

-------------------------------------------------------------------

Exact version enforcement

semver range

% npm i @github/prettier-config@latest --save-dev
...

% npm pkg get devDependencies."@github/prettier-config" 
"^0.0.6"

% npm run postlint                                     

> @npmcli/[email protected] postlint
> template-oss-check


Some problems were detected:

-------------------------------------------------------------------

The following required devDependencies were not found:

  @github/[email protected]

To correct it: npm rm @github/prettier-config && npm i @github/[email protected] --save-dev --save-exact

-------------------------------------------------------------------

Exact version

% npm i @github/[email protected] --save-dev --save-exact
...

% npm pkg get devDependencies."@github/prettier-config"
"0.0.6"
% npm run postlint

> @npmcli/[email protected] postlint
> template-oss-check

% 

References

Follow-up to #447

@hashtagchris hashtagchris requested a review from a team as a code owner July 22, 2024 23:32
@wraithgar wraithgar self-requested a review July 23, 2024 14:13
@wraithgar
Copy link
Member

disregard this approval, I didn't see it was done w/ a hard config to a specific version. That's not how this is done.

Copy link
Member

@wraithgar wraithgar left a comment

Choose a reason for hiding this comment

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

We usually don't bake versions into this package itself.

@hashtagchris
Copy link
Contributor Author

We usually don't bake versions into this package itself.

I see we typically don't specify versions of dependencies, not even major versions. However why is there support for exact versions in template-oss if we should never use it?

const [exactSpecs, saveSpecs] = partition(specs, s => s.type === 'version')

installCommand(exactSpecs, [locationFlag, '--save-exact']),

And why does /test/apply/lint.js test with a version of @github/prettier-config without a caret?

@wraithgar
Copy link
Member

wraithgar commented Jul 23, 2024

The exact version specification appears to be for template-oss itself, which takes the version from its own package.json.

It does not look like we've baked into template-oss the ability to enforce no prefixes for other dependencies. I know we'd talked about it for the linting rules packages, but I don't think it's been done.

@hashtagchris
Copy link
Contributor Author

hashtagchris commented Jul 23, 2024

To correct it: ... npm i @github/[email protected] --save-dev --save-exact

I now understand that we should avoid hardcoding versions in this repo, as its too much trouble to update them later. Ideally we'd want a way to indicate which dependencies should be installed as an exact versions, and template-oss would output something like To correct it: ... npm i @github/prettier-config@* --save-dev --save-exact.

I don't know if we'd actually want or need to migrate to a eventual newer release of @github/prettier-config, but I'll assume that's true for this or another dependency.

@wraithgar wraithgar deleted the hashtagchris-prettier-config-version branch July 23, 2024 16:27
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.

2 participants