-
Notifications
You must be signed in to change notification settings - Fork 137
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
dependencySatisfies("ember-source", ...)
is "broken"
#1169
Comments
I did consider this, but decided it's a bug fix. Addons that try to use dependencySatisfies without a peer dependency were already unreliable -- this makes their failure predictable instead of sporadic.
The embroider RFC says explicitly that dependencySatisfies only resolves "allowed dependencies" and defines "allowed dependencies" of an addon to be only dependencies and peerDependencies, so this was the original intended behavior. I agree that the whole package management space with peerDependencies is painful. NPM and yarn both get peerDeps wrong in several situations. But we are committed to following node_modules resolution mostly because of typescript -- it cannot easily be taught a different resolution strategy. And we're committed to making |
Just to be clear, I am specifically referring to ember-source in ember addons only, but if that’s been considered already then it’s all good (we should update the blueprint though. |
So alas I don't think it's as simple as you're saying @ef4 😞 the example that I've come across is this one: https://github.com/embroider-build/embroider/blob/main/packages/util/addon/ember-private-api.js#L9-L19 and it caused our app to explode (in dev) because we're using deprecation-workflow and we have global Ember access configured to throw. I'm not entirely sure what is making use of the |
@mansona what is the |
@mansona I can almost guarantee this is yarn or NPM giving you an incorrect node_modules that doesn't respect peerDependencies. For monorepos, we have had success switching to pnpm because it can be told to do them correctly (using dependenciesMeta.*.injected). |
You can try running |
I also had the same issue because of using different versions of core, utils etc. Especially because i had an overwrite/resolution on core to fix an issue with babel. Setting the Overwrite/resolution for others also to 1.6.0 fixed my issues |
I'm running into this as well with a monorepo that has workspaces with different versions of
be changed to the following since we want to be evaluating the dependencies as the let us = state.packageCache.ownerOfFile(state.packageCache.appRoot); Making this change fixes things for me, but I'm not sure what the original reason for using |
No, it's quite important that it's checking relative to the file that is asking. The bottom line here is that your monorepo is really truly giving the file in question access to the wrong copy of ember-source. |
Can you explain more about what is broken about it? Is this an issue with Yarn 1 itself or how I have it configured? |
With yarn itself. And NPM. The only client I've seen that gets it correct currently in pnpm. The problem is this: assume
A peer dependency is supposed to mean that You can work around these problems in yarn 1 by using the The above assumes that |
Thank you for the detailed explanation, that makes sense. I was able to get things working by {
"nohoist": [
"appOne/@embroider/*",
"appOne/@ember/*",
"appOne/@glimmer/*",
"appOne/ember-*"
]
} |
in order to avoid ember-source `peerDependency` being hoisted to the root node_modules, which causes unreliable imports in embroider. see: embroider-build/embroider#1169 (comment) Also: - [Breaking] Drop Node@12 support due to `pnpm` requires it - Use slightly dated [email protected], since in the later version there are issues with `--frozen-lockfile` installations
in order to avoid ember-source `peerDependency` being hoisted to the root node_modules, which causes unreliable imports in embroider. see: embroider-build/embroider#1169 (comment) Also: - [Breaking] Drop Node@12 support due to `pnpm` requires it - Use slightly dated [email protected], since in the later version there are issues with `--frozen-lockfile` installations
in order to avoid ember-source `peerDependency` being hoisted to the root node_modules, which causes unreliable imports in embroider. see: embroider-build/embroider#1169 (comment) Also: - [Breaking] Drop Node@12 support due to `pnpm` requires it - Use slightly dated [email protected], since in the later version there are issues with `--frozen-lockfile` installations
Without this, the `dependencyStatisfies` embroider macro won't work - see embroider-build/embroider#1169 (comment) for details.
Without this, the `dependencyStatisfies` embroider macro won't work - see embroider-build/embroider#1169 (comment) for details.
Without this, the `dependencyStatisfies` embroider macro won't work - see embroider-build/embroider#1169 (comment) for details.
Without this, the `dependencyStatisfies` embroider macro won't work - see embroider-build/embroider#1169 (comment) for details.
Without this, the `dependencyStatisfies` embroider macro won't work - see embroider-build/embroider#1169 (comment) for details.
Without this, the `dependencyStatisfies` embroider macro won't work - see embroider-build/embroider#1169 (comment) for details.
Without this, the `dependencyStatisfies` embroider macro won't work - see embroider-build/embroider#1169 (comment) for details.
# [12.10.0](v12.9.0...v12.10.0) (2024-03-06) ### Bug Fixes * add optional peer dep on ember data ([033cb84](033cb84)), closes [/github.com/embroider-build/embroider/issues/1169#issuecomment-1081943925](https://github.com//github.com/embroider-build/embroider/issues/1169/issues/issuecomment-1081943925) * **cf-field-radio:** hide reset button if form is disabled ([#2635](#2635)) ([c96a8ae](c96a8ae)) * **cfb-slug-input:** correct scheduleOnce call ([0111c9e](0111c9e)) * **copy-form:** remove unnecessary attributes ([8d5cbb6](8d5cbb6)) * **copy-modal:** remove form id for proper slug validation ([fb8f806](fb8f806)) * incorporate review feedback ([8289bbd](8289bbd)) * remove flakey test ([#2642](#2642)) ([34859e1](34859e1)) ### Features * copy forms ([06ce87f](06ce87f)) * **form:** add method to refresh the answer of a field ([78fd9b5](78fd9b5)) * **form:** add widget override for number separator ([69419b4](69419b4)) * **form:** always fetch answer meta ([2255a80](2255a80))
It seems like #1070 broke all the
dependencySatisfies("ember-source", ...)
in the wild. Just wanted to confirm this is intentional (for "ember-source" specifically)."ember-source" is a defacto peer dependency for all Ember add-ons for somewhat obvious reasons. It maybe fine to start encouraging add-ons to explicitly add that peer dependency going forward, though I don't think that's been discussed much and I vaguely remember there are some problems associated with that (?).
In any case, almost none of the add-ons do this today, so if this is something we want we should add it to the addon blueprint. In the meantime, should we (I think we should?) special case this and treat
"keywords": ["ember-addon"]
to be the same as"peerDependencies": { "ember-source": "*" }
?The text was updated successfully, but these errors were encountered: