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

Enhancement: Extend SPFx project version detection with checking if .yo-rc.json and package.json are in sync #1488

Closed
waldekmastykarz opened this issue Apr 17, 2020 · 3 comments

Comments

@waldekmastykarz
Copy link
Member

waldekmastykarz commented Apr 17, 2020

Related to #1475, #1487

We should extend the SPFx project version detection logic with checking if .yo-rc.json and package.json are in sync.

Currently, when detecting SPFx project versions we look at .yo-rc.json and fallback to package.json if necessary. In some cases however, the package versions might be updated without aligning the version number in .yo-rc.json which could lead to us incorrectly detecting project version.

We should change the version detection logic so that it gets numbers both from .yo-rc.json and package.json and then controls if they point to the same SPFx version. If they don't, the command should return error to avoid incorrect output.

@westerdaled
Copy link

westerdaled commented May 14, 2020

After running

spfx project upgrade --toVersion 1.10.0 --output md --outputFile "upgrade-report.md"

Then going through all the summary steps, the project hasn't upgraded and I can no longer run gulp bundle --ship:

A quick check to see the spfx status:

image
.yo-rc.json looks fine

{
  "@microsoft/generator-sharepoint": {
    "version": "1.10.0",

Whereas package.json seems be causing spfx doctor to give the incorrect status

"dependencies": {
    "@microsoft/sp-application-base": "1.2.0",
    "@microsoft/sp-core-library": "~1.2.0",
    "@microsoft/sp-dialog": "^1.2.0",
    "@microsoft/sp-listview-extensibility": "1.2.0",
    "@microsoft/sp-webpart-base": "~1.2.0",
    "@types/webpack-env": ">=1.12.1 <1.14.0"
  },

Do I need to manually change these dependencies, as they are omitted in the steps listed in the upgrade report?.

@waldekmastykarz
Copy link
Member Author

Yes, this is a known issue where we don't pick up all @microsoft packages in the upgrade process. We have a number of issues created to change this behavior but at the moment we look only at the standard packages that are referenced when you create a project so whatever else you add yourself, that's not included in the report.

I hope we'll have this behavior changed soon because, like you noticed, it leads to broken projects - something we'd want people to avoid.

@waldekmastykarz
Copy link
Member Author

Closing due to lack of activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants