parent
077d53c583
commit
2a78e8a964
@ -0,0 +1,24 @@
|
||||
{
|
||||
"presets": [
|
||||
[
|
||||
"@babel/preset-env",
|
||||
{
|
||||
"modules": false
|
||||
}
|
||||
]
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-proposal-object-rest-spread",
|
||||
[
|
||||
"@babel/transform-react-jsx",
|
||||
{
|
||||
"pragma": "wp.element.createElement"
|
||||
}
|
||||
]
|
||||
],
|
||||
"env": {
|
||||
"default": {
|
||||
"plugins": ["transform-runtime"]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
vendor
|
||||
node_modules
|
@ -0,0 +1,181 @@
|
||||
{
|
||||
"root": true,
|
||||
"parser": "babel-eslint",
|
||||
"extends": [
|
||||
"wordpress",
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"env": {
|
||||
"browser": false,
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"mocha": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"globals": {
|
||||
"wp": true,
|
||||
"wpApiSettings": true,
|
||||
"window": true,
|
||||
"document": true
|
||||
},
|
||||
"plugins": ["react"],
|
||||
"settings": {
|
||||
"react": {
|
||||
"pragma": "wp"
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"linebreak-style": 0,
|
||||
"array-bracket-spacing": ["error", "always"],
|
||||
"brace-style": ["error", "1tbs"],
|
||||
"camelcase": ["error", { "properties": "never" }],
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"comma-spacing": "error",
|
||||
"comma-style": "error",
|
||||
"computed-property-spacing": ["error", "always"],
|
||||
"constructor-super": "error",
|
||||
"dot-notation": "error",
|
||||
"eol-last": "error",
|
||||
"eqeqeq": "error",
|
||||
"func-call-spacing": "error",
|
||||
"indent": ["error", "tab", { "SwitchCase": 1 }],
|
||||
"jsx-quotes": "error",
|
||||
"key-spacing": "error",
|
||||
"keyword-spacing": "error",
|
||||
"lines-around-comment": "off",
|
||||
"no-alert": "error",
|
||||
"no-bitwise": "error",
|
||||
"no-caller": "error",
|
||||
"no-console": "off",
|
||||
"no-const-assign": "error",
|
||||
"no-debugger": "error",
|
||||
"no-dupe-args": "error",
|
||||
"no-dupe-class-members": "error",
|
||||
"no-dupe-keys": "error",
|
||||
"no-duplicate-case": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-else-return": "error",
|
||||
"no-eval": "error",
|
||||
"no-extra-semi": "error",
|
||||
"no-fallthrough": "error",
|
||||
"no-lonely-if": "error",
|
||||
"no-mixed-operators": "error",
|
||||
"no-mixed-spaces-and-tabs": "error",
|
||||
"no-multiple-empty-lines": ["error", { "max": 1 }],
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "off",
|
||||
"no-negated-in-lhs": "error",
|
||||
"no-nested-ternary": "error",
|
||||
"no-redeclare": "error",
|
||||
"no-restricted-syntax": [
|
||||
"error",
|
||||
{
|
||||
"selector":
|
||||
"ImportDeclaration[source.value=/^@wordpress\\u002F.+\\u002F/]",
|
||||
"message": "Path access on WordPress dependencies is not allowed."
|
||||
},
|
||||
{
|
||||
"selector": "ImportDeclaration[source.value=/^blocks$/]",
|
||||
"message": "Use @wordpress/blocks as import path instead."
|
||||
},
|
||||
{
|
||||
"selector": "ImportDeclaration[source.value=/^components$/]",
|
||||
"message": "Use @wordpress/components 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=/^element$/]",
|
||||
"message": "Use @wordpress/element as import path instead."
|
||||
},
|
||||
{
|
||||
"selector": "ImportDeclaration[source.value=/^i18n$/]",
|
||||
"message": "Use @wordpress/i18n as import path instead."
|
||||
},
|
||||
{
|
||||
"selector": "ImportDeclaration[source.value=/^data$/]",
|
||||
"message": "Use @wordpress/data as import path instead."
|
||||
},
|
||||
{
|
||||
"selector": "ImportDeclaration[source.value=/^utils$/]",
|
||||
"message": "Use @wordpress/utils as import path instead."
|
||||
},
|
||||
{
|
||||
"selector":
|
||||
"CallExpression[callee.name=/^__|_n|_x$/]:not([arguments.0.type=/^Literal|BinaryExpression$/])",
|
||||
"message": "Translate function arguments must be string literals."
|
||||
},
|
||||
{
|
||||
"selector":
|
||||
"CallExpression[callee.name=/^_n|_x$/]:not([arguments.1.type=/^Literal|BinaryExpression$/])",
|
||||
"message": "Translate function arguments must be string literals."
|
||||
},
|
||||
{
|
||||
"selector":
|
||||
"CallExpression[callee.name=_nx]:not([arguments.2.type=/^Literal|BinaryExpression$/])",
|
||||
"message": "Translate function arguments must be string literals."
|
||||
}
|
||||
],
|
||||
"no-shadow": "error",
|
||||
"no-undef": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-unreachable": "error",
|
||||
"no-unsafe-negation": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-unused-vars": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-return": "error",
|
||||
"no-var": "error",
|
||||
"no-whitespace-before-property": "error",
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"padded-blocks": ["error", { "classes": "always" }],
|
||||
"prefer-const": "error",
|
||||
"quote-props": ["error", "as-needed"],
|
||||
"react/display-name": "off",
|
||||
"react/jsx-curly-spacing": [
|
||||
"error",
|
||||
{
|
||||
"when": "always",
|
||||
"children": true
|
||||
}
|
||||
],
|
||||
"react/jsx-equals-spacing": "error",
|
||||
"react/jsx-indent": ["error", "tab"],
|
||||
"react/jsx-indent-props": ["error", "tab"],
|
||||
"react/jsx-key": "error",
|
||||
"react/jsx-tag-spacing": "error",
|
||||
"react/no-children-prop": "off",
|
||||
"react/no-find-dom-node": "warn",
|
||||
"react/prop-types": "off",
|
||||
"semi": "error",
|
||||
"semi-spacing": "error",
|
||||
"space-before-blocks": ["error", "always"],
|
||||
"space-before-function-paren": ["error", "never"],
|
||||
"space-in-parens": ["error", "always"],
|
||||
"space-infix-ops": ["error", { "int32Hint": false }],
|
||||
"space-unary-ops": [
|
||||
"error",
|
||||
{
|
||||
"overrides": {
|
||||
"!": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"template-curly-spacing": ["error", "always"],
|
||||
"valid-jsdoc": ["error", { "requireReturn": false }],
|
||||
"valid-typeof": "error",
|
||||
"yoda": 1
|
||||
}
|
||||
}
|
@ -1,3 +1,52 @@
|
||||
# Unit tests
|
||||
/tmp
|
||||
/tests/bin/tmp
|
||||
|
||||
# Numerous always-ignore extensions
|
||||
.diff
|
||||
.err
|
||||
.orig
|
||||
.log
|
||||
.rej
|
||||
.swo
|
||||
.swp
|
||||
.vi
|
||||
~
|
||||
.sass-cache
|
||||
|
||||
# OS or Editor folders
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
.cache
|
||||
.project
|
||||
.settings
|
||||
.tmproj
|
||||
*.esproj
|
||||
nbproject
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
.vscode
|
||||
*.swp
|
||||
|
||||
# Dreamweaver added files
|
||||
_notes
|
||||
dwsync.xml
|
||||
|
||||
# Komodo
|
||||
*.komodoproject
|
||||
.komodotools
|
||||
|
||||
# Folders to ignore
|
||||
.hg
|
||||
.svn
|
||||
.CVS
|
||||
intermediate
|
||||
.idea
|
||||
vendor/*
|
||||
cache
|
||||
node_modules
|
||||
|
||||
# Ignore compiled stuff
|
||||
assets/dist
|
||||
|
||||
# Composer
|
||||
vendor
|
||||
|
@ -0,0 +1,4 @@
|
||||
.wp-beb-plugin-button {
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,51 @@
|
||||
const { _x } = wp.i18n;
|
||||
const { Fragment } = wp.element;
|
||||
const { PluginSidebar, PluginSidebarMoreMenuItem } = wp.editPost;
|
||||
const { dispatch } = wp.data;
|
||||
const { createBlock } = wp.blocks;
|
||||
const {
|
||||
Button,
|
||||
ColorPicker,
|
||||
PanelBody,
|
||||
} = wp.components;
|
||||
|
||||
function addDemoBlock() {
|
||||
|
||||
const demoBlock = createBlock( 'wp-beb/demo', {
|
||||
greeting: 'Hey there!',
|
||||
className: 'is-style-awesome',
|
||||
} );
|
||||
dispatch( 'core/editor' ).insertBlock( demoBlock );
|
||||
|
||||
}//end addDemoBlock()
|
||||
|
||||
const PluginComponent = () => (
|
||||
|
||||
// Every component must have only one parent element.
|
||||
// In this case, the parent element is a Fragment.
|
||||
<Fragment>
|
||||
<PluginSidebarMoreMenuItem target="sidebar-name">
|
||||
{ _x( 'My Sidebar', 'text', 'wp-beb' ) }
|
||||
</PluginSidebarMoreMenuItem>
|
||||
<PluginSidebar name="sidebar-name" title="My Sidebar">
|
||||
|
||||
<PanelBody title={ _x( 'Color', 'text', 'wp-beb' ) }>
|
||||
<ColorPicker
|
||||
onChangeComplete={ ( value ) => console.log( `The selected color was: ${ value.hex }` ) }
|
||||
/>
|
||||
</PanelBody>
|
||||
|
||||
<PanelBody title={ _x( 'Content', 'text', 'wp-beb' ) }>
|
||||
<Button
|
||||
className="wp-beb-plugin-button"
|
||||
isLarge
|
||||
onClick={ () => addDemoBlock() }
|
||||
>
|
||||
{ _x( 'Add a demo block', 'text', 'wp-beb' ) }
|
||||
</Button>
|
||||
</PanelBody>
|
||||
|
||||
</PluginSidebar>
|
||||
</Fragment>
|
||||
);
|
||||
export default PluginComponent;
|
@ -0,0 +1,13 @@
|
||||
import '../../css/admin/plugin.scss';
|
||||
|
||||
import PluginComponent from './plugin-component.js';
|
||||
import ElementIcon from '../../images/icon.svg';
|
||||
|
||||
const { registerPlugin } = wp.plugins;
|
||||
|
||||
// More info:
|
||||
// https://wordpress.org/gutenberg/handbook/designers-developers/developers/packages/packages-plugins/
|
||||
registerPlugin( 'plugin-name', {
|
||||
icon: <ElementIcon />,
|
||||
render: PluginComponent,
|
||||
} );
|
@ -1,9 +1,33 @@
|
||||
{
|
||||
"name": "servebolt/servebolt-wp-optimize-plugin",
|
||||
"type": "wordpress-plugin",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"description": "",
|
||||
"minimum-stability": "dev",
|
||||
"require": {
|
||||
"composer/installers": "~1.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"squizlabs/php_codesniffer": "*",
|
||||
"wp-coding-standards/wpcs": "*",
|
||||
"phpcompatibility/php-compatibility": "*"
|
||||
},
|
||||
"extra": {
|
||||
"installer-name": "servebolt-wp-optimize-plugin"
|
||||
},
|
||||
"minimum-stability": "dev"
|
||||
"keywords": [
|
||||
"blocks",
|
||||
"editor",
|
||||
"gutenberg",
|
||||
"plugin",
|
||||
"wordpress"
|
||||
],
|
||||
"scripts": {
|
||||
"post-install-cmd": [
|
||||
"[ -f vendor/bin/phpcs ] && \"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs || true"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"[ -f vendor/bin/phpcs ] && \"vendor/bin/phpcs\" --config-set installed_paths vendor/wp-coding-standards/wpcs || true"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,293 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "5fa53d485fe3ecdeb124035cebaa71ab",
|
||||
"packages": [
|
||||
{
|
||||
"name": "composer/installers",
|
||||
"version": "v1.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/composer/installers.git",
|
||||
"reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/composer/installers/zipball/cfcca6b1b60bc4974324efb5783c13dca6932b5b",
|
||||
"reference": "cfcca6b1b60bc4974324efb5783c13dca6932b5b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-plugin-api": "^1.0"
|
||||
},
|
||||
"replace": {
|
||||
"roundcube/plugin-installer": "*",
|
||||
"shama/baton": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"composer/composer": "1.0.*@dev",
|
||||
"phpunit/phpunit": "^4.8.36"
|
||||
},
|
||||
"type": "composer-plugin",
|
||||
"extra": {
|
||||
"class": "Composer\\Installers\\Plugin",
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Composer\\Installers\\": "src/Composer/Installers"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kyle Robinson Young",
|
||||
"email": "kyle@dontkry.com",
|
||||
"homepage": "https://github.com/shama"
|
||||
}
|
||||
],
|
||||
"description": "A multi-framework Composer library installer",
|
||||
"homepage": "https://composer.github.io/installers/",
|
||||
"keywords": [
|
||||
"Craft",
|
||||
"Dolibarr",
|
||||
"Eliasis",
|
||||
"Hurad",
|
||||
"ImageCMS",
|
||||
"Kanboard",
|
||||
"Lan Management System",
|
||||
"MODX Evo",
|
||||
"Mautic",
|
||||
"Maya",
|
||||
"OXID",
|
||||
"Plentymarkets",
|
||||
"Porto",
|
||||
"RadPHP",
|
||||
"SMF",
|
||||
"Thelia",
|
||||
"WolfCMS",
|
||||
"agl",
|
||||
"aimeos",
|
||||
"annotatecms",
|
||||
"attogram",
|
||||
"bitrix",
|
||||
"cakephp",
|
||||
"chef",
|
||||
"cockpit",
|
||||
"codeigniter",
|
||||
"concrete5",
|
||||
"croogo",
|
||||
"dokuwiki",
|
||||
"drupal",
|
||||
"eZ Platform",
|
||||
"elgg",
|
||||
"expressionengine",
|
||||
"fuelphp",
|
||||
"grav",
|
||||
"installer",
|
||||
"itop",
|
||||
"joomla",
|
||||
"kohana",
|
||||
"laravel",
|
||||
"lavalite",
|
||||
"lithium",
|
||||
"magento",
|
||||
"majima",
|
||||
"mako",
|
||||
"mediawiki",
|
||||
"modulework",
|
||||
"modx",
|
||||
"moodle",
|
||||
"osclass",
|
||||
"phpbb",
|
||||
"piwik",
|
||||
"ppi",
|
||||
"puppet",
|
||||
"pxcms",
|
||||
"reindex",
|
||||
"roundcube",
|
||||
"shopware",
|
||||
"silverstripe",
|
||||
"sydes",
|
||||
"symfony",
|
||||
"typo3",
|
||||
"wordpress",
|
||||
"yawik",
|
||||
"zend",
|
||||
"zikula"
|
||||
],
|
||||
"time": "2018-08-27T06:10:37+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "phpcompatibility/php-compatibility",
|
||||
"version": "9.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
|
||||
"reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/2b63c5d284ab8857f7b1d5c240ddb507a6b2293c",
|
||||
"reference": "2b63c5d284ab8857f7b1d5c240ddb507a6b2293c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3",
|
||||
"squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
|
||||
},
|
||||
"conflict": {
|
||||
"squizlabs/php_codesniffer": "2.6.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
|
||||
},
|
||||
"suggest": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
|
||||
"roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-3.0-or-later"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
|
||||
},
|
||||
{
|
||||
"name": "Wim Godden",
|
||||
"homepage": "https://github.com/wimg",
|
||||
"role": "lead"
|
||||
},
|
||||
{
|
||||
"name": "Juliette Reinders Folmer",
|
||||
"homepage": "https://github.com/jrfnl",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
|
||||
"homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
|
||||
"keywords": [
|
||||
"compatibility",
|
||||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2018-12-30T23:16:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
"version": "3.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
|
||||
"reference": "379deb987e26c7cd103a7b387aea178baec96e48"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48",
|
||||
"reference": "379deb987e26c7cd103a7b387aea178baec96e48",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-simplexml": "*",
|
||||
"ext-tokenizer": "*",
|
||||
"ext-xmlwriter": "*",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
||||
},
|
||||
"bin": [
|
||||
"bin/phpcs",
|
||||
"bin/phpcbf"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Greg Sherwood",
|
||||
"role": "lead"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
|
||||
"homepage": "http://www.squizlabs.com/php-codesniffer",
|
||||
"keywords": [
|
||||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2018-12-19T23:57:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "wp-coding-standards/wpcs",
|
||||
"version": "2.0.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git",
|
||||
"reference": "c9eaadaafefce36b3cb7e06eb15305b8c4cae9ce"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/c9eaadaafefce36b3cb7e06eb15305b8c4cae9ce",
|
||||
"reference": "c9eaadaafefce36b3cb7e06eb15305b8c4cae9ce",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.4",
|
||||
"squizlabs/php_codesniffer": "^3.3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
|
||||
"phpcompatibility/php-compatibility": "^9.0",
|
||||
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
|
||||
},
|
||||
"suggest": {
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
|
||||
},
|
||||
"type": "phpcodesniffer-standard",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Contributors",
|
||||
"homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors"
|
||||
}
|
||||
],
|
||||
"description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
|
||||
"keywords": [
|
||||
"phpcs",
|
||||
"standards",
|
||||
"wordpress"
|
||||
],
|
||||
"time": "2019-01-16T10:13:16+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": []
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,74 @@
|
||||
{
|
||||
"name": "wp-beb",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "npm install && npm run watch",
|
||||
"dev": "npm run clean && cross-env NODE_ENV=development webpack",
|
||||
"production": "cross-env NODE_ENV=production webpack",
|
||||
"build": "npm run clean && npm run production",
|
||||
"watch": "npm run clean && cross-env NODE_ENV=development webpack --watch",
|
||||
"lint-php": "composer run-script phpcs",
|
||||
"lint-php:fix": "composer run-script phpcbf",
|
||||
"lint-css": "stylelint --syntax scss \"src/**/*.scss\"",
|
||||
"lint-css:fix": "stylelint --fix --syntax scss \"src/**/*.scss\"",
|
||||
"lint-js": "eslint assets/src/**/*.js",
|
||||
"lint-js:fix": "eslint assets/src/**/*.js --fix",
|
||||
"lint": "npm run lint-php && npm run lint-css && npm run lint-js",
|
||||
"update:packages": "npm i -g npm-check-updates && npm-check-updates -u && npm install",
|
||||
"postinstall": "composer install",
|
||||
"clean": "rimraf ./assets/dist"
|
||||
},
|
||||
"author": "Nelio Software",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"homepage": "https://neliosoftware.com/",
|
||||
"repository": "https://github.com/avillegasn/wp-beb",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.4.4",
|
||||
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
|
||||
"@babel/plugin-syntax-jsx": "^7.2.0",
|
||||
"@babel/plugin-transform-react-jsx": "^7.3.0",
|
||||
"@babel/plugin-transform-runtime": "^7.4.4",
|
||||
"@babel/polyfill": "^7.4.4",
|
||||
"@babel/preset-env": "^7.4.4",
|
||||
"autoprefixer": "^9.5.1",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-loader": "^8.0.5",
|
||||
"classnames": "^2.2.6",
|
||||
"copy-webpack-plugin": "^5.0.3",
|
||||
"cross-env": "^5.2.0",
|
||||
"css-loader": "^2.1.1",
|
||||
"cssnano": "^4.1.10",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-wordpress": "^2.0.0",
|
||||
"eslint-plugin-react": "^7.13.0",
|
||||
"expose-loader": "latest",
|
||||
"file-loader": "^3.0.1",
|
||||
"gist-embed": "^2.6.0",
|
||||
"imagemin-webpack-plugin": "^2.4.2",
|
||||
"mini-css-extract-plugin": "^0.6.0",
|
||||
"node-sass": "^4.12.0",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"progress-bar-webpack-plugin": "^1.12.1",
|
||||
"regenerator-runtime": "^0.13.2",
|
||||
"sass-loader": "^7.1.0",
|
||||
"style-loader": "^0.23.1",
|
||||
"stylelint": "^10.0.1",
|
||||
"stylelint-config-wordpress": "^14.0.0",
|
||||
"svg-react-loader": "^0.4.6",
|
||||
"uglifyjs-webpack-plugin": "^2.1.2",
|
||||
"url-loader": "^1.1.2",
|
||||
"webpack": "^4.30.0",
|
||||
"webpack-cli": "^3.3.2",
|
||||
"webpack-rtl-plugin": "^2.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"npm": "^6.9.0",
|
||||
"rimraf": "^2.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "8.9.1",
|
||||
"npm": "5.5.1"
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
autoprefixer: {browsers: ['last 3 versions']},
|
||||
},
|
||||
};
|
@ -0,0 +1,172 @@
|
||||
const path = require( 'path' );
|
||||
const webpack = require( 'webpack' );
|
||||
const CopyWebpackPlugin = require( 'copy-webpack-plugin' );
|
||||
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||
const ImageminPlugin = require( 'imagemin-webpack-plugin' ).default;
|
||||
const WebpackRTLPlugin = require( 'webpack-rtl-plugin' );
|
||||
const ProgressBarPlugin = require( 'progress-bar-webpack-plugin' );
|
||||
const { exec } = require( 'child_process' );
|
||||
|
||||
const inProduction = ( 'production' === process.env.NODE_ENV );
|
||||
|
||||
const config = {
|
||||
// https://github.com/webpack-contrib/css-loader/issues/447
|
||||
node: {
|
||||
fs: 'empty',
|
||||
},
|
||||
// https://webpack.js.org/migrate/4/#mode
|
||||
mode: process.env.NODE_ENV,
|
||||
// Ensure modules like magnific know jQuery is external (loaded via WP).
|
||||
externals: {
|
||||
$: 'jQuery',
|
||||
jquery: 'jQuery',
|
||||
lodash: 'lodash',
|
||||
react: 'React',
|
||||
localStorage: 'localStorage',
|
||||
},
|
||||
devtool: 'source-map',
|
||||
module: {
|
||||
rules: [
|
||||
|
||||
// Use Babel to compile JS.
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loaders: [
|
||||
'babel-loader',
|
||||
]
|
||||
},
|
||||
|
||||
// Create RTL styles.
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
// you can specify a publicPath here
|
||||
// by default it uses publicPath in webpackOptions.output
|
||||
publicPath: '../',
|
||||
hmr: process.env.NODE_ENV === 'development',
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
],
|
||||
//*/
|
||||
},
|
||||
|
||||
// SASS to CSS.
|
||||
{
|
||||
test: /\.scss$/,
|
||||
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
hmr: process.env.NODE_ENV === 'development',
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
'sass-loader',
|
||||
],
|
||||
},
|
||||
|
||||
// Image files.
|
||||
{
|
||||
test: /\.(png|jpe?g|gif)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: 'images/[name].[ext]',
|
||||
publicPath: '../',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// SVG files.
|
||||
{
|
||||
test: /.svg$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'svg-react-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
// Plugins. Gotta have em'.
|
||||
plugins: [
|
||||
|
||||
new ProgressBarPlugin( { clear: false } ),
|
||||
|
||||
new MiniCssExtractPlugin( {filename:'css/[name].css'} ),
|
||||
|
||||
// Create RTL css.
|
||||
new WebpackRTLPlugin(),
|
||||
|
||||
// Copy images and SVGs
|
||||
new CopyWebpackPlugin( [ { from: 'assets/src/images', to: 'images' } ] ),
|
||||
|
||||
// Copy index.php to all dist directories.
|
||||
new CopyWebpackPlugin( [ { from: 'index.php', to: '.' } ] ),
|
||||
new CopyWebpackPlugin( [ { from: 'index.php', to: './js' } ] ),
|
||||
new CopyWebpackPlugin( [ { from: 'index.php', to: './css' } ] ),
|
||||
|
||||
// Minify images.
|
||||
// Must go after CopyWebpackPlugin above: https://github.com/Klathmon/imagemin-webpack-plugin#example-usage
|
||||
new ImageminPlugin( { test: /\.(jpe?g|png|gif|svg)$/i } ),
|
||||
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = [
|
||||
|
||||
/*
|
||||
Object.assign( {
|
||||
entry: {
|
||||
blocks: './packages/blocks/index.js',
|
||||
},
|
||||
|
||||
// Tell webpack where to output.
|
||||
output: {
|
||||
path: path.resolve( __dirname, './assets/dist/' ),
|
||||
filename: 'js/[name].js',
|
||||
},
|
||||
}, config ),
|
||||
*/
|
||||
|
||||
Object.assign( {
|
||||
entry: {
|
||||
plugin: [ './assets/src/js/admin/plugin.js' ],
|
||||
},
|
||||
output: {
|
||||
path: path.resolve( __dirname, './assets/dist/' ),
|
||||
filename: 'js/[name].js',
|
||||
},
|
||||
}, config ),
|
||||
|
||||
];
|
||||
|
||||
// inProd?
|
||||
if ( inProduction ) {
|
||||
|
||||
//exec( 'wp i18n make-pot . languages/wp-beb.pot --exclude=assets/dist' );
|
||||
|
||||
// Uglify JS.
|
||||
config.optimization = {
|
||||
minimizer: [
|
||||
new UglifyJsPlugin( { sourceMap: true } )
|
||||
]
|
||||
};
|
||||
|
||||
//config.plugins.push( );
|
||||
|
||||
// Minify CSS.
|
||||
config.plugins.push( new webpack.LoaderOptionsPlugin( { minimize: true } ) );
|
||||
|
||||
}
|
Loading…
Reference in new issue