Skip to content

Commit

Permalink
chore: upgrade FE deps: @popperjs/core, classnames, monaco (#6638)
Browse files Browse the repository at this point in the history
  • Loading branch information
adidahiya authored Jan 9, 2024
1 parent bb28b76 commit 46a34ca
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 30 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
- restore_cache: *restore-node-modules-cache
- run: sudo corepack enable
- run: yarn install --immutable
- run: yarn constraints
- save_cache: *save-node-modules-cache
- save_cache: *save-yarn-cache
- persist_to_workspace:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@types/react-transition-group": "~4.4.10",
"@types/sinon": "~17.0.2",
"@types/yargs": "~17.0.32",
"@yarnpkg/types": "^4.0.0",
"chai": "^5.0.0",
"dedent": "^1.5.1",
"eslint": "^8.56.0",
Expand All @@ -56,7 +57,7 @@
"npm-run-all": "^4.1.5",
"nx": "^17.2.8",
"octokit": "^3.1.2",
"prettier": "~3.1.1",
"prettier": "^3.1.1",
"sinon": "^17.0.1",
"stylelint": "~14.16.1",
"stylelint-config-palantir": "^6.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"dependencies": {
"@blueprintjs/colors": "workspace:^",
"@blueprintjs/icons": "workspace:^",
"@popperjs/core": "^2.11.7",
"@popperjs/core": "^2.11.8",
"classnames": "^2.3.1",
"normalize.css": "^8.0.1",
"react-popper": "^2.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/datetime2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@blueprintjs/icons": "workspace:^",
"classnames": "^2.3.1",
"date-fns": "^2.28.0",
"react-day-picker": "^8.5.1",
"react-day-picker": "^8.10.0",
"react-innertext": "^1.1.5",
"tslib": "~2.6.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/docs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"dedent": "^1.5.1",
"downloadjs": "^1.4.7",
"lodash": "^4.17.21",
"moment": "^2.29.4",
"monaco-editor": "^0.44.0",
"moment": "^2.30.1",
"monaco-editor": "^0.45.0",
"normalize.css": "^8.0.1",
"popper.js": "^1.16.1",
"react": "^16.14.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/monaco-editor-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"dependencies": {
"@blueprintjs/colors": "workspace:^",
"monaco-editor": "^0.44.0"
"monaco-editor": "^0.45.0"
},
"devDependencies": {
"@blueprintjs/node-build-scripts": "workspace:^",
Expand Down
75 changes: 75 additions & 0 deletions yarn.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* (c) Copyright 2024 Palantir Technologies Inc. All rights reserved.
*/

// @ts-check

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

/**
* @typedef {import("@yarnpkg/types").Yarn.Constraints.Context} Context
*/

/**
* Packages which we need to ensure the declared version range is fixed for backwards-compatibility.
*/
const FIXED_DEPENDENCY_RANGES = {
// newer versions of classnames require esModuleInterop, see https://github.com/palantir/blueprint/pull/5687
classnames: "^2.3.1",
// 2.29.0+ has some potential bundle size regressions, and we are due to upgrade to 3.0 soon anyway
"date-fns": "^2.28.0",
};

/**
* Packages which are allowed to exist as dependencies of various packages with different version ranges.
*/
const EXCLUDED_FROM_CONSISTENCY_CHECK = new Set([
// we support multiple versions of react-day-picker: v7 in datetime and v8 in datetime2
"react-day-picker",
// tooling packages declare a wider dependency range in 'dependencies' & 'peerDependencies' than our local 'devDependencies'
"typescript",
...Object.keys(FIXED_DEPENDENCY_RANGES),
]);

function enforceSpecificDependencyRanges({ Yarn }) {
for (const [ident, range] of Object.entries(FIXED_DEPENDENCY_RANGES)) {
for (const dependency of Yarn.dependencies({ ident })) {
dependency.update(range);
}
}
}

/**
* This rule will enforce that a workspace MUST depend on the same version of
* a dependency as the one used by the other workspaces.
*
* @see https://yarnpkg.com/features/constraints#restrict-dependencies-between-workspaces
* @param {Context} context
*/
function enforceConsistentDependenciesAcrossTheProject({ Yarn }) {
for (const dependency of Yarn.dependencies()) {
if (EXCLUDED_FROM_CONSISTENCY_CHECK.has(dependency.ident)) {
continue;
}

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({
async constraints(ctx) {
enforceSpecificDependencyRanges(ctx);
enforceConsistentDependenciesAcrossTheProject(ctx);
},
});
58 changes: 34 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ __metadata:
"@blueprintjs/karma-build-scripts": "workspace:^"
"@blueprintjs/node-build-scripts": "workspace:^"
"@blueprintjs/test-commons": "workspace:^"
"@popperjs/core": "npm:^2.11.7"
"@popperjs/core": "npm:^2.11.8"
"@testing-library/react": "npm:^12.1.5"
classnames: "npm:^2.3.1"
enzyme: "npm:^3.11.0"
Expand Down Expand Up @@ -501,7 +501,7 @@ __metadata:
mocha: "npm:^10.2.0"
npm-run-all: "npm:^4.1.5"
react: "npm:^16.14.0"
react-day-picker: "npm:^8.5.1"
react-day-picker: "npm:^8.10.0"
react-dom: "npm:^16.14.0"
react-innertext: "npm:^1.1.5"
tslib: "npm:~2.6.2"
Expand Down Expand Up @@ -608,8 +608,8 @@ __metadata:
dedent: "npm:^1.5.1"
downloadjs: "npm:^1.4.7"
lodash: "npm:^4.17.21"
moment: "npm:^2.29.4"
monaco-editor: "npm:^0.44.0"
moment: "npm:^2.30.1"
monaco-editor: "npm:^0.45.0"
monaco-editor-webpack-plugin: "npm:^7.1.0"
normalize.css: "npm:^8.0.1"
npm-run-all: "npm:^4.1.5"
Expand Down Expand Up @@ -783,7 +783,7 @@ __metadata:
dependencies:
"@blueprintjs/colors": "workspace:^"
"@blueprintjs/node-build-scripts": "workspace:^"
monaco-editor: "npm:^0.44.0"
monaco-editor: "npm:^0.45.0"
npm-run-all: "npm:^4.1.5"
typescript: "npm:~5.3.3"
languageName: unknown
Expand Down Expand Up @@ -874,6 +874,7 @@ __metadata:
"@types/react-transition-group": "npm:~4.4.10"
"@types/sinon": "npm:~17.0.2"
"@types/yargs": "npm:~17.0.32"
"@yarnpkg/types": "npm:^4.0.0"
chai: "npm:^5.0.0"
dedent: "npm:^1.5.1"
eslint: "npm:^8.56.0"
Expand All @@ -884,7 +885,7 @@ __metadata:
npm-run-all: "npm:^4.1.5"
nx: "npm:^17.2.8"
octokit: "npm:^3.1.2"
prettier: "npm:~3.1.1"
prettier: "npm:^3.1.1"
sinon: "npm:^17.0.1"
stylelint: "npm:~14.16.1"
stylelint-config-palantir: "npm:^6.0.1"
Expand Down Expand Up @@ -2255,7 +2256,7 @@ __metadata:
languageName: node
linkType: hard

"@popperjs/core@npm:^2.11.7":
"@popperjs/core@npm:^2.11.8":
version: 2.11.8
resolution: "@popperjs/core@npm:2.11.8"
checksum: 4681e682abc006d25eb380d0cf3efc7557043f53b6aea7a5057d0d1e7df849a00e281cd8ea79c902a35a414d7919621fc2ba293ecec05f413598e0b23d5a1e63
Expand Down Expand Up @@ -3571,6 +3572,15 @@ __metadata:
languageName: node
linkType: hard

"@yarnpkg/types@npm:^4.0.0":
version: 4.0.0
resolution: "@yarnpkg/types@npm:4.0.0"
dependencies:
tslib: "npm:^2.4.0"
checksum: 41f67a4aa5c414c1e228f51453451fa15e0dd70c5cf2b1ae1ca142a3f018f25e4a37e60372cd0f5970c755e1804a2e31e208bff427add1cf13f899b0b9adc1e0
languageName: node
linkType: hard

"@zkochan/js-yaml@npm:0.0.6":
version: 0.0.6
resolution: "@zkochan/js-yaml@npm:0.0.6"
Expand Down Expand Up @@ -5116,9 +5126,9 @@ __metadata:
linkType: hard

"classnames@npm:^2.3.1":
version: 2.3.2
resolution: "classnames@npm:2.3.2"
checksum: cd50ead57b4f97436aaa9f9885c6926323efc7c2bea8e3d4eb10e4e972aa6a1cfca1c7a0e06f8a199ca7498d4339e30bb6002e589e61c9f21248cbf3e8b0b18d
version: 2.5.1
resolution: "classnames@npm:2.5.1"
checksum: afff4f77e62cea2d79c39962980bf316bacb0d7c49e13a21adaadb9221e1c6b9d3cdb829d8bb1b23c406f4e740507f37e1dcf506f7e3b7113d17c5bab787aa69
languageName: node
linkType: hard

Expand Down Expand Up @@ -11543,10 +11553,10 @@ __metadata:
languageName: node
linkType: hard

"moment@npm:^2.29.4":
version: 2.29.4
resolution: "moment@npm:2.29.4"
checksum: 844c6f3ce42862ac9467c8ca4f5e48a00750078682cc5bda1bc0e50cc7ca88e2115a0f932d65a06e4a90e26cb78892be9b3ca3dd6546ca2c4d994cebb787fc2b
"moment@npm:^2.30.1":
version: 2.30.1
resolution: "moment@npm:2.30.1"
checksum: 865e4279418c6de666fca7786607705fd0189d8a7b7624e2e56be99290ac846f90878a6f602e34b4e0455c549b85385b1baf9966845962b313699e7cb847543a
languageName: node
linkType: hard

Expand All @@ -11562,10 +11572,10 @@ __metadata:
languageName: node
linkType: hard

"monaco-editor@npm:^0.44.0":
version: 0.44.0
resolution: "monaco-editor@npm:0.44.0"
checksum: 22676f597f702763c33dcdec8b5d6d1c3a5e1a52910074c46a6477ac9c8308cec2dede968230fb9b69fc91f4fc4687cff8bbe0f2365ece49ded9b248a7dcbc62
"monaco-editor@npm:^0.45.0":
version: 0.45.0
resolution: "monaco-editor@npm:0.45.0"
checksum: 77b1522dbbf06b582f143a7be22f48ad82e5cade3f22c26fc19086446e473c720b2147f8a1ac6edf2172abf5d6bc92a5e858f62fb60df8617f8532f1fa1119ab
languageName: node
linkType: hard

Expand Down Expand Up @@ -13396,7 +13406,7 @@ __metadata:
languageName: node
linkType: hard

"prettier@npm:^3.1.1, prettier@npm:~3.1.1":
"prettier@npm:^3.1.1":
version: 3.1.1
resolution: "prettier@npm:3.1.1"
bin:
Expand Down Expand Up @@ -13691,13 +13701,13 @@ __metadata:
languageName: node
linkType: hard

"react-day-picker@npm:^8.5.1":
version: 8.9.1
resolution: "react-day-picker@npm:8.9.1"
"react-day-picker@npm:^8.10.0":
version: 8.10.0
resolution: "react-day-picker@npm:8.10.0"
peerDependencies:
date-fns: ^2.28.0
date-fns: ^2.28.0 || ^3.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0
checksum: 5766adaaeed0b73c94f2002c8b8ece7262c89c165d69e7a89131ff14f6bae108d6787d1b21f3df48fa5b405e4886cf207daf81488d5cd10b8b6942f39cc477e2
checksum: e9868aced1e40b4cb7d6cf8d50e250226b38ec7ebea944b65aa9db20a0f36d0581b8a501297d09dcbf2d812de852168952b3fb27990915381629d6e314c2a4d8
languageName: node
linkType: hard

Expand Down

1 comment on commit 46a34ca

@adidahiya
Copy link
Contributor Author

Choose a reason for hiding this comment

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

chore: upgrade FE deps: @popperjs/core, classnames, monaco (#6638)

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

Please sign in to comment.