Skip to content

Commit

Permalink
Update to Yarn 4
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettjstevens committed Mar 12, 2024
1 parent ca85128 commit f09e176
Show file tree
Hide file tree
Showing 11 changed files with 8,566 additions and 9,160 deletions.
52 changes: 0 additions & 52 deletions .yarn/plugins/@yarnpkg/plugin-constraints.cjs

This file was deleted.

9 changes: 0 additions & 9 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

This file was deleted.

550 changes: 0 additions & 550 deletions .yarn/plugins/@yarnpkg/plugin-version.cjs

This file was deleted.

28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

874 changes: 0 additions & 874 deletions .yarn/releases/yarn-3.6.4.cjs

This file was deleted.

893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.1.0.cjs

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
enableConstraintsChecks: true

packageExtensions:
"@jbrowse/core@*":
peerDependencies:
Expand All @@ -23,20 +25,10 @@ packageExtensions:
react-dom: "*"
mocha@*:
dependencies:
ts-node: "*"
source-map-support: "*"
ts-node: "*"
mongoose-id-validator@*:
peerDependencies:
mongoose: "*"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"
- path: .yarn/plugins/@yarnpkg/plugin-constraints.cjs
spec: "@yarnpkg/plugin-constraints"

yarnPath: .yarn/releases/yarn-3.6.4.cjs
yarnPath: .yarn/releases/yarn-4.1.0.cjs
9 changes: 0 additions & 9 deletions constraints.pro

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "apollo3",
"description": "Monorepo containing Apollo front and back end code",
"packageManager": "yarn@3.6.4",
"packageManager": "yarn@4.1.0",
"workspaces": [
"packages/*"
],
Expand All @@ -17,6 +17,7 @@
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@yarnpkg/types": "^4.0.0",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.8.0",
"eslint-import-resolver-typescript": "^3.5.5",
Expand Down
32 changes: 32 additions & 0 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// @ts-check

/** @type {import('@yarnpkg/types')} */
const { defineConfig } = require('@yarnpkg/types')

/**
* This rule will enforce that a workspace MUST depend on the same version of
* a dependency as the one used by the other workspaces.
* Copied from {@link https://yarnpkg.com/features/constraints}.
*
*
* @param {import('@yarnpkg/types').Yarn.Constraints.Context} context
*/
function enforceConsistentDependenciesAcrossTheProject({ Yarn }) {
for (const dependency of Yarn.dependencies()) {
if (dependency.type === 'peerDependencies') continue

for (const otherDependency of Yarn.dependencies({
ident: dependency.ident,
})) {
if (otherDependency.type === 'peerDependencies') continue

dependency.update(otherDependency.range)
}
}
}

module.exports = defineConfig({
constraints: async (ctx) => {
enforceConsistentDependenciesAcrossTheProject(ctx)
},
})
Loading

0 comments on commit f09e176

Please sign in to comment.