Skip to content

fix: mark database drivers as optional peer dependencies - #12484

Merged
sushantdhiman merged 1 commit into
sequelize:v6from
DRoet:fix/yarn-pnp
Jul 11, 2020
Merged

sushantdhiman merged 1 commit into
sequelize:v6from
DRoet:fix/yarn-pnp

Conversation

@DRoet

@DRoet DRoet commented Jul 10, 2020

Copy link
Copy Markdown
Contributor

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

When using yarn 2 and PnP, it will throw an error because sequelize is trying to access the database drivers without listing them as direct dependencies/peerDependencies in package.json

(node:13140) [MODULE_NOT_FOUND] Error: sequelize tried to access mysql2, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Since we don't want to list them as direct dependencies, we can fix this error by listing all the database drivers as optional peer dependencies using the new peerDependenciesMeta field.

@codecov

codecov Bot commented Jul 10, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #12484 into v6 will increase coverage by 0.49%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##               v6   #12484      +/-   ##
==========================================
+ Coverage   95.95%   96.45%   +0.49%     
==========================================
  Files          92       95       +3     
  Lines        8951     9155     +204     
==========================================
+ Hits         8589     8830     +241     
+ Misses        362      325      -37     
Impacted Files Coverage Δ
lib/dialects/mariadb/connection-manager.js 100.00% <0.00%> (ø)
lib/dialects/mariadb/index.js 100.00% <0.00%> (ø)
lib/dialects/mariadb/query.js 87.96% <0.00%> (ø)
lib/sequelize.js 95.87% <0.00%> (+0.63%) ⬆️
lib/dialects/postgres/connection-manager.js 95.80% <0.00%> (+1.39%) ⬆️
lib/dialects/abstract/query-interface.js 94.08% <0.00%> (+1.86%) ⬆️
lib/dialects/mariadb/data-types.js 100.00% <0.00%> (+52.63%) ⬆️
lib/dialects/mariadb/query-generator.js 100.00% <0.00%> (+81.25%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 45d9c22...34c0dfc. Read the comment docs.

@sushantdhiman sushantdhiman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, needs a PR to master first

@DRoet

DRoet commented Jul 11, 2020

Copy link
Copy Markdown
Contributor Author

@sushantdhiman see #12494

@sushantdhiman
sushantdhiman merged commit ec2af0d into sequelize:v6 Jul 11, 2020
@DRoet
DRoet deleted the fix/yarn-pnp branch July 11, 2020 14:19
@sushantdhiman

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 6.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

jctaveras pushed a commit to jctaveras/sequelize that referenced this pull request Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants