diff --git a/blocks/init/src/Blocks/components/image/image.php b/blocks/init/src/Blocks/components/image/image.php
index 975d48af4..225e408e6 100644
--- a/blocks/init/src/Blocks/components/image/image.php
+++ b/blocks/init/src/Blocks/components/image/image.php
@@ -54,7 +54,7 @@
continue;
}
- $breakpointValue = $globalManifest['globalVariables']['breakpoints'][$breakpoint] ?? ''; // @phpstan-ignore-line
+ $breakpointValue = $globalManifest['globalVariables']['breakpoints'][$breakpoint] ?? '';
if (!$breakpointValue) {
continue;
diff --git a/blocks/init/src/Blocks/components/lists/lists.php b/blocks/init/src/Blocks/components/lists/lists.php
index 71058064d..2944964b4 100644
--- a/blocks/init/src/Blocks/components/lists/lists.php
+++ b/blocks/init/src/Blocks/components/lists/lists.php
@@ -26,7 +26,7 @@
$listsContent = Components::checkAttr('listsContent', $attributes, $manifest);
$listsType = Components::checkAttr('listsOrdered', $attributes, $manifest);
-$listsTypeOptions = array_map(static fn($option) => $option['value'], $manifest['options']['listsOrdered'] ?? []); // @phpstan-ignore-line
+$listsTypeOptions = array_map(static fn($option) => $option['value'], $manifest['options']['listsOrdered'] ?? []);
if (!in_array($listsType, $listsTypeOptions, true)) {
return;
diff --git a/blocks/init/src/Blocks/components/social-networks/social-networks.php b/blocks/init/src/Blocks/components/social-networks/social-networks.php
index e17d59aa2..4c52cd786 100644
--- a/blocks/init/src/Blocks/components/social-networks/social-networks.php
+++ b/blocks/init/src/Blocks/components/social-networks/social-networks.php
@@ -26,11 +26,11 @@
continue;
}
- if (!$socialNetworksShareMode && !isset($manifest['networks'][$network['id']]['url'])) { // @phpstan-ignore-line
+ if (!$socialNetworksShareMode && !isset($manifest['networks'][$network['id']]['url'])) {
continue;
}
- if ($socialNetworksShareMode && !isset($manifest['networks'][$network['id']]['shareUrl'])) { // @phpstan-ignore-line
+ if ($socialNetworksShareMode && !isset($manifest['networks'][$network['id']]['shareUrl'])) {
continue;
}
@@ -64,21 +64,21 @@
"
?>
- title=""
+ href=""
+ title=""
target="_blank"
rel="noreferrer noopener"
>
"
function ($item) {
return $item['value'];
},
- $featuredCategoriesManualTerms // @phpstan-ignore-line
+ $featuredCategoriesManualTerms
),
];
- $allTerms = get_terms($args); // @phpstan-ignore-line
+ $allTerms = get_terms($args);
if (!is_iterable($allTerms)) {
return;
diff --git a/blocks/init/src/Blocks/custom/featured-content/featured-content.php b/blocks/init/src/Blocks/custom/featured-content/featured-content.php
index 2fab51263..689857d46 100644
--- a/blocks/init/src/Blocks/custom/featured-content/featured-content.php
+++ b/blocks/init/src/Blocks/custom/featured-content/featured-content.php
@@ -56,10 +56,10 @@ function ($item) {
(array)$featuredContentTerms
);
} elseif ($featuredContentUseCurrentTerm && $post instanceof WP_Post) {
- $currentTerms = get_the_terms($post->ID, strval($featuredContentTaxonomy)); // @phpstan-ignore-line
+ $currentTerms = get_the_terms($post->ID, strval($featuredContentTaxonomy));
if ($currentTerms) {
- $args['tax_query'][0]['terms'] = [$currentTerms[0]->term_id]; // @phpstan-ignore-line
+ $args['tax_query'][0]['terms'] = [$currentTerms[0]->term_id];
}
} else {
$args['tax_query'][0]['operator'] = 'NOT IN'; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query
diff --git a/blocks/init/src/Blocks/custom/map/map.php b/blocks/init/src/Blocks/custom/map/map.php
index 965fa18ce..0057e9754 100644
--- a/blocks/init/src/Blocks/custom/map/map.php
+++ b/blocks/init/src/Blocks/custom/map/map.php
@@ -26,7 +26,7 @@
$mapControls = Components::checkAttr('mapControls', $attributes, $manifest);
// Take only active map layers and clean them up a bit so the output JSON is smaller.
-$activeLayers = array_filter($mapLayers, fn ($layer) => $layer['hidden'] === false); // @phpstan-ignore-line
+$activeLayers = array_filter($mapLayers, fn ($layer) => $layer['hidden'] === false);
$activeLayers = array_map(function ($layer) {
unset($layer['id']);
diff --git a/blocks/init/src/Blocks/custom/site-footer/site-footer.php b/blocks/init/src/Blocks/custom/site-footer/site-footer.php
index a1035808d..9430e4573 100644
--- a/blocks/init/src/Blocks/custom/site-footer/site-footer.php
+++ b/blocks/init/src/Blocks/custom/site-footer/site-footer.php
@@ -15,7 +15,7 @@
$siteFooterLinks = Components::checkAttr('siteFooterLinks', $attributes, $manifest);
if (!empty($siteFooterLinks)) {
- $siteFooterLinks = array_filter($siteFooterLinks, fn($item) => !empty($item['text']) && !empty($item['url'])); // @phpstan-ignore-line
+ $siteFooterLinks = array_filter($siteFooterLinks, fn($item) => !empty($item['text']) && !empty($item['url']));
}
$linksClass = Components::selector($blockClass, $blockClass, 'links');
diff --git a/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php b/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php
index a6c937004..d9911ca85 100644
--- a/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php
+++ b/blocks/init/src/Blocks/custom/site-navigation/site-navigation.php
@@ -16,7 +16,7 @@
$siteNavigationLinks = Components::checkAttr('siteNavigationLinks', $attributes, $manifest) ?? [];
if (!empty($siteNavigationLinks)) {
- $siteNavigationLinks = array_filter($siteNavigationLinks, fn($item) => !empty($item['text']) && !empty($item['url'])); // @phpstan-ignore-line
+ $siteNavigationLinks = array_filter($siteNavigationLinks, fn($item) => !empty($item['text']) && !empty($item['url']));
}
$navbarClass = Components::classnames([
diff --git a/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php b/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php
index 21d147940..610972b09 100644
--- a/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php
+++ b/blocks/init/src/Blocks/custom/table-of-contents/table-of-contents.php
@@ -25,7 +25,7 @@
$tableOfContentsHeadingLevels = Components::checkAttr('tableOfContentsHeadingLevels', $attributes, $manifest);
-$headingLevelsToUse = implode(',', array_keys(array_filter($tableOfContentsHeadingLevels, fn($v) => $v))); // @phpstan-ignore-line
+$headingLevelsToUse = implode(',', array_keys(array_filter($tableOfContentsHeadingLevels, fn($v) => $v)));
?>
diff --git a/blocks/init/storybook/babel.config.js b/blocks/init/storybook/babel.config.js
deleted file mode 100644
index e1aa2ec3b..000000000
--- a/blocks/init/storybook/babel.config.js
+++ /dev/null
@@ -1,3 +0,0 @@
-module.exports = {
- extends: './../node_modules/@eightshift/frontend-libs/babel/babel.config.js',
-};
diff --git a/blocks/init/storybook/main.js b/blocks/init/storybook/main.js
deleted file mode 100644
index 4d0af4089..000000000
--- a/blocks/init/storybook/main.js
+++ /dev/null
@@ -1,16 +0,0 @@
-module.exports = {
- stories: [
- './../src/Blocks/**/story.js',
- './../src/Blocks/story.js',
- ],
- addons: [
- '@storybook/addon-essentials',
- '@storybook/addon-a11y'
- ],
- core: {
- builder: 'webpack5',
- },
- features: {
- emotionAlias: false,
- }
-};
diff --git a/blocks/init/storybook/preview-body.html b/blocks/init/storybook/preview-body.html
deleted file mode 100644
index 0abedb575..000000000
--- a/blocks/init/storybook/preview-body.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
diff --git a/blocks/init/storybook/preview-head.html b/blocks/init/storybook/preview-head.html
deleted file mode 100644
index 51571b6f5..000000000
--- a/blocks/init/storybook/preview-head.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
diff --git a/blocks/init/storybook/preview.js b/blocks/init/storybook/preview.js
deleted file mode 100644
index c4d3f13dc..000000000
--- a/blocks/init/storybook/preview.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { dispatch } from '@wordpress/data';
-import { STORE_NAME } from '@eightshift/frontend-libs/scripts/editor/store';
-import { storybookWindowObjects, storybookDefaultMocksCategories, storybookDefaultMocksColorPalette } from '@eightshift/frontend-libs/scripts/storybook';
-import globalSettings from '../src/Blocks/manifest.json';
-
-// Storybook order is really important because it won't work in any configuration. Be careful when changing stuff here.
-
-// Set default window objects.
-storybookWindowObjects();
-
-// Set default categories.
-storybookDefaultMocksCategories();
-
-// Set default color palette.
-storybookDefaultMocksColorPalette(globalSettings);
-
-// WP styles.
-require('@eightshift/frontend-libs/styles/storybook.scss');
-
-// Project styles.
-require('./../assets/styles/application.scss');
-
-// Project Blocks Frontend Part.
-require('./../src/Blocks/assets/styles/application-blocks.scss');
-require('./../src/Blocks/assets/styles/application-blocks-editor.scss');
-
-// Project Blocks Editor Part.
-require('../src/Blocks/assets/scripts/application-blocks-editor');
-
-// Prevent one inline style tag.
-dispatch(STORE_NAME).setConfigOutputCssGlobally(false);
diff --git a/blocks/init/storybook/webpack.config.js b/blocks/init/storybook/webpack.config.js
deleted file mode 100644
index 2e26d8a1e..000000000
--- a/blocks/init/storybook/webpack.config.js
+++ /dev/null
@@ -1,7 +0,0 @@
-const path = require('path');
-
-module.exports = ({ config }) => require('./../node_modules/@eightshift/frontend-libs/webpack/storybook')(
- { config },
- path.resolve(__dirname, '..'),
- 'src/Blocks/manifest.json'
-);
diff --git a/composer.json b/composer.json
index 8819312a2..a85003aeb 100644
--- a/composer.json
+++ b/composer.json
@@ -24,15 +24,15 @@
"source": "https://github.com/infinum/eightshift-frontend-libs"
},
"require": {
- "php": "^7.4 || <8.0",
+ "php": ">=7.4",
"ext-json": "*"
},
"require-dev": {
- "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
- "infinum/eightshift-coding-standards": "^1.6",
+ "dealerdirect/phpcodesniffer-composer-installer": "^v1.0.0",
+ "infinum/eightshift-coding-standards": "2.0.0-beta",
"infinum/eightshift-libs-stubs": "^0.7.0",
- "php-stubs/wordpress-stubs": "^6.0",
- "szepeviktor/phpstan-wordpress": "^1.0.3"
+ "php-stubs/wordpress-stubs": "^6.3",
+ "szepeviktor/phpstan-wordpress": "^1.1.7"
},
"minimum-stability": "dev",
"prefer-stable": true,
@@ -45,8 +45,11 @@
}
},
"scripts": {
- "analyze": "@php ./vendor/bin/phpstan analyze",
- "standards:check": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs",
- "standards:fix": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcbf"
+ "test:types": "@php ./vendor/bin/phpstan analyze",
+ "test:standards": "@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 7.4-",
+ "test": [
+ "@test:standards",
+ "@test:types"
+ ]
}
}
diff --git a/scripts/editor/attributes.js b/scripts/editor/attributes.js
index 99559170e..e9ea7915f 100644
--- a/scripts/editor/attributes.js
+++ b/scripts/editor/attributes.js
@@ -146,12 +146,18 @@ export const checkAttr = (key, attributes, manifest, undefinedAllowed = false) =
// Check current component attributes.
const manifestKey = manifest.attributes[key];
+ let tipOutput = '';
+
+ if ('components' in manifest) {
+ tipOutput = ' If you are using additional components, check if you used the correct block/component prefix in your attribute name.';
+ }
+
// Bailout if key is missing.
if (typeof manifestKey === 'undefined') {
if ('blockName' in manifest) {
- throw Error(`${key} key does not exist in the ${manifest.blockName} block manifest. Please check your implementation.`);
+ throw Error(`${key} key does not exist in the ${manifest.blockName} block manifest. Please check your implementation.${tipOutput}`);
} else {
- throw Error(`${key} key does not exist in the ${manifest.componentName} component manifest. Please check your implementation.`);
+ throw Error(`${key} key does not exist in the ${manifest.componentName} component manifest. Please check your implementation.${tipOutput}`);
}
}
diff --git a/setup/create-wp-project/readme.md b/setup/create-wp-project/readme.md
index 1206b524d..605bec5ab 100644
--- a/setup/create-wp-project/readme.md
+++ b/setup/create-wp-project/readme.md
@@ -30,6 +30,10 @@ After the script is finished, please follow the instructions provided by the set
All additional steps after the initial setup are done using WP_CLI commands, so please make sure that you have WP-CLI set and ready to use.
+To make sure you use the latest version of npx command you can add `@latest` flag to the command:
+
+`npx create-wp-project@latest`
+
## Specify version to create
If you want to specify a version of Eightshift Libs or Frontend Libs to use, you can use add two additional attributes to this command to specify a branch or release to use:
diff --git a/setup/create-wp-project/src/basics/argument-operations.js b/setup/create-wp-project/src/basics/argument-operations.js
index fc4fe4d25..179dc9cb2 100644
--- a/setup/create-wp-project/src/basics/argument-operations.js
+++ b/setup/create-wp-project/src/basics/argument-operations.js
@@ -50,7 +50,7 @@ const requirementCheck = async () => {
`${chalk.gray(' Check with')} ${chalk.gray.underline('node -v')}`,
'- Composer (LTS recommended)',
`${chalk.gray(' Check with')} ${chalk.gray.underline('composer -V')}`,
- '- WP CLI', `${chalk.gray(' Check with')} ${chalk.gray.underline('wp --info')}`,
+ '- WP CLI (2.9.0+)', `${chalk.gray(' Check with')} ${chalk.gray.underline('wp --info')}`,
'- Git',
`${chalk.gray(' Check with')} ${chalk.gray.underline('git --version')}`
].join("\n"), 'Requirements');