From d45bf7a530ba7568436c9d6b1bdd551933101145 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Wed, 23 May 2018 14:37:26 +0200 Subject: [PATCH 1/2] Devtools: Introduce new module with depreacted util --- .eslintrc.js | 20 +++++++++------- blocks/api/registration.js | 2 +- core-blocks/index.js | 2 +- data/persist.js | 2 +- data/test/index.js | 4 ---- docs/reference/deprecated.md | 3 ++- editor/components/image-placeholder/index.js | 2 +- editor/components/rich-text/index.js | 2 +- editor/deprecated.js | 2 +- lib/client-assets.php | 15 +++++++++--- packages/devtools/.npmrc | 1 + packages/devtools/README.md | 13 +++++++++++ packages/devtools/package.json | 23 +++++++++++++++++++ .../devtools/src/index.js | 0 .../devtools/src/test/index.js | 2 +- test/unit/jest.config.json | 2 +- utils/deprecated.js | 22 +++++++++++------- utils/index.js | 1 - webpack.config.js | 1 + 19 files changed, 86 insertions(+), 33 deletions(-) create mode 100644 packages/devtools/.npmrc create mode 100644 packages/devtools/README.md create mode 100644 packages/devtools/package.json rename utils/deprecation.js => packages/devtools/src/index.js (100%) rename utils/test/deprecation.js => packages/devtools/src/test/index.js (97%) diff --git a/.eslintrc.js b/.eslintrc.js index a4884fbb7fde51..521fedaceb2c7d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -46,25 +46,29 @@ module.exports = { selector: 'ImportDeclaration[source.value=/^components$/]', message: 'Use @wordpress/components as import path instead.', }, + { + selector: 'ImportDeclaration[source.value=/^data$/]', + message: 'Use @wordpress/data as import path instead.', + }, { selector: 'ImportDeclaration[source.value=/^date$/]', message: 'Use @wordpress/date as import path instead.', }, { - selector: 'ImportDeclaration[source.value=/^editor$/]', - message: 'Use @wordpress/editor as import path instead.', + selector: 'ImportDeclaration[source.value=/^devtools$/]', + message: 'Use @wordpress/devtools as import path instead.', }, { - selector: 'ImportDeclaration[source.value=/^element$/]', - message: 'Use @wordpress/element as import path instead.', + selector: 'ImportDeclaration[source.value=/^dom$/]', + message: 'Use @wordpress/dom as import path instead.', }, { - selector: 'ImportDeclaration[source.value=/^data$/]', - message: 'Use @wordpress/data as import path instead.', + selector: 'ImportDeclaration[source.value=/^editor$/]', + message: 'Use @wordpress/editor as import path instead.', }, { - selector: 'ImportDeclaration[source.value=/^dom$/]', - message: 'Use @wordpress/dom as import path instead.', + selector: 'ImportDeclaration[source.value=/^element$/]', + message: 'Use @wordpress/element as import path instead.', }, { selector: 'ImportDeclaration[source.value=/^utils$/]', diff --git a/blocks/api/registration.js b/blocks/api/registration.js index 1ce6fb13ac1ae4..b9326c50bd57a3 100644 --- a/blocks/api/registration.js +++ b/blocks/api/registration.js @@ -10,7 +10,7 @@ import { get, set, isFunction, some } from 'lodash'; */ import { applyFilters } from '@wordpress/hooks'; import { select, dispatch } from '@wordpress/data'; -import { deprecated } from '@wordpress/utils'; +import { deprecated } from '@wordpress/devtools'; /** * Defined behavior of a block type. diff --git a/core-blocks/index.js b/core-blocks/index.js index a6c83b08da036f..ae176cff71a934 100644 --- a/core-blocks/index.js +++ b/core-blocks/index.js @@ -6,7 +6,7 @@ import { setDefaultBlockName, setUnknownTypeHandlerName, } from '@wordpress/blocks'; -import { deprecated } from '@wordpress/utils'; +import { deprecated } from '@wordpress/devtools'; /** * Internal dependencies diff --git a/data/persist.js b/data/persist.js index 0a76097173377b..4dfd007e29d8b8 100644 --- a/data/persist.js +++ b/data/persist.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { deprecated } from '@wordpress/utils'; +import { deprecated } from '@wordpress/devtools'; /** * External dependencies diff --git a/data/test/index.js b/data/test/index.js index 7042011e9b006c..d437e81dd790a4 100644 --- a/data/test/index.js +++ b/data/test/index.js @@ -29,10 +29,6 @@ import { toAsyncIterable, } from '../'; -jest.mock( '@wordpress/utils', () => ( { - deprecated: jest.fn(), -} ) ); - // Mock data store to prevent self-initialization, as it needs to be reset // between tests of `registerResolvers` by replacement (new `registerStore`). jest.mock( '../store', () => () => {} ); diff --git a/docs/reference/deprecated.md b/docs/reference/deprecated.md index 5422e71ce22fd0..9c9e10a08fd6e8 100644 --- a/docs/reference/deprecated.md +++ b/docs/reference/deprecated.md @@ -4,6 +4,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo - `wp.data.withRehydratation` has been renamed to `wp.data.withRehydration`. - The `wp.editor.ImagePlaceholder` component is removed. Please use `wp.editor.MediaPlaceholder` instead. + - `wp.utils.deprecated` function removed. Please use `wp.devtools.deprecated` instead. ## 3.1.0 @@ -11,7 +12,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo - `wp.blocks.withEditorSettings` is removed. Please use the data module to access the editor settings `wp.data.select( "core/editor" ).getEditorSettings()`. - All DOM utils in `wp.utils.*` are removed. Please use `wp.dom.*` instead. - `isPrivate: true` has been removed from the Block API. Please use `supports.inserter: false` instead. - - `wp.utils.isExtraSmall` function removed. Please use `wp.viewport.*` instead. + - `wp.utils.isExtraSmall` function removed. Please use `wp.viewport.isExtraSmall` instead. ## 3.0.0 diff --git a/editor/components/image-placeholder/index.js b/editor/components/image-placeholder/index.js index 335f4c21bbe280..27036bf45cd599 100644 --- a/editor/components/image-placeholder/index.js +++ b/editor/components/image-placeholder/index.js @@ -3,7 +3,7 @@ */ import { Component } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { deprecated } from '@wordpress/utils'; +import { deprecated } from '@wordpress/devtools'; /** * Internal dependencies diff --git a/editor/components/rich-text/index.js b/editor/components/rich-text/index.js index b65eb2eabe27fc..a8b6d96214bb78 100644 --- a/editor/components/rich-text/index.js +++ b/editor/components/rich-text/index.js @@ -24,10 +24,10 @@ import { getRectangleFromRange, getScrollContainer, } from '@wordpress/dom'; +import { deprecated } from '@wordpress/devtools'; import { keycodes, createBlobURL, - deprecated, } from '@wordpress/utils'; import { withInstanceId, withSafeTimeout, Slot } from '@wordpress/components'; import { withSelect } from '@wordpress/data'; diff --git a/editor/deprecated.js b/editor/deprecated.js index f1e130c825cbde..45f5b5d5c9036e 100644 --- a/editor/deprecated.js +++ b/editor/deprecated.js @@ -7,7 +7,7 @@ import { forEach } from 'lodash'; * WordPress dependencies */ import { Component } from '@wordpress/element'; -import { deprecated } from '@wordpress/utils'; +import { deprecated } from '@wordpress/devtools'; import { withSelect } from '@wordpress/data'; import { diff --git a/lib/client-assets.php b/lib/client-assets.php index bcb5cebb9f290f..db4876b435234a 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -115,10 +115,17 @@ function gutenberg_register_scripts_and_styles() { ); // Editor Scripts. + wp_register_script( + 'wp-devtools', + gutenberg_url( 'build/devtools/index.js' ), + array(), + filemtime( gutenberg_dir_path() . 'build/devtools/index.js' ), + true + ); wp_register_script( 'wp-data', gutenberg_url( 'build/data/index.js' ), - array( 'wp-element', 'wp-utils', 'wp-is-shallow-equal', 'lodash' ), + array( 'wp-devtools', 'wp-element', 'wp-is-shallow-equal', 'lodash' ), filemtime( gutenberg_dir_path() . 'build/data/index.js' ), true ); @@ -139,7 +146,7 @@ function gutenberg_register_scripts_and_styles() { wp_register_script( 'wp-utils', gutenberg_url( 'build/utils/index.js' ), - array( 'lodash', 'wp-dom' ), + array( 'lodash', 'wp-devtools', 'wp-dom' ), filemtime( gutenberg_dir_path() . 'build/utils/index.js' ), true ); @@ -206,7 +213,7 @@ function gutenberg_register_scripts_and_styles() { wp_register_script( 'wp-blocks', gutenberg_url( 'build/blocks/index.js' ), - array( 'wp-dom', 'wp-element', 'wp-utils', 'wp-hooks', 'wp-i18n', 'shortcode', 'wp-data', 'lodash' ), + array( 'wp-devtools', 'wp-dom', 'wp-element', 'wp-utils', 'wp-hooks', 'wp-i18n', 'shortcode', 'wp-data', 'lodash' ), filemtime( gutenberg_dir_path() . 'build/blocks/index.js' ), true ); @@ -234,6 +241,7 @@ function gutenberg_register_scripts_and_styles() { 'wp-blocks', 'wp-components', 'wp-core-data', + 'wp-devtools', 'wp-element', 'wp-editor', 'wp-i18n', @@ -327,6 +335,7 @@ function gutenberg_register_scripts_and_styles() { 'wp-core-data', 'wp-data', 'wp-date', + 'wp-devtools', 'wp-dom', 'wp-i18n', 'wp-element', diff --git a/packages/devtools/.npmrc b/packages/devtools/.npmrc new file mode 100644 index 00000000000000..43c97e719a5a82 --- /dev/null +++ b/packages/devtools/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/packages/devtools/README.md b/packages/devtools/README.md new file mode 100644 index 00000000000000..8ee4f06e290b22 --- /dev/null +++ b/packages/devtools/README.md @@ -0,0 +1,13 @@ +# @wordpress/devtools + +Devtools module for WordPress. + +## Installation + +Install the module + +```bash +npm install @wordpress/devtools@next --save +``` + +

Code is Poetry.

diff --git a/packages/devtools/package.json b/packages/devtools/package.json new file mode 100644 index 00000000000000..c16740285c9a4c --- /dev/null +++ b/packages/devtools/package.json @@ -0,0 +1,23 @@ +{ + "name": "@wordpress/devtools", + "version": "0.0.1", + "description": "Devtools module for WordPress", + "author": "WordPress", + "license": "GPL-2.0-or-later", + "keywords": [ + "wordpress", + "devtools" + ], + "homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/devtools/README.md", + "repository": { + "type": "git", + "url": "https://github.com/WordPress/gutenberg.git" + }, + "bugs": { + "url": "https://github.com/WordPress/gutenberg/issues" + }, + "main": "src/index.js", + "publishConfig": { + "access": "public" + } +} diff --git a/utils/deprecation.js b/packages/devtools/src/index.js similarity index 100% rename from utils/deprecation.js rename to packages/devtools/src/index.js diff --git a/utils/test/deprecation.js b/packages/devtools/src/test/index.js similarity index 97% rename from utils/test/deprecation.js rename to packages/devtools/src/test/index.js index 56c6f925d76340..e33d0bdbf55717 100644 --- a/utils/test/deprecation.js +++ b/packages/devtools/src/test/index.js @@ -1,7 +1,7 @@ /** * Internal dependencies */ -import { deprecated } from '../deprecation'; +import { deprecated } from '../'; describe( 'deprecated', () => { it( 'should show a deprecation warning', () => { diff --git a/test/unit/jest.config.json b/test/unit/jest.config.json index 01c3d24d6ec60c..3e42575af5bef1 100644 --- a/test/unit/jest.config.json +++ b/test/unit/jest.config.json @@ -6,7 +6,7 @@ ], "moduleNameMapper": { "@wordpress\\/(blocks|components|editor|data|utils|edit-post|viewport|plugins|core-data|core-blocks)$": "$1", - "@wordpress\\/(date|dom|element)$": "packages/$1/src" + "@wordpress\\/(date|dom|devtools|element)$": "packages/$1/src" }, "preset": "@wordpress/jest-preset-default", "setupFiles": [ diff --git a/utils/deprecated.js b/utils/deprecated.js index 7b4b5d3ff9d5c8..6a05cce0fdd06e 100644 --- a/utils/deprecated.js +++ b/utils/deprecated.js @@ -2,14 +2,10 @@ * WordPress dependencies */ import * as dom from '@wordpress/dom'; - -/** - * Internal dependencies - */ -import { deprecated } from './deprecation'; +import { deprecated as originalDeprecated } from '@wordpress/devtools'; const wrapFunction = ( functionName, source = dom ) => ( ...args ) => { - deprecated( 'wp.utils.' + functionName, { + originalDeprecated( 'wp.utils.' + functionName, { version: '3.1', alternative: 'wp.dom.' + functionName, plugin: 'Gutenberg', @@ -41,10 +37,20 @@ export const replace = wrapFunction( 'replace' ); export const replaceTag = wrapFunction( 'replaceTag' ); export const unwrap = wrapFunction( 'unwrap' ); +export function deprecated( ...params ) { + originalDeprecated( 'wp.utils.deprecated', { + version: '3.2', + alternative: 'wp.devtools.deprecated', + plugin: 'Gutenberg', + } ); + + return originalDeprecated( ...params ); +} + export function isExtraSmall() { - deprecated( 'wp.utils.isExtraSmall', { + originalDeprecated( 'wp.utils.isExtraSmall', { version: '3.1', - alternative: 'wp.viewport.*', + alternative: 'wp.viewport.isExtraSmall', plugin: 'Gutenberg', } ); diff --git a/utils/index.js b/utils/index.js index 368c296ee30092..5a46909a6fbf6a 100644 --- a/utils/index.js +++ b/utils/index.js @@ -8,7 +8,6 @@ export { decodeEntities }; export { keycodes }; export * from './blob-cache'; -export * from './deprecation'; export * from './mediaupload'; export * from './terms'; diff --git a/webpack.config.js b/webpack.config.js index ea455672100dc7..12c5764224a862 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -137,6 +137,7 @@ const entryPointNames = [ const gutenbergPackages = [ 'date', + 'devtools', 'dom', 'element', ]; From a93d934e955e2af12553bb037944df05a25fdc65 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Thu, 24 May 2018 09:38:52 +0200 Subject: [PATCH 2/2] Deprecated: Remove devtools to deprecated --- .eslintrc.js | 4 +-- blocks/api/registration.js | 2 +- core-blocks/index.js | 2 +- data/persist.js | 2 +- docs/reference/deprecated.md | 2 +- editor/components/image-placeholder/index.js | 2 +- editor/components/rich-text/index.js | 2 +- editor/deprecated.js | 2 +- lib/client-assets.php | 16 +++++------ packages/{devtools => deprecated}/.npmrc | 0 packages/deprecated/README.md | 28 +++++++++++++++++++ .../{devtools => deprecated}/package.json | 8 +++--- .../{devtools => deprecated}/src/index.js | 2 +- .../src/test/index.js | 2 +- packages/devtools/README.md | 13 --------- test/unit/jest.config.json | 2 +- utils/deprecated.js | 4 +-- webpack.config.js | 4 +-- 18 files changed, 56 insertions(+), 41 deletions(-) rename packages/{devtools => deprecated}/.npmrc (100%) create mode 100644 packages/deprecated/README.md rename packages/{devtools => deprecated}/package.json (75%) rename packages/{devtools => deprecated}/src/index.js (92%) rename packages/{devtools => deprecated}/src/test/index.js (98%) delete mode 100644 packages/devtools/README.md diff --git a/.eslintrc.js b/.eslintrc.js index 521fedaceb2c7d..77c4e0eaa7003c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -55,8 +55,8 @@ module.exports = { message: 'Use @wordpress/date as import path instead.', }, { - selector: 'ImportDeclaration[source.value=/^devtools$/]', - message: 'Use @wordpress/devtools as import path instead.', + selector: 'ImportDeclaration[source.value=/^deprecated/]', + message: 'Use @wordpress/deprecated as import path instead.', }, { selector: 'ImportDeclaration[source.value=/^dom$/]', diff --git a/blocks/api/registration.js b/blocks/api/registration.js index b9326c50bd57a3..b8aecb72dd9a9b 100644 --- a/blocks/api/registration.js +++ b/blocks/api/registration.js @@ -10,7 +10,7 @@ import { get, set, isFunction, some } from 'lodash'; */ import { applyFilters } from '@wordpress/hooks'; import { select, dispatch } from '@wordpress/data'; -import { deprecated } from '@wordpress/devtools'; +import deprecated from '@wordpress/deprecated'; /** * Defined behavior of a block type. diff --git a/core-blocks/index.js b/core-blocks/index.js index ae176cff71a934..75f6b509eed709 100644 --- a/core-blocks/index.js +++ b/core-blocks/index.js @@ -6,7 +6,7 @@ import { setDefaultBlockName, setUnknownTypeHandlerName, } from '@wordpress/blocks'; -import { deprecated } from '@wordpress/devtools'; +import deprecated from '@wordpress/deprecated'; /** * Internal dependencies diff --git a/data/persist.js b/data/persist.js index 4dfd007e29d8b8..63d800f4ee1c1f 100644 --- a/data/persist.js +++ b/data/persist.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { deprecated } from '@wordpress/devtools'; +import deprecated from '@wordpress/deprecated'; /** * External dependencies diff --git a/docs/reference/deprecated.md b/docs/reference/deprecated.md index 9c9e10a08fd6e8..db44a598613ee4 100644 --- a/docs/reference/deprecated.md +++ b/docs/reference/deprecated.md @@ -4,7 +4,7 @@ Gutenberg's deprecation policy is intended to support backwards-compatibility fo - `wp.data.withRehydratation` has been renamed to `wp.data.withRehydration`. - The `wp.editor.ImagePlaceholder` component is removed. Please use `wp.editor.MediaPlaceholder` instead. - - `wp.utils.deprecated` function removed. Please use `wp.devtools.deprecated` instead. + - `wp.utils.deprecated` function removed. Please use `wp.deprecated` instead. ## 3.1.0 diff --git a/editor/components/image-placeholder/index.js b/editor/components/image-placeholder/index.js index 27036bf45cd599..1edf4adf09417f 100644 --- a/editor/components/image-placeholder/index.js +++ b/editor/components/image-placeholder/index.js @@ -3,7 +3,7 @@ */ import { Component } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { deprecated } from '@wordpress/devtools'; +import deprecated from '@wordpress/deprecated'; /** * Internal dependencies diff --git a/editor/components/rich-text/index.js b/editor/components/rich-text/index.js index a8b6d96214bb78..238dae578486bf 100644 --- a/editor/components/rich-text/index.js +++ b/editor/components/rich-text/index.js @@ -24,7 +24,7 @@ import { getRectangleFromRange, getScrollContainer, } from '@wordpress/dom'; -import { deprecated } from '@wordpress/devtools'; +import deprecated from '@wordpress/deprecated'; import { keycodes, createBlobURL, diff --git a/editor/deprecated.js b/editor/deprecated.js index 45f5b5d5c9036e..0135f7c71a66c1 100644 --- a/editor/deprecated.js +++ b/editor/deprecated.js @@ -7,7 +7,7 @@ import { forEach } from 'lodash'; * WordPress dependencies */ import { Component } from '@wordpress/element'; -import { deprecated } from '@wordpress/devtools'; +import deprecated from '@wordpress/deprecated'; import { withSelect } from '@wordpress/data'; import { diff --git a/lib/client-assets.php b/lib/client-assets.php index db4876b435234a..789fe04c211fb3 100644 --- a/lib/client-assets.php +++ b/lib/client-assets.php @@ -116,16 +116,16 @@ function gutenberg_register_scripts_and_styles() { // Editor Scripts. wp_register_script( - 'wp-devtools', - gutenberg_url( 'build/devtools/index.js' ), + 'wp-deprecated', + gutenberg_url( 'build/deprecated/index.js' ), array(), - filemtime( gutenberg_dir_path() . 'build/devtools/index.js' ), + filemtime( gutenberg_dir_path() . 'build/deprecated/index.js' ), true ); wp_register_script( 'wp-data', gutenberg_url( 'build/data/index.js' ), - array( 'wp-devtools', 'wp-element', 'wp-is-shallow-equal', 'lodash' ), + array( 'wp-deprecated', 'wp-element', 'wp-is-shallow-equal', 'lodash' ), filemtime( gutenberg_dir_path() . 'build/data/index.js' ), true ); @@ -146,7 +146,7 @@ function gutenberg_register_scripts_and_styles() { wp_register_script( 'wp-utils', gutenberg_url( 'build/utils/index.js' ), - array( 'lodash', 'wp-devtools', 'wp-dom' ), + array( 'lodash', 'wp-deprecated', 'wp-dom' ), filemtime( gutenberg_dir_path() . 'build/utils/index.js' ), true ); @@ -213,7 +213,7 @@ function gutenberg_register_scripts_and_styles() { wp_register_script( 'wp-blocks', gutenberg_url( 'build/blocks/index.js' ), - array( 'wp-devtools', 'wp-dom', 'wp-element', 'wp-utils', 'wp-hooks', 'wp-i18n', 'shortcode', 'wp-data', 'lodash' ), + array( 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-utils', 'wp-hooks', 'wp-i18n', 'shortcode', 'wp-data', 'lodash' ), filemtime( gutenberg_dir_path() . 'build/blocks/index.js' ), true ); @@ -241,7 +241,7 @@ function gutenberg_register_scripts_and_styles() { 'wp-blocks', 'wp-components', 'wp-core-data', - 'wp-devtools', + 'wp-deprecated', 'wp-element', 'wp-editor', 'wp-i18n', @@ -335,7 +335,7 @@ function gutenberg_register_scripts_and_styles() { 'wp-core-data', 'wp-data', 'wp-date', - 'wp-devtools', + 'wp-deprecated', 'wp-dom', 'wp-i18n', 'wp-element', diff --git a/packages/devtools/.npmrc b/packages/deprecated/.npmrc similarity index 100% rename from packages/devtools/.npmrc rename to packages/deprecated/.npmrc diff --git a/packages/deprecated/README.md b/packages/deprecated/README.md new file mode 100644 index 00000000000000..e00c1276a089a5 --- /dev/null +++ b/packages/deprecated/README.md @@ -0,0 +1,28 @@ +# @wordpress/deprecated + +Logs a message to notify developers about a deprecated feature. + +## Installation + +Install the module + +```bash +npm install @wordpress/deprecated@next --save +``` + +## Usage + +```js +import deprecated from '@wordpress/deprecated'; + +deprecated( 'Eating meat', { + version: 'the future', + alternative: 'vegetables', + plugin: 'the earth', + hint: 'You may find it beneficial to transition gradually.', +} ); + +// Logs: 'Eating meat is deprecated and will be removed from the earth in the future. Please use vegetables instead. Note: You may find it beneficial to transition gradually.' +``` + +

Code is Poetry.

diff --git a/packages/devtools/package.json b/packages/deprecated/package.json similarity index 75% rename from packages/devtools/package.json rename to packages/deprecated/package.json index c16740285c9a4c..3c6db41f30f120 100644 --- a/packages/devtools/package.json +++ b/packages/deprecated/package.json @@ -1,14 +1,14 @@ { - "name": "@wordpress/devtools", + "name": "@wordpress/deprecated", "version": "0.0.1", - "description": "Devtools module for WordPress", + "description": "Deprecation utility for WordPress", "author": "WordPress", "license": "GPL-2.0-or-later", "keywords": [ "wordpress", - "devtools" + "deprecated" ], - "homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/devtools/README.md", + "homepage": "https://github.com/WordPress/gutenberg/tree/master/packages/deprecated/README.md", "repository": { "type": "git", "url": "https://github.com/WordPress/gutenberg.git" diff --git a/packages/devtools/src/index.js b/packages/deprecated/src/index.js similarity index 92% rename from packages/devtools/src/index.js rename to packages/deprecated/src/index.js index 89d9b15ebf397a..e9c5fba2c461ad 100644 --- a/packages/devtools/src/index.js +++ b/packages/deprecated/src/index.js @@ -9,7 +9,7 @@ * @param {?string} options.link Link to documentation * @param {?string} options.hint Additional message to help transition away from the deprecated feature. */ -export function deprecated( feature, { version, alternative, plugin, link, hint } = {} ) { +export default function deprecated( feature, { version, alternative, plugin, link, hint } = {} ) { const pluginMessage = plugin ? ` from ${ plugin }` : ''; const versionMessage = version ? `${ pluginMessage } in ${ version }` : ''; const useInsteadMessage = alternative ? ` Please use ${ alternative } instead.` : ''; diff --git a/packages/devtools/src/test/index.js b/packages/deprecated/src/test/index.js similarity index 98% rename from packages/devtools/src/test/index.js rename to packages/deprecated/src/test/index.js index e33d0bdbf55717..24c3a0550e072f 100644 --- a/packages/devtools/src/test/index.js +++ b/packages/deprecated/src/test/index.js @@ -1,7 +1,7 @@ /** * Internal dependencies */ -import { deprecated } from '../'; +import deprecated from '../'; describe( 'deprecated', () => { it( 'should show a deprecation warning', () => { diff --git a/packages/devtools/README.md b/packages/devtools/README.md deleted file mode 100644 index 8ee4f06e290b22..00000000000000 --- a/packages/devtools/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# @wordpress/devtools - -Devtools module for WordPress. - -## Installation - -Install the module - -```bash -npm install @wordpress/devtools@next --save -``` - -

Code is Poetry.

diff --git a/test/unit/jest.config.json b/test/unit/jest.config.json index 3e42575af5bef1..c4dd16ffc48f0b 100644 --- a/test/unit/jest.config.json +++ b/test/unit/jest.config.json @@ -6,7 +6,7 @@ ], "moduleNameMapper": { "@wordpress\\/(blocks|components|editor|data|utils|edit-post|viewport|plugins|core-data|core-blocks)$": "$1", - "@wordpress\\/(date|dom|devtools|element)$": "packages/$1/src" + "@wordpress\\/(date|dom|deprecated|element)$": "packages/$1/src" }, "preset": "@wordpress/jest-preset-default", "setupFiles": [ diff --git a/utils/deprecated.js b/utils/deprecated.js index 6a05cce0fdd06e..cdc66c5b44eb9c 100644 --- a/utils/deprecated.js +++ b/utils/deprecated.js @@ -2,7 +2,7 @@ * WordPress dependencies */ import * as dom from '@wordpress/dom'; -import { deprecated as originalDeprecated } from '@wordpress/devtools'; +import originalDeprecated from '@wordpress/deprecated'; const wrapFunction = ( functionName, source = dom ) => ( ...args ) => { originalDeprecated( 'wp.utils.' + functionName, { @@ -40,7 +40,7 @@ export const unwrap = wrapFunction( 'unwrap' ); export function deprecated( ...params ) { originalDeprecated( 'wp.utils.deprecated', { version: '3.2', - alternative: 'wp.devtools.deprecated', + alternative: 'wp.deprecated', plugin: 'Gutenberg', } ); diff --git a/webpack.config.js b/webpack.config.js index 12c5764224a862..ec341913629635 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -137,7 +137,7 @@ const entryPointNames = [ const gutenbergPackages = [ 'date', - 'devtools', + 'deprecated', 'dom', 'element', ]; @@ -276,7 +276,7 @@ const config = { return path; }, } ), - new LibraryExportDefaultPlugin( [ 'dom-ready' ].map( camelCaseDash ) ), + new LibraryExportDefaultPlugin( [ 'deprecated', 'dom-ready' ].map( camelCaseDash ) ), ], stats: { children: false,