-
Notifications
You must be signed in to change notification settings - Fork 13
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
Erroneous build config causes Presentation failure on updating packages in use #225
Comments
Since the Slack listing of recovery procedures will go out of visibility by date, for later needs I'm reproducing it here. The following presumes you are working in the monorepo, where the sanity-astro package is compiled as part of the app.
|
I've added this clarifying section, as it was bothering me further, as to:
Looking into those situations, and looking again at the packages/sanity-astro/package.json, then:
Thus, it's apparent the structure of dependencies isn't done in understanding, and should be much revised.
All right. That's complicated enough, but as simple as I can see to state it. The practice for React/react-dom may be the source of the confused configuration that has mixed in many improper peerDependencies may have been the idea that what's done for React ought to be standard practice. Some of what I've read hints the pnpm may be particularly bad about handling mixed versions in peerDependencies. The note about .npmrc directives like Rather than use a PR, I'll attach a suggested package.json for packages/sanity-astro here: The answer to my question as to why package management tools skip this whole area, I think shows in the notes above:
|
** Note on the update*
The description here is long, including the demanding rollback procedure if the error occurs, and I still had my own questions as to what the full picture was.
Thus I've worked out a description of what appears to be proper practice to clear up sanity-astro's problems (and for other packages' peerDependency handling??), and added it as a comment below, with a corrected package.json attached.
Describe the bug
In #2150 against @sanity/visual-editing, you can find a trail of woe where Presentation ceased to function in Astro, on a previous update of that package. Possibly 2.7.1 may be the breakage point..
However, with the improved package's version 2.8.0, the fix didn't get implemented so that Netlify or Vercel deployments would be repaired for Presentaion, when normally updating with sanity-astro, A contorted list of procedures has been found necessary to get the fix actually to operate in deployments. The apparent reason is in the mixture of config in the @sanity /astro package, which needs to be repaired, as will be described h ere.
To Reproduce
Presumption here is that you are building an app within the monorepo framework provided with the @sanity/astro package. It seems likely that the same error can occur when simply installing the @sanity/astro package in a different project framework.
Expected behavior
Any of the described builds should have employed the @sanity/[email protected] fix, and run Presentation properly.
Screenshots
These are available for the failure mode, and the final fix running to be described here, in #2150.
Which versions of Sanity are you using?
All up-to-date, at the points described for failure and fix
What operating system are you using?
Windows 11 very up-to-date, in development mode for local builds due to links
Which versions of Node.js / npm are you running?
$ npm -v && node -v
10.2.4
v20.11.1
Additional context
The error in config has been located and demonstrated to fix Presentation with @sanity/[email protected], on all three deployment platforms: Netlify, Vercel, and Node locally. Description follows.
auto-install-peers
, which will cause the old version 2.7.1 of visual-editing to be installed along with the 2.8.0 set by ncu -u or manual package.json editing which does not notice the bogus peerDependency.As a first fix, the
auto-install-peers
was left alone in .npmrc, in case it had other purposes, and only the improper peerDependency on @sanity/visual-editing was removed from package.json in the monorepo packages/sanity-astro/package.json.All of this is clearly a rather fraught procedure, thus it's suggested that a full fix be done on @sanity/astro, especially as there have been other such configuration errors which have caused great effort in the past.
auto-install-peers
command should be removed.For any investigation uses, there are branches listed on a fork of @sanity/astro for each of the Netlify, Vercel, and Node deployments at success and showing some steps leading from fail to success, noted in the comment flow of sanity-io/visual-editing#2150.
The text was updated successfully, but these errors were encountered: