Skip to content

Commit

Permalink
Extensions: Simplify directories (#11971)
Browse files Browse the repository at this point in the history
* Removes the `extensions/setup` folder
* Removes the `extensions/utils` folder, placing all files into `extensions/shared` folder
* Removes un-used code in `extensions/shared/block-styles.js`
* Moves block production/beta -list to `extensions/index.json`
  • Loading branch information
roccotripaldi authored and simison committed Apr 10, 2019
1 parent 838fa62 commit 4c63a49
Show file tree
Hide file tree
Showing 61 changed files with 51 additions and 162 deletions.
2 changes: 1 addition & 1 deletion extensions/blocks/business-hours/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/business-hours/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Path } from '@wordpress/components';
*/
import './editor.scss';
import BusinessHours from './edit';
import renderMaterialIcon from '../../utils/render-material-icon';
import renderMaterialIcon from '../../shared/render-material-icon';

/**
* Block Registrations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { InnerBlocks, InspectorControls } from '@wordpress/editor';
* Internal dependencies
*/
import HelpMessage from '../../../shared/help-message';
import renderMaterialIcon from '../../../utils/render-material-icon';
import SubmitButton from '../../../utils/submit-button';
import renderMaterialIcon from '../../../shared/render-material-icon';
import SubmitButton from '../../../shared/submit-button';

const ALLOWED_BLOCKS = [
'jetpack/markdown',
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/contact-form/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { childBlocks, name, settings } from '.';

registerJetpackBlock( name, settings, childBlocks );
2 changes: 1 addition & 1 deletion extensions/blocks/contact-form/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import JetpackField from './components/jetpack-field';
import JetpackFieldTextarea from './components/jetpack-field-textarea';
import JetpackFieldCheckbox from './components/jetpack-field-checkbox';
import JetpackFieldMultiple from './components/jetpack-field-multiple';
import renderMaterialIcon from '../../utils/render-material-icon';
import renderMaterialIcon from '../../shared/render-material-icon';

export const name = 'contact-form';

Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/address/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../../utils/register-jetpack-block';
import registerJetpackBlock from '../../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/address/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Path, Circle } from '@wordpress/components';
*/
import edit from './edit';
import save from './save';
import renderMaterialIcon from '../../../utils/render-material-icon';
import renderMaterialIcon from '../../../shared/render-material-icon';

const attributes = {
address: {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { childBlocks, name, settings } from '.';

registerJetpackBlock( name, settings, childBlocks );
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/email/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Internal dependencies
*/
import save from './save';
import simpleInput from '../../../utils/simple-input';
import simpleInput from '../../../shared/simple-input';
import { __ } from '@wordpress/i18n';

const EmailEdit = props => {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/email/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../../utils/register-jetpack-block';
import registerJetpackBlock from '../../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/email/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Path } from '@wordpress/components';
* Internal dependencies
*/
import edit from './edit';
import renderMaterialIcon from '../../../utils/render-material-icon';
import renderMaterialIcon from '../../../shared/render-material-icon';
import save from './save';

const attributes = {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Path } from '@wordpress/components';
* Internal dependencies
*/
import edit from './edit';
import renderMaterialIcon from '../../utils/render-material-icon';
import renderMaterialIcon from '../../shared/render-material-icon';
import './editor.scss';
import './style.scss';
import { name as addressName, settings as addressSettings } from './address/';
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/phone/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import save from './save';
import simpleInput from '../../../utils/simple-input';
import simpleInput from '../../../shared/simple-input';

const PhoneEdit = props => {
const { setAttributes } = props;
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/phone/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../../utils/register-jetpack-block';
import registerJetpackBlock from '../../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/contact-info/phone/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Path } from '@wordpress/components';
* Internal dependencies
*/
import edit from './edit';
import renderMaterialIcon from '../../../utils/render-material-icon';
import renderMaterialIcon from '../../../shared/render-material-icon';
import save from './save';

const attributes = {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/gif/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/likes/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
* Internal dependencies
*/
import { name, settings } from '.';
import registerJetpackPlugin from '../../utils/register-jetpack-plugin';
import registerJetpackPlugin from '../../shared/register-jetpack-plugin';

registerJetpackPlugin( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/mailchimp/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import apiFetch from '@wordpress/api-fetch';
import classnames from 'classnames';
import SubmitButton from '../../utils/submit-button';
import SubmitButton from '../../shared/submit-button';
import { __ } from '@wordpress/i18n';
import {
Button,
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/mailchimp/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/map/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/markdown/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/publicize/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
* Internal dependencies
*/
import { name, settings } from '.';
import registerJetpackPlugin from '../../utils/register-jetpack-plugin';
import registerJetpackPlugin from '../../shared/register-jetpack-plugin';

registerJetpackPlugin( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/related-posts/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/repeat-visitor/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/repeat-visitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Path } from '@wordpress/components';
/**
* Internal dependencies
*/
import renderMaterialIcon from '../../utils/render-material-icon';
import renderMaterialIcon from '../../shared/render-material-icon';
import edit from './components/edit';
import save from './components/save';
import { CRITERIA_AFTER, DEFAULT_THRESHOLD } from './constants';
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/seo/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
* Internal dependencies
*/
import { name, settings } from '.';
import registerJetpackPlugin from '../../utils/register-jetpack-plugin';
import registerJetpackPlugin from '../../shared/register-jetpack-plugin';

registerJetpackPlugin( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/sharing/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
* Internal dependencies
*/
import { name, settings } from '.';
import registerJetpackPlugin from '../../utils/register-jetpack-plugin';
import registerJetpackPlugin from '../../shared/register-jetpack-plugin';

registerJetpackPlugin( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/shortlinks/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
* Internal dependencies
*/
import { name, settings } from '.';
import registerJetpackPlugin from '../../utils/register-jetpack-plugin';
import registerJetpackPlugin from '../../shared/register-jetpack-plugin';

registerJetpackPlugin( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/shortlinks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { withSelect } from '@wordpress/data';
/**
* Internal dependencies
*/
import ClipboardInput from '../../utils/clipboard-input';
import ClipboardInput from '../../shared/clipboard-input';
import JetpackPluginSidebar from '../../shared/jetpack-plugin-sidebar';

export const name = 'shortlinks';
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/simple-payments/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/slideshow/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/subscriptions/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TextControl, ToggleControl } from '@wordpress/components';
/**
* Internal dependencies
*/
import SubmitButton from '../../utils/submit-button';
import SubmitButton from '../../shared/submit-button';

class SubscriptionEdit extends Component {
state = {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/subscriptions/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/subscriptions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { RawHTML } from '@wordpress/element';
*/
import edit from './edit';
import save from './save';
import renderMaterialIcon from '../../utils/render-material-icon';
import renderMaterialIcon from '../../shared/render-material-icon';

export const name = 'subscriptions';
export const settings = {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/tiled-gallery/deprecated/v1/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Internal dependencies
*/
import Layout from './layout';
import { getActiveStyleName } from '../../../../utils';
import { getActiveStyleName } from '../../../../shared/block-styles';
import { LAYOUT_STYLES } from './constants';

export function defaultColumnsNumber( attributes ) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/tiled-gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import FilterToolbar from './filter-toolbar';
import Layout from './layout';
import { ALLOWED_MEDIA_TYPES, LAYOUT_STYLES, MAX_COLUMNS } from './constants';
import { getActiveStyleName } from '../../utils';
import { getActiveStyleName } from '../../shared/block-styles';
import { icon } from '.';

const linkOptions = [
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/tiled-gallery/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
2 changes: 1 addition & 1 deletion extensions/blocks/tiled-gallery/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import Layout from './layout';
import { defaultColumnsNumber } from './edit';
import { getActiveStyleName } from '../../utils';
import { getActiveStyleName } from '../../shared/block-styles';
import { LAYOUT_STYLES } from './constants';

export default function TiledGallerySave( { attributes } ) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/videopress/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { every } from 'lodash';
*/
import withVideoPressEdit from './edit';
import withVideoPressSave from './save';
import getJetpackExtensionAvailability from '../../utils/get-jetpack-extension-availability';
import getJetpackExtensionAvailability from '../../shared/get-jetpack-extension-availability';

const addVideoPressSupport = ( settings, name ) => {
if ( 'core/video' !== name ) {
Expand Down
2 changes: 1 addition & 1 deletion extensions/blocks/wordads/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import registerJetpackBlock from '../../utils/register-jetpack-block';
import registerJetpackBlock from '../../shared/register-jetpack-block';
import { name, settings } from '.';

registerJetpackBlock( name, settings );
5 changes: 5 additions & 0 deletions extensions/editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/**
* Internal dependencies
*/
import './shared/public-path';
import './shared/block-category';
File renamed without changes.
5 changes: 0 additions & 5 deletions extensions/setup/editor.js

This file was deleted.

3 changes: 0 additions & 3 deletions extensions/shared/README.md

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,3 @@ export function getActiveStyleName( styles, className ) {
const style = getActiveStyle( styles, className );
return style ? style.name : null;
}

export function getDefaultStyleClass( styles ) {
const defaultStyle = find( styles, 'isDefault' );
return defaultStyle ? `is-style-${ defaultStyle.name }` : null;
}

/**
* Checks if className has a class selector starting with `is-style-`
* Does not check validity of found style.
*
* @param {String} classNames Optional. Space separated classNames. Defaults to ''.
* @return {Boolean} true if `classNames` has a Gutenberg style class
*/
export function hasStyleClass( classNames = '' ) {
return classNames.split( ' ' ).some( className => className.startsWith( 'is-style-' ) );
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 4c63a49

Please sign in to comment.