diff --git a/docs/data/data-core-editor.md b/docs/data/data-core-editor.md index 299ebffa4e9644..4e421f6a51d4f1 100644 --- a/docs/data/data-core-editor.md +++ b/docs/data/data-core-editor.md @@ -1436,3 +1436,4 @@ Returns an action object used in signalling that the editor settings have been u *Parameters* * settings: Updated settings + diff --git a/docs/data/data-core.md b/docs/data/data-core.md index 44430e8261fa70..b232e447f591b8 100644 --- a/docs/data/data-core.md +++ b/docs/data/data-core.md @@ -2,6 +2,68 @@ ## Selectors +### getTerms + +Returns all the available terms for the given taxonomy. + +*Parameters* + + * state: Data state. + * taxonomy: Taxonomy name. + +### getCategories + +Returns all the available categories. + +*Parameters* + + * state: Data state. + +*Returns* + +Categories list. + +### isRequestingTerms + +Returns true if a request is in progress for terms data of a given taxonomy, +or false otherwise. + +*Parameters* + + * state: Data state. + * taxonomy: Taxonomy name. + +*Returns* + +Whether a request is in progress for taxonomy's terms. + +### isRequestingCategories + +Returns true if a request is in progress for categories data, or false +otherwise. + +*Parameters* + + * state: Data state. + +*Returns* + +Whether a request is in progress for categories. + +### isRequestingEmbedPreview + +Returns true if a request is in progress for embed preview data, or false +otherwise. + +*Parameters* + + * state: Data state. + * url: URL the preview would be for. + +*Returns* + +Whether a request is in progress for an embed preview. + ### getAuthors Returns all available authors. @@ -56,6 +118,21 @@ Returns the Entity's record object by key. Record. +### getEntityRecords + +Returns the Entity's records. + +*Parameters* + + * state: State tree + * kind: Entity kind. + * name: Entity name. + * query: Optional terms query. + +*Returns* + +Records. + ### getThemeSupports Return theme supports data in the index. @@ -68,8 +145,48 @@ Return theme supports data in the index. Index data. +### getEmbedPreview + +Returns the embed preview for the given URL. + +*Parameters* + + * state: Data state. + * url: Embedded URL. + +*Returns* + +Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API. + +### isPreviewEmbedFallback + +Determines if the returned preview is an oEmbed link fallback. + +WordPress can be configured to return a simple link to a URL if it is not embeddable. +We need to be able to determine if a URL is embeddable or not, based on what we +get back from the oEmbed preview API. + +*Parameters* + + * state: Data state. + * url: Embedded URL. + +*Returns* + +Is the preview for the URL an oEmbed link fallback. + ## Actions +### receiveTerms + +Returns an action object used in signalling that terms have been received +for a given taxonomy. + +*Parameters* + + * taxonomy: Taxonomy name. + * terms: Terms received. + ### receiveUserQuery Returns an action object used in signalling that authors have been received. @@ -96,6 +213,7 @@ Returns an action object used in signalling that entity records have been receiv * kind: Kind of the received entity. * name: Name of the received entity. * records: Records received. + * query: Query Object. ### receiveThemeSupportsFromIndex @@ -103,4 +221,14 @@ Returns an action object used in signalling that the index has been received. *Parameters* - * index: Index received. \ No newline at end of file + * index: Index received. + +### receiveEmbedPreview + +Returns an action object used in signalling that the preview data for +a given URl has been received. + +*Parameters* + + * url: URL to preview the embed for. + * preview: Preview data. diff --git a/docs/manifest.json b/docs/manifest.json index 8fad33d7258b56..03df48b367fd63 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -59,6 +59,12 @@ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/extensibility/extending-blocks.md", "parent": "extensibility" }, + { + "title": "Extending Editor", + "slug": "extending-editor", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/extensibility/extending-editor.md", + "parent": "extensibility" + }, { "title": "Meta Boxes", "slug": "meta-box", @@ -413,6 +419,12 @@ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/postcss-themes/README.md", "parent": "packages" }, + { + "title": "@wordpress/redux-routine", + "slug": "packages-redux-routine", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/redux-routine/README.md", + "parent": "packages" + }, { "title": "@wordpress/scripts", "slug": "packages-scripts", @@ -455,6 +467,312 @@ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/edit-post/README.md", "parent": "packages" }, + { + "title": "Components Package Reference", + "slug": "components", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components.md", + "parent": null + }, + { + "title": "Autocomplete", + "slug": "autocomplete", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/autocomplete/README.md", + "parent": "components" + }, + { + "title": "BaseControl", + "slug": "base-control", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/base-control/README.md", + "parent": "components" + }, + { + "title": "ButtonGroup", + "slug": "button-group", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/button-group/README.md", + "parent": "components" + }, + { + "title": "Button", + "slug": "button", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/button/README.md", + "parent": "components" + }, + { + "title": "CheckboxControl", + "slug": "checkbox-control", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/checkbox-control/README.md", + "parent": "components" + }, + { + "title": "ClipboardButton", + "slug": "clipboard-button", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/clipboard-button/README.md", + "parent": "components" + }, + { + "title": "ColorIndicator", + "slug": "color-indicator", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/color-indicator/README.md", + "parent": "components" + }, + { + "title": "ColorPalette", + "slug": "color-palette", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/color-palette/README.md", + "parent": "components" + }, + { + "title": "Dashicon", + "slug": "dashicon", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/dashicon/README.md", + "parent": "components" + }, + { + "title": "DateTime", + "slug": "date-time", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/date-time/README.md", + "parent": "components" + }, + { + "title": "Disabled", + "slug": "disabled", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/disabled/README.md", + "parent": "components" + }, + { + "title": "Draggable", + "slug": "draggable", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/draggable/README.md", + "parent": "components" + }, + { + "title": "DropZone", + "slug": "drop-zone", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/drop-zone/README.md", + "parent": "components" + }, + { + "title": "DropdownMenu", + "slug": "dropdown-menu", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/dropdown-menu/README.md", + "parent": "components" + }, + { + "title": "Dropdown", + "slug": "dropdown", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/dropdown/README.md", + "parent": "components" + }, + { + "title": "ExternalLink", + "slug": "external-link", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/external-link/README.md", + "parent": "components" + }, + { + "title": "FocusableIframe", + "slug": "focusable-iframe", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/focusable-iframe/README.md", + "parent": "components" + }, + { + "title": "FontSizePicker", + "slug": "font-size-picker", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/font-size-picker/README.md", + "parent": "components" + }, + { + "title": "FormFileUpload", + "slug": "form-file-upload", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/form-file-upload/README.md", + "parent": "components" + }, + { + "title": "FormToggle", + "slug": "form-toggle", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/form-toggle/README.md", + "parent": "components" + }, + { + "title": "FormTokenField", + "slug": "form-token-field", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/form-token-field/README.md", + "parent": "components" + }, + { + "title": "HigherOrder", + "slug": "higher-order", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/higher-order/README.md", + "parent": "components" + }, + { + "title": "IconButton", + "slug": "icon-button", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/icon-button/README.md", + "parent": "components" + }, + { + "title": "KeyboardShortcuts", + "slug": "keyboard-shortcuts", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/keyboard-shortcuts/README.md", + "parent": "components" + }, + { + "title": "MenuGroup", + "slug": "menu-group", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/menu-group/README.md", + "parent": "components" + }, + { + "title": "MenuItem", + "slug": "menu-item", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/menu-item/README.md", + "parent": "components" + }, + { + "title": "MenuItemsChoice", + "slug": "menu-items-choice", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/menu-items-choice/README.md", + "parent": "components" + }, + { + "title": "Modal", + "slug": "modal", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/modal/README.md", + "parent": "components" + }, + { + "title": "NavigableContainer", + "slug": "navigable-container", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/navigable-container/README.md", + "parent": "components" + }, + { + "title": "Notice", + "slug": "notice", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/notice/README.md", + "parent": "components" + }, + { + "title": "Panel", + "slug": "panel", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/panel/README.md", + "parent": "components" + }, + { + "title": "Placeholder", + "slug": "placeholder", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/placeholder/README.md", + "parent": "components" + }, + { + "title": "Popover", + "slug": "popover", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/popover/README.md", + "parent": "components" + }, + { + "title": "QueryControls", + "slug": "query-controls", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/query-controls/README.md", + "parent": "components" + }, + { + "title": "RadioControl", + "slug": "radio-control", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/radio-control/README.md", + "parent": "components" + }, + { + "title": "RangeControl", + "slug": "range-control", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/range-control/README.md", + "parent": "components" + }, + { + "title": "ResponsiveWrapper", + "slug": "responsive-wrapper", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/responsive-wrapper/README.md", + "parent": "components" + }, + { + "title": "Sandbox", + "slug": "sandbox", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/sandbox/README.md", + "parent": "components" + }, + { + "title": "ScrollLock", + "slug": "scroll-lock", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/scroll-lock/README.md", + "parent": "components" + }, + { + "title": "SelectControl", + "slug": "select-control", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/select-control/README.md", + "parent": "components" + }, + { + "title": "ServerSideRender", + "slug": "server-side-render", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/server-side-render/README.md", + "parent": "components" + }, + { + "title": "SlotFill", + "slug": "slot-fill", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/slot-fill/README.md", + "parent": "components" + }, + { + "title": "Spinner", + "slug": "spinner", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/spinner/README.md", + "parent": "components" + }, + { + "title": "TabPanel", + "slug": "tab-panel", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/tab-panel/README.md", + "parent": "components" + }, + { + "title": "TextControl", + "slug": "text-control", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/text-control/README.md", + "parent": "components" + }, + { + "title": "TextareaControl", + "slug": "textarea-control", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/textarea-control/README.md", + "parent": "components" + }, + { + "title": "ToggleControl", + "slug": "toggle-control", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/toggle-control/README.md", + "parent": "components" + }, + { + "title": "Toolbar", + "slug": "toolbar", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/toolbar/README.md", + "parent": "components" + }, + { + "title": "Tooltip", + "slug": "tooltip", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/tooltip/README.md", + "parent": "components" + }, + { + "title": "TreeSelect", + "slug": "tree-select", + "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/components/src/tree-select/README.md", + "parent": "components" + }, { "title": "Data Package Reference", "slug": "data", @@ -497,4 +815,4 @@ "markdown_source": "https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/data/data-core-viewport.md", "parent": "data" } -] \ No newline at end of file +] diff --git a/docs/root-manifest.json b/docs/root-manifest.json index fe28ba7ea027c5..071972dc2dd68f 100644 --- a/docs/root-manifest.json +++ b/docs/root-manifest.json @@ -214,11 +214,5 @@ "slug": "resources", "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/outreach\/resources.md", "parent": "outreach" - }, - { - "title": "Packages", - "slug": "packages", - "markdown_source": "https:\/\/raw.githubusercontent.com\/WordPress\/gutenberg\/master\/docs\/packages.md", - "parent": null } ] diff --git a/docs/tool/config.js b/docs/tool/config.js index 9b8f28d20b52b7..83c6a5ef0dccc8 100644 --- a/docs/tool/config.js +++ b/docs/tool/config.js @@ -10,14 +10,14 @@ const root = path.resolve( __dirname, '../../' ); const npmReadyPackages = glob( 'packages/*/package.json' ) .map( ( fileName ) => fileName.split( '/' )[ 1 ] ); -// These are internal-only packages (for now), not yet published as standalone -// node modules. +// These are internal-only packages (for now), not yet published as standalone node modules. const gutenbergPackages = [ 'core-blocks', 'edit-post', ]; module.exports = { + componentPaths: glob( 'packages/components/src/*/README.md' ), dataNamespaces: { core: { title: 'WordPress Core Data', diff --git a/docs/tool/index.js b/docs/tool/index.js index 9f6d752dd224ad..f653b8c809ed96 100644 --- a/docs/tool/index.js +++ b/docs/tool/index.js @@ -9,14 +9,17 @@ const fs = require( 'fs' ); const config = require( './config' ); const parser = require( './parser' ); const generator = require( './generator' ); -const getManifest = require( './manifest' ); +const { getPackageManifest, getComponentManifest, getDataManifest } = require( './manifest' ); const parsedModules = parser( config.dataNamespaces ); generator( parsedModules, config.dataDocsOutput ); + const rootManifest = require( config.rootManifest ); -const dataModuleManifest = getManifest( parsedModules, config.packages ); +const packageManifest = getPackageManifest( config.packages ); +const componentManifest = getComponentManifest( config.componentPaths ); +const dataManifest = getDataManifest( parsedModules ); fs.writeFileSync( config.manifestOutput, - JSON.stringify( rootManifest.concat( dataModuleManifest ), undefined, '\t' ) + JSON.stringify( rootManifest.concat( packageManifest, componentManifest, dataManifest ), undefined, '\t' ) ); diff --git a/docs/tool/manifest.js b/docs/tool/manifest.js index 1e5d0520b5108a..f241477c3c00b8 100644 --- a/docs/tool/manifest.js +++ b/docs/tool/manifest.js @@ -1,7 +1,9 @@ /** * Node dependencies */ -const { kebabCase } = require( 'lodash' ); +const { camelCase, kebabCase, upperFirst } = require( 'lodash' ); + +const baseRepoUrl = `https://raw.githubusercontent.com/WordPress/gutenberg/master`; /** * Generates the manifest for the given namespaces. @@ -11,35 +13,65 @@ const { kebabCase } = require( 'lodash' ); * * @return {Array} manifest. */ -module.exports = function( parsedNamespaces, packagesConfig ) { - const dataManifest = [ { - title: 'Data Package Reference', - slug: 'data', - markdown_source: 'https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/data/README.md', - parent: null, - } ].concat( - Object.values( parsedNamespaces ).map( ( parsedNamespace ) => { - const slug = `data-${ kebabCase( parsedNamespace.name ) }`; - return { - title: parsedNamespace.title, - slug, - markdown_source: `https://raw.githubusercontent.com/WordPress/gutenberg/master/docs/data/${ slug }.md`, - parent: 'data', - }; - } ) - ); - - const packagesManifest = Object.entries( packagesConfig ).map( ( [ folderName, config ] ) => { - const path = config.isNpmReady === false ? - `https://raw.githubusercontent.com/WordPress/gutenberg/master/${ folderName }/README.md` : - `https://raw.githubusercontent.com/WordPress/gutenberg/master/packages/${ folderName }/README.md`; - return { - title: `@wordpress/${ folderName }`, - slug: `packages-${ folderName }`, - markdown_source: path, - parent: 'packages', - }; - } ); - - return packagesManifest.concat( dataManifest ); +module.exports = { + getPackageManifest: function( packagesConfig ) { + return [ + { + title: 'Packages', + slug: 'packages', + markdown_source: `${ baseRepoUrl }/docs/packages.md`, + parent: null, + }, + ].concat( + Object.entries( packagesConfig ).map( ( [ folderName, config ] ) => { + const path = config.isNpmReady === false ? + `${ baseRepoUrl }/${ folderName }/README.md` : + `${ baseRepoUrl }/packages/${ folderName }/README.md`; + return { + title: `@wordpress/${ folderName }`, + slug: `packages-${ folderName }`, + markdown_source: path, + parent: 'packages', + }; + } ) + ); + }, + getComponentManifest: function( componentPaths ) { + return [ + { + title: 'Components Package Reference', + slug: 'components', + markdown_source: `${ baseRepoUrl }/packages/components.md`, + parent: null, + }, + ...componentPaths + .map( ( filePath ) => { + const slug = filePath.split( '/' )[ 3 ]; + return { + title: upperFirst( camelCase( slug ) ), + slug, + markdown_source: `${ baseRepoUrl }/${ filePath }`, + parent: 'components', + }; + } ), + ]; + }, + getDataManifest: function( parsedNamespaces ) { + return [ { + title: 'Data Package Reference', + slug: 'data', + markdown_source: `${ baseRepoUrl }/docs/data/README.md`, + parent: null, + } ].concat( + Object.values( parsedNamespaces ).map( ( parsedNamespace ) => { + const slug = `data-${ kebabCase( parsedNamespace.name ) }`; + return { + title: parsedNamespace.title, + slug, + markdown_source: `${ baseRepoUrl }/docs/data/${ slug }.md`, + parent: 'data', + }; + } ) + ); + }, }; diff --git a/package-lock.json b/package-lock.json index cb8b965cd6dccc..124200978d9467 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1750,6 +1750,23 @@ } } }, + "@samverschueren/stream-to-observable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.0.tgz", + "integrity": "sha512-MI4Xx6LHs4Webyvi6EbspgyAb4D2Q2VtnCQ1blOJcoLS6mVa8lNN2rkIy1CVxfTUpoyIbCTkXES1rLXztFD1lg==", + "dev": true, + "requires": { + "any-observable": "^0.3.0" + }, + "dependencies": { + "any-observable": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/any-observable/-/any-observable-0.3.0.tgz", + "integrity": "sha512-/FQM1EDkTsf63Ub2C6O7GuYFDsSXUwsaZDurV0np41ocwq0jthUAYCmhBX9f+KwlaCgIuWyr/4WlUQUBfKfZog==", + "dev": true + } + } + }, "@sindresorhus/is": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", @@ -2774,6 +2791,12 @@ "normalize-path": "^2.1.1" } }, + "app-root-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-2.1.0.tgz", + "integrity": "sha1-mL9lmTJ+zqGZMJhm6BQDaP0uZGo=", + "dev": true + }, "append-transform": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-1.0.0.tgz", @@ -8795,6 +8818,12 @@ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==" }, + "get-own-enumerable-property-symbols": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-2.0.1.tgz", + "integrity": "sha512-TtY/sbOemiMKPRUDDanGCSgBYe7Mf0vbRsWnBZ+9yghpZ1MvcpSpuZFjHdEeY/LZjZy0vdLjS77L6HosisFiug==", + "dev": true + }, "get-pkg-repo": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/get-pkg-repo/-/get-pkg-repo-1.4.0.tgz", @@ -9701,6 +9730,25 @@ "debug": "^3.1.0" } }, + "husky": { + "version": "0.14.3", + "resolved": "https://registry.npmjs.org/husky/-/husky-0.14.3.tgz", + "integrity": "sha512-e21wivqHpstpoiWA/Yi8eFti8E+sQDSS53cpJsPptPs295QTOQR0ZwnHo2TXy1XOpZFD9rPOd3NpmqTK6uMLJA==", + "dev": true, + "requires": { + "is-ci": "^1.0.10", + "normalize-path": "^1.0.0", + "strip-indent": "^2.0.0" + }, + "dependencies": { + "normalize-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-1.0.0.tgz", + "integrity": "sha1-MtDkcvkf80VwHBWoMRAY07CpA3k=", + "dev": true + } + } + }, "iconv-lite": { "version": "0.4.23", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", @@ -12617,6 +12665,187 @@ "computed-style": "~0.1.3" } }, + "lint-staged": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-7.2.0.tgz", + "integrity": "sha512-jPoIMbmgtWMUrz/l0rhBVa1j6H71zr0rEoxDWBA333PZcaqBvELdg0Sf4tdGHlwrBM0GXaXMVgTRkLTm2vA7Jg==", + "dev": true, + "requires": { + "app-root-path": "^2.0.1", + "chalk": "^2.3.1", + "commander": "^2.14.1", + "cosmiconfig": "^5.0.2", + "debug": "^3.1.0", + "dedent": "^0.7.0", + "execa": "^0.9.0", + "find-parent-dir": "^0.3.0", + "is-glob": "^4.0.0", + "is-windows": "^1.0.2", + "jest-validate": "^23.0.0", + "listr": "^0.14.1", + "lodash": "^4.17.5", + "log-symbols": "^2.2.0", + "micromatch": "^3.1.8", + "npm-which": "^3.0.1", + "p-map": "^1.1.1", + "path-is-inside": "^1.0.2", + "pify": "^3.0.0", + "please-upgrade-node": "^3.0.2", + "staged-git-files": "1.1.1", + "string-argv": "^0.0.2", + "stringify-object": "^3.2.2" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "execa": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.9.0.tgz", + "integrity": "sha512-BbUMBiX4hqiHZUA5+JujIjNb6TyAlp2D5KLheMjMluwOuzcnylDL4AxZYLLn1n2AGB49eSWwyKvvEQoRpnAtmA==", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "figures": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", + "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", + "dev": true, + "requires": { + "escape-string-regexp": "^1.0.5", + "object-assign": "^4.1.0" + } + }, + "indent-string": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-2.1.0.tgz", + "integrity": "sha1-ji1INIdCEhtKghi3oTfppSBJ3IA=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-glob": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", + "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-observable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-observable/-/is-observable-1.1.0.tgz", + "integrity": "sha512-NqCa4Sa2d+u7BWc6CukaObG3Fh+CU9bvixbpcXYhy2VvYS7vVGIdAgnIS5Ks3A/cqk4rebLJ9s8zBstT2aKnIA==", + "dev": true, + "requires": { + "symbol-observable": "^1.1.0" + } + }, + "listr": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/listr/-/listr-0.14.1.tgz", + "integrity": "sha512-MSMUUVN1f8aRnPi4034RkOqdiUlpYW+FqwFE3aL0uYNPRavkt2S2SsSpDDofn8BDpqv2RNnsdOcCHWsChcq77A==", + "dev": true, + "requires": { + "@samverschueren/stream-to-observable": "^0.3.0", + "cli-truncate": "^0.2.1", + "figures": "^1.7.0", + "indent-string": "^2.1.0", + "is-observable": "^1.1.0", + "is-promise": "^2.1.0", + "is-stream": "^1.1.0", + "listr-silent-renderer": "^1.1.1", + "listr-update-renderer": "^0.4.0", + "listr-verbose-renderer": "^0.4.0", + "log-symbols": "^1.0.2", + "log-update": "^1.0.2", + "ora": "^0.2.3", + "p-map": "^1.1.1", + "rxjs": "^6.1.0", + "strip-ansi": "^3.0.1" + }, + "dependencies": { + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "log-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-1.0.2.tgz", + "integrity": "sha1-N2/3tY6jCGoPCfrMdGF+ylAeGhg=", + "dev": true, + "requires": { + "chalk": "^1.0.0" + } + } + } + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "rxjs": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.2.tgz", + "integrity": "sha512-0MI8+mkKAXZUF9vMrEoPnaoHkfzBPP4IGwUYRJhIRJF6/w3uByO1e91bEHn8zd43RdkTMKiooYKmwz7RH6zfOQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "listr": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/listr/-/listr-0.13.0.tgz", @@ -14340,6 +14569,15 @@ } } }, + "npm-path": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/npm-path/-/npm-path-2.0.4.tgz", + "integrity": "sha512-IFsj0R9C7ZdR5cP+ET342q77uSRdtWOlWpih5eC+lu29tIDbNEgDbzgVJ5UFvYHWhxDZ5TFkJafFioO0pPQjCw==", + "dev": true, + "requires": { + "which": "^1.2.10" + } + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -14348,6 +14586,17 @@ "path-key": "^2.0.0" } }, + "npm-which": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/npm-which/-/npm-which-3.0.1.tgz", + "integrity": "sha1-kiXybsOihcIJyuZ8OxGmtKtxQKo=", + "dev": true, + "requires": { + "commander": "^2.9.0", + "npm-path": "^2.0.2", + "which": "^1.2.10" + } + }, "npmlog": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", @@ -15021,6 +15270,15 @@ "find-up": "^2.1.0" } }, + "please-upgrade-node": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.1.1.tgz", + "integrity": "sha512-KY1uHnQ2NlQHqIJQpnh/i54rKkuxCEBx+voJIS/Mvb+L2iYd2NMotwduhKTMjfC1uKoX3VXOxLjIYG66dfJTVQ==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, "plur": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/plur/-/plur-3.0.1.tgz", @@ -17817,6 +18075,12 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==" }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, "serialize-javascript": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", @@ -18315,6 +18579,12 @@ "integrity": "sha1-1PM6tU6OOHeLDKXP07OvsS22hiA=", "dev": true }, + "staged-git-files": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/staged-git-files/-/staged-git-files-1.1.1.tgz", + "integrity": "sha512-H89UNKr1rQJvI1c/PIR3kiAMBV23yvR7LItZiV74HWZwzt7f3YHuujJ9nJZlt58WlFox7XQsOahexwk7nTe69A==", + "dev": true + }, "state-toggle": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.1.tgz", @@ -18420,6 +18690,12 @@ "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", "dev": true }, + "string-argv": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.0.2.tgz", + "integrity": "sha1-2sMECGkMIfPDYwo/86BYd73L1zY=", + "dev": true + }, "string-length": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/string-length/-/string-length-2.0.0.tgz", @@ -18465,6 +18741,17 @@ "is-hexadecimal": "^1.0.0" } }, + "stringify-object": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/stringify-object/-/stringify-object-3.2.2.tgz", + "integrity": "sha512-O696NF21oLiDy8PhpWu8AEqoZHw++QW6mUv0UvKZe8gWSdSvMXkiLufK7OmnP27Dro4GU5kb9U7JIO0mBuCRQg==", + "dev": true, + "requires": { + "get-own-enumerable-property-symbols": "^2.0.1", + "is-obj": "^1.0.1", + "is-regexp": "^1.0.0" + } + }, "stringstream": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.6.tgz", diff --git a/package.json b/package.json index 9bbeb3f400ea72..9e888e25a70be7 100644 --- a/package.json +++ b/package.json @@ -94,8 +94,10 @@ "espree": "3.5.4", "extract-text-webpack-plugin": "4.0.0-beta.0", "glob": "7.1.2", + "husky": "0.14.3", "jest-puppeteer": "3.2.1", "lerna": "3.0.0-beta.21", + "lint-staged": "7.2.0", "mkdirp": "0.5.1", "node-sass": "4.9.2", "path-type": "3.0.0", @@ -174,6 +176,7 @@ "package-plugin": "./bin/build-plugin-zip.sh", "postinstall": "npm run build:packages", "pot-to-php": "./bin/pot-to-php.js", + "precommit": "lint-staged", "publish:check": "npm run build:packages && lerna updated", "publish:dev": "npm run build:packages && lerna publish --npm-tag next", "publish:prod": "npm run build:packages && lerna publish", @@ -189,5 +192,16 @@ "test-unit:watch": "npm run test-unit -- --watch", "test-unit-php": "docker-compose run --rm wordpress_phpunit phpunit", "test-unit-php-multisite": "docker-compose run -e WP_MULTISITE=1 --rm wordpress_phpunit phpunit" + }, + "lint-staged": { + "packages/*/package.json": [ + "wp-scripts lint-pkg-json" + ], + "*.js": [ + "eslint" + ], + "{docs/{root-manifest.json,tool/*.js},packages/{*/README.md,*/src/{actions,selectors}.js,components/src/*/README.md}}": [ + "npm run docs:build" + ] } }