From 7698852e9074a6c0ae4c577ac0227b3e2acfebae Mon Sep 17 00:00:00 2001 From: zallen <47335686+redallen@users.noreply.github.com> Date: Tue, 24 Mar 2020 13:09:06 -0400 Subject: [PATCH] chore(repo): bump core to 2.70.1 (#3964) * chore(repo): bump core to 2.70.1 * add img alt for cardview demo --- package.json | 4 +- .../react-catalog-view-extension/package.json | 2 +- packages/react-charts/package.json | 2 +- packages/react-core/package.json | 2 +- .../src/demos/CardView/examples/CardView.md | 70 +++++++++---------- packages/react-docs/package.json | 2 +- packages/react-icons/package.json | 2 +- .../react-inline-edit-extension/package.json | 2 +- packages/react-styles/package.json | 2 +- packages/react-table/package.json | 2 +- packages/react-tokens/package.json | 2 +- packages/react-topology/package.json | 2 +- .../react-virtualized-extension/package.json | 2 +- scripts/verifyCoreVersions.js | 34 --------- scripts/verifyPatternflyVersions.js | 70 +++++++++++++++++++ yarn.lock | 8 +-- 16 files changed, 122 insertions(+), 86 deletions(-) delete mode 100644 scripts/verifyCoreVersions.js create mode 100644 scripts/verifyPatternflyVersions.js diff --git a/package.json b/package.json index b65c9341ebc..c4b628ed7e3 100644 --- a/package.json +++ b/package.json @@ -75,8 +75,8 @@ "generate": "yarn plop", "lint:md": "yarn eslint packages --ext md --no-eslintrc --config .eslintrc-md.json --cache", "lint:ts": "node --max-old-space-size=4096 node_modules/.bin/eslint packages --ext js,jsx,ts,tsx --cache", - "lint:versions": "node ./scripts/verifyCoreVersions.js", - "prettier": "node node_modules/.bin/prettier --write \"packages/**/*.{js,ts,tsx}\" \"scripts/**/*.{js,ts,tsx}\"", + "lint:versions": "node scripts/verifyPatternflyVersions.js", + "prettier": "node node_modules/.bin/prettier --write \"packages/**/*.{js,jsx,ts,tsx}\" \"scripts/**/*.{js,jsx,ts,tsx}\"", "serve:docs": "lerna run serve", "serve:integration": "lerna run serve:demo-app", "start": "yarn build && lerna run develop --parallel --stream", diff --git a/packages/react-catalog-view-extension/package.json b/packages/react-catalog-view-extension/package.json index 7d5fab9251a..b4d5e020d5e 100644 --- a/packages/react-catalog-view-extension/package.json +++ b/packages/react-catalog-view-extension/package.json @@ -40,7 +40,7 @@ "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose --source-maps" }, "dependencies": { - "@patternfly/patternfly": "2.68.3", + "@patternfly/patternfly": "2.70.1", "@patternfly/react-core": "^3.149.1", "@patternfly/react-styles": "^3.7.9", "classnames": "^2.2.5", diff --git a/packages/react-charts/package.json b/packages/react-charts/package.json index e49ff4c54f0..6a7eb02e415 100644 --- a/packages/react-charts/package.json +++ b/packages/react-charts/package.json @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/patternfly/patternfly-react#readme", "dependencies": { - "@patternfly/patternfly": "2.68.3", + "@patternfly/patternfly": "2.70.1", "@patternfly/react-styles": "^3.7.9", "@patternfly/react-tokens": "^2.8.9", "hoist-non-react-statics": "^3.3.0", diff --git a/packages/react-core/package.json b/packages/react-core/package.json index 773a86a6de9..ddbf9619432 100644 --- a/packages/react-core/package.json +++ b/packages/react-core/package.json @@ -58,7 +58,7 @@ "@babel/plugin-transform-typescript": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-react": "^7.0.0", - "@patternfly/patternfly": "2.68.3", + "@patternfly/patternfly": "2.70.1", "@types/exenv": "^1.2.0", "@types/jest": "^24.0.11", "@types/react": "^16.4.0", diff --git a/packages/react-core/src/demos/CardView/examples/CardView.md b/packages/react-core/src/demos/CardView/examples/CardView.md index 04e12891f8b..9b53982ae91 100644 --- a/packages/react-core/src/demos/CardView/examples/CardView.md +++ b/packages/react-core/src/demos/CardView/examples/CardView.md @@ -6,40 +6,40 @@ experimentalStage: 'early' import React from 'react'; import { -Avatar, -Brand, -Button, -ButtonVariant, -Card, -CardHead, -CardActions, -CardHeader, -CardBody, -Checkbox, -Dropdown, -DropdownToggle, -DropdownItem, -DropdownSeparator, -DropdownPosition, -DropdownDirection, -Gallery, -GalleryItem, -KebabToggle, -Nav, -NavItem, -NavList, -NavVariants, -Page, -PageHeader, -PageSection, -PageSectionVariants, -PageSidebar, -SkipToContent, -TextContent, -Text, -Toolbar, -ToolbarGroup, -ToolbarItem + Avatar, + Brand, + Button, + ButtonVariant, + Card, + CardHead, + CardActions, + CardHeader, + CardBody, + Checkbox, + Dropdown, + DropdownToggle, + DropdownItem, + DropdownSeparator, + DropdownPosition, + DropdownDirection, + Gallery, + GalleryItem, + KebabToggle, + Nav, + NavItem, + NavList, + NavVariants, + Page, + PageHeader, + PageSection, + PageSectionVariants, + PageSidebar, + SkipToContent, + TextContent, + Text, + Toolbar, + ToolbarGroup, + ToolbarItem } from '@patternfly/react-core'; import accessibleStyles from '@patternfly/react-styles/css/utilities/Accessibility/accessibility'; import spacingStyles from '@patternfly/react-styles/css/utilities/Spacing/spacing'; @@ -720,7 +720,7 @@ class CardViewBasic extends React.Component { - + {`${product.name} pkg.toJSON()); - pkgConfigs.forEach( - ({ name, dependencies = {}, devDependencies = {}, optionalDependencies = {}, peerDependencies = {} }) => { - [ - ...Object.entries(dependencies), - ...Object.entries(devDependencies), - ...Object.entries(optionalDependencies), - ...Object.entries(peerDependencies) - ] - .filter(dep => dep[0] === corePackageName) - .forEach(([, version]) => { - versions.set(version, [...(versions.get(version) || []), name]); - }); - } - ); - if (versions.size > 1) { - console.error(`error: @patternfly/patternfly versions must match for all packages`); - console.error('-'.repeat(10)); - versions.forEach((packagesNames, version) => { - console.error(`v${version}: ${packagesNames.join(', ')}`); - }); - console.error('-'.repeat(10)); - process.exit(1); - } -} -verify(); diff --git a/scripts/verifyPatternflyVersions.js b/scripts/verifyPatternflyVersions.js new file mode 100644 index 00000000000..867dcd952bb --- /dev/null +++ b/scripts/verifyPatternflyVersions.js @@ -0,0 +1,70 @@ +const fs = require('fs'); +const Project = require('@lerna/project'); + +// '@patternfly/patternfly': {'4.0.4': ['@patternfly/react-styles', ...]}, +// '@patternfly/react-core': {'^4.0.3': ['@patternfly/react-docs', ...]] +const patternflyDeps = {}; + +async function accumulateDependencies(package, dependencies) { + if (!dependencies) { + return; + } + Object.entries(dependencies) + .filter(([dep, _version]) => dep.startsWith('@patternfly')) + .forEach(([dep, version]) => { + patternflyDeps[dep] = patternflyDeps[dep] || {}; + patternflyDeps[dep][version] = patternflyDeps[dep][version] || []; + patternflyDeps[dep][version].push(package); + }); +} + +function setDependency(dependencies, package, version) { + if (dependencies[package]) { + dependencies[package] = version; + } +} + +async function verifyPatternflyVersions() { + const packages = (await new Project(__dirname).getPackages()); + + packages.forEach(package => { + accumulateDependencies(package.name, { [package.name]: `^${package.version}` }); + accumulateDependencies(package.name, package.dependencies); + accumulateDependencies(package.name, package.devDependencies); + }); + + let failed = false; + const mismatchedVersions = Object.entries(patternflyDeps) + .filter(([_dep, versions]) => Object.keys(versions).length > 1); + + mismatchedVersions.forEach(([dep, versions]) => { + failed = true; + console.error(`Mismatching versions for ${dep}:`); + Object.entries(versions).forEach(([version, packages]) => console.error(`${version}: ${packages.join(' ')}`)); + }); + + if (process.argv[2] === '--fix') { + mismatchedVersions.forEach(([dep, versions]) => { + const highestVersion = Object.keys(versions).sort().reverse()[0]; + Object.keys(versions) + .filter(version => version !== highestVersion) + .map(version => versions[version]) + .forEach(mismatchedPackages => { + console.log(`Writing ${dep}@${highestVersion}:`); + mismatchedPackages + .map(package => packages.find(p => p.name === package)) + .forEach(package => { + console.log(package.manifestLocation); + setDependency(package.dependencies, dep, highestVersion); + setDependency(package.devDependencies, dep, highestVersion); + package.serialize(); + }); + }); + }); + } else if (failed) { + console.error('\nRun script again with --fix to bump to latest version'); + process.exit(1); + } +} + +verifyPatternflyVersions(); diff --git a/yarn.lock b/yarn.lock index 60da7b90571..4236148da3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3377,10 +3377,10 @@ xmldoc "^1.1.2" yargs "^15.0.2" -"@patternfly/patternfly@2.68.3": - version "2.68.3" - resolved "https://registry.yarnpkg.com/@patternfly/patternfly/-/patternfly-2.68.3.tgz#fd2b8b92618cd9adde714d46f33ae050d7a3d4f0" - integrity sha512-ZsANYyp/AVRaSWAFBnKuoyvVoA1tMT7hh1jHpua0sQYjN4ocuN89MNcNdAJhdawt1Bh+p9OEtDgl4vfKQbJ9RQ== +"@patternfly/patternfly@2.70.1": + version "2.70.1" + resolved "https://registry.yarnpkg.com/@patternfly/patternfly/-/patternfly-2.70.1.tgz#ef5f9b7912313b873d128002152106c1a5f86b42" + integrity sha512-vimiUQRX0SdaxFKOWaFQ9Gcva/cnEWl4R9SNx1837TRBonLTyTKmzuDRuaDF09ximiRQyWB08/WLESJLLrEF+A== "@pieh/friendly-errors-webpack-plugin@1.7.0-chalk-2": version "1.7.0-chalk-2"