From b281db00be786c9d02f0ad97617ac680bccae3d6 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Wed, 17 Feb 2021 09:42:28 +0100 Subject: [PATCH 1/2] Create Block: Fix issue with processing unrelated engines --- package-lock.json | 71 +++++++++++++++++++++++------- packages/README.md | 2 +- packages/create-block/CHANGELOG.md | 4 ++ packages/create-block/package.json | 2 +- packages/scripts/CHANGELOG.md | 1 + packages/scripts/package.json | 2 +- 6 files changed, 62 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 41f88297f1aae..e470021d87199 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12015,7 +12015,7 @@ "requires": { "@wordpress/lazy-import": "file:packages/lazy-import", "chalk": "^4.0.0", - "check-node-version": "^3.1.1", + "check-node-version": "^4.1.0", "commander": "^4.1.0", "execa": "^4.0.2", "fast-glob": "^2.2.7", @@ -12783,7 +12783,7 @@ "babel-jest": "^26.6.3", "babel-loader": "^8.1.0", "chalk": "^4.0.0", - "check-node-version": "^3.1.1", + "check-node-version": "^4.1.0", "clean-webpack-plugin": "^3.0.0", "cross-spawn": "^5.1.0", "css-loader": "^3.5.2", @@ -23752,36 +23752,73 @@ "dev": true }, "check-node-version": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-3.2.0.tgz", - "integrity": "sha512-mJu4dADRf+NUeOyGgFTXaLtjyyffD3Eej2RA9IEk1CdHmoVurErLD++e/Ps6uKfsB273ky+0Z9NlOiuplxuNdw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/check-node-version/-/check-node-version-4.1.0.tgz", + "integrity": "sha512-TSXGsyfW5/xY2QseuJn8/hleO2AU7HxVCdkc900jp1vcfzF840GkjvRT7CHl8sRtWn23n3X3k0cwH9RXeRwhfw==", "dev": true, "requires": { - "chalk": "^2.3.0", + "chalk": "^3.0.0", "map-values": "^1.0.1", "minimist": "^1.2.0", "object-filter": "^1.0.2", - "object.assign": "^4.0.4", "run-parallel": "^1.1.4", - "semver": "^5.0.3" + "semver": "^6.3.0" }, "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" } }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } } } }, diff --git a/packages/README.md b/packages/README.md index e35768dfeb611..b1822eecd1bfa 100644 --- a/packages/README.md +++ b/packages/README.md @@ -85,7 +85,7 @@ _Example:_ ```diff +++ b/packages/scripts/package.json @@ -43,7 +43,6 @@ - "check-node-version": "^3.1.1", + "check-node-version": "^4.1.0", "cross-spawn": "^5.1.0", "eslint": "^7.1.0", - "jest": "^26.6.3", diff --git a/packages/create-block/CHANGELOG.md b/packages/create-block/CHANGELOG.md index fb99759973b62..8cb4db48ab4e9 100644 --- a/packages/create-block/CHANGELOG.md +++ b/packages/create-block/CHANGELOG.md @@ -10,6 +10,10 @@ - Block scaffolded with `esnext` template is now registered from `block.json` with the `register_block_type_from_metadata` helper ([#28883](https://github.com/WordPress/gutenberg/pull/28883)). +### Bug Fixes + +- Updated `check-node-version` to version `^4.1.0` that no longer processes unrelated engines. + ## 2.0.1 (2021-02-01) ### Bug Fix diff --git a/packages/create-block/package.json b/packages/create-block/package.json index fa6cf43a532fc..cdb3945fa858d 100644 --- a/packages/create-block/package.json +++ b/packages/create-block/package.json @@ -33,7 +33,7 @@ "dependencies": { "@wordpress/lazy-import": "file:../lazy-import", "chalk": "^4.0.0", - "check-node-version": "^3.1.1", + "check-node-version": "^4.1.0", "commander": "^4.1.0", "execa": "^4.0.2", "fast-glob": "^2.2.7", diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index b7c869fe2f0f4..5d3c921dff6ce 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -6,6 +6,7 @@ - Make `check-licenses` command compatible with npm v7 ([#28909](https://github.com/WordPress/gutenberg/pull/28909)). - Add `Python 2.0` to non-GPL compatible OSS licenses allowed for development in `check-licenses` command ([#29968](https://github.com/WordPress/gutenberg/pull/28968)). +- Updated `check-node-version` to version `^4.1.0` that no longer processes unrelated engines with `check-engines` command. ## 13.0.0 (2021-01-21) diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 643368f77dc38..752f1033aa3f7 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -44,7 +44,7 @@ "babel-jest": "^26.6.3", "babel-loader": "^8.1.0", "chalk": "^4.0.0", - "check-node-version": "^3.1.1", + "check-node-version": "^4.1.0", "clean-webpack-plugin": "^3.0.0", "cross-spawn": "^5.1.0", "css-loader": "^3.5.2", From 98a705b5d644c8c05c840928aad14e8e40c0db39 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Wed, 17 Feb 2021 10:21:53 +0100 Subject: [PATCH 2/2] Default `check-engines` command to the `engines` config in `package.json` file of the current project --- packages/create-block/CHANGELOG.md | 2 +- packages/scripts/CHANGELOG.md | 6 +++++- packages/scripts/scripts/check-engines.js | 7 +++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/create-block/CHANGELOG.md b/packages/create-block/CHANGELOG.md index 8cb4db48ab4e9..27a273d018edb 100644 --- a/packages/create-block/CHANGELOG.md +++ b/packages/create-block/CHANGELOG.md @@ -12,7 +12,7 @@ ### Bug Fixes -- Updated `check-node-version` to version `^4.1.0` that no longer processes unrelated engines. +- Updated `check-node-version` to version `^4.1.0` that no longer processes unrelated engines ([#29066](https://github.com/WordPress/gutenberg/pull/29066)). ## 2.0.1 (2021-02-01) diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index 5d3c921dff6ce..2b8875efe6cb0 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -2,11 +2,15 @@ ## Unreleased +### New Features + +- Default `check-engines` command to the `engines` config in `package.json` file of the current project ([#29066](https://github.com/WordPress/gutenberg/pull/29066)). + ### Enhancements - Make `check-licenses` command compatible with npm v7 ([#28909](https://github.com/WordPress/gutenberg/pull/28909)). - Add `Python 2.0` to non-GPL compatible OSS licenses allowed for development in `check-licenses` command ([#29968](https://github.com/WordPress/gutenberg/pull/28968)). -- Updated `check-node-version` to version `^4.1.0` that no longer processes unrelated engines with `check-engines` command. +- Updated `check-node-version` to version `^4.1.0` that no longer processes unrelated engines with `check-engines` command ([#29066](https://github.com/WordPress/gutenberg/pull/29066)). ## 13.0.0 (2021-01-21) diff --git a/packages/scripts/scripts/check-engines.js b/packages/scripts/scripts/check-engines.js index bad2f2a619b65..ef3ddee804370 100644 --- a/packages/scripts/scripts/check-engines.js +++ b/packages/scripts/scripts/check-engines.js @@ -7,7 +7,7 @@ const { sync: resolveBin } = require( 'resolve-bin' ); /** * Internal dependencies */ -const { getArgsFromCLI, hasArgInCLI } = require( '../utils' ); +const { getArgsFromCLI, hasArgInCLI, getPackageProp } = require( '../utils' ); const getConfig = () => { const hasConfig = @@ -19,9 +19,8 @@ const getConfig = () => { if ( hasConfig ) { return []; } - const { - engines: { node, npm }, - } = require( '../package.json' ); + const { node, npm } = + getPackageProp( 'engines' ) || require( '../package.json' ).engines; return [ '--node', node, '--npm', npm ]; };