diff --git a/bin/packages/js/extend-cart-checkout-block/.prettierrc.js.mustache b/bin/packages/js/extend-cart-checkout-block/.prettierrc.js.mustache new file mode 100644 index 00000000000..51b8aeb4150 --- /dev/null +++ b/bin/packages/js/extend-cart-checkout-block/.prettierrc.js.mustache @@ -0,0 +1,3 @@ +// Import the default config file and expose it in the project root. +// Useful for editor integrations. +module.exports = require( '@wordpress/prettier-config' ); diff --git a/packages/js/extend-cart-checkout-block/$slug-blocks-integration.php.mustache b/packages/js/extend-cart-checkout-block/$slug-blocks-integration.php.mustache index 89762e199dd..88ea6607b6e 100644 --- a/packages/js/extend-cart-checkout-block/$slug-blocks-integration.php.mustache +++ b/packages/js/extend-cart-checkout-block/$slug-blocks-integration.php.mustache @@ -105,7 +105,7 @@ class {{slugPascalCase}}_Blocks_Integration implements IntegrationInterface { $style_url = plugins_url( $style_path, __FILE__ ); wp_enqueue_style( - '{{slug}}-blocks-integration', + '{{slug}}-checkout-newsletter-subscription-block', $style_url, [], $this->get_file_version( $style_path ) diff --git a/packages/js/extend-cart-checkout-block/.editorconfig.mustache b/packages/js/extend-cart-checkout-block/.editorconfig.mustache new file mode 100644 index 00000000000..7b68c1c4230 --- /dev/null +++ b/packages/js/extend-cart-checkout-block/.editorconfig.mustache @@ -0,0 +1,27 @@ +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org + +# WordPress Coding Standards +# https://make.wordpress.org/core/handbook/coding-standards/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +tab_width = 4 +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true + +[*.txt] +trim_trailing_whitespace = false + +[*.{md,json,yml}] +trim_trailing_whitespace = false +indent_style = space +indent_size = 2 + +[*.json] +indent_style = tab diff --git a/packages/js/extend-cart-checkout-block/.nvmrc.mustache b/packages/js/extend-cart-checkout-block/.nvmrc.mustache new file mode 100644 index 00000000000..23d9c36a118 --- /dev/null +++ b/packages/js/extend-cart-checkout-block/.nvmrc.mustache @@ -0,0 +1 @@ +16.13.2 diff --git a/packages/js/extend-cart-checkout-block/README.md b/packages/js/extend-cart-checkout-block/README.md index 287776ad415..40c5523f79c 100644 --- a/packages/js/extend-cart-checkout-block/README.md +++ b/packages/js/extend-cart-checkout-block/README.md @@ -3,12 +3,29 @@ This is a template to be used with `@wordpress/create-block` to create a WooCommerce Blocks extension starting point. ## Installation + From your `plugins` directory run: -``` + +```sh npx @wordpress/create-block -t @woocommerce/extend-cart-checkout-block your_extension_name ``` When this has completed, go to your WordPress plugins page and activate the plugin. -Add some items to your cart and visit the Checkout block, notice there is additional data on the block that this -template has added. +Add some items to your cart and visit the Checkout block, notice there is additional data on the block that this template has added. + +### Installing `wp-prettier` (optional) + +WooCommerce Blocks uses `wp-prettier` to format the JS files. If you want to use `wp-prettier`, you will need to run the following command: + +```sh +nvm use && npm i --D "prettier@npm:wp-prettier@latest" +``` + +### Installing `wp-env` (optional) + +`wp-env` lets you easily set up a local WordPress environment for building and testing your extension. If you want to use `wp-env`, you will need to run the following command: + +```sh +nvm use && npm i -D @wordpress/env && npm set-script wp-env "wp-env" +``` diff --git a/packages/js/extend-cart-checkout-block/changelog/update-extend-cart-checkout-block-dependency b/packages/js/extend-cart-checkout-block/changelog/update-extend-cart-checkout-block-dependency new file mode 100644 index 00000000000..81e8d04ec70 --- /dev/null +++ b/packages/js/extend-cart-checkout-block/changelog/update-extend-cart-checkout-block-dependency @@ -0,0 +1,10 @@ +Significance: patch +Type: update + +This patch includes the following changes: + +- Add `prettier:npm:wp-prettier@2.6.2` +- Add `.wp-env` +- Add `.nvmrc` +- Correct CSS handle of newsletter subscription block +- Correct metadata category of newsletter subscription block diff --git a/packages/js/extend-cart-checkout-block/index.js b/packages/js/extend-cart-checkout-block/index.js index 7273a77eeaa..325e7711b22 100644 --- a/packages/js/extend-cart-checkout-block/index.js +++ b/packages/js/extend-cart-checkout-block/index.js @@ -4,6 +4,8 @@ module.exports = { npmDevDependencies: [ '@woocommerce/dependency-extraction-webpack-plugin', '@woocommerce/eslint-plugin', + '@wordpress/prettier-config', + '@wordpress/scripts', ], }, }; diff --git a/packages/js/extend-cart-checkout-block/packages/js/extend-cart-checkout-block/.wp-env.json.mustache b/packages/js/extend-cart-checkout-block/packages/js/extend-cart-checkout-block/.wp-env.json.mustache new file mode 100644 index 00000000000..ecacceb5895 --- /dev/null +++ b/packages/js/extend-cart-checkout-block/packages/js/extend-cart-checkout-block/.wp-env.json.mustache @@ -0,0 +1,14 @@ +{ + "phpVersion": null, + "core": null, + "plugins": [ + "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip", + "https://downloads.wordpress.org/plugin/woo-gutenberg-products-block.latest-stable.zip", + "." + ], + "config": { + "JETPACK_AUTOLOAD_DEV": true, + "WP_DEBUG": true, + "SCRIPT_DEBUG": true + } +} diff --git a/packages/js/extend-cart-checkout-block/src/js/checkout-newsletter-subscription-block/block.json.mustache b/packages/js/extend-cart-checkout-block/src/js/checkout-newsletter-subscription-block/block.json.mustache index ed70cbd7b67..98553e8cae7 100644 --- a/packages/js/extend-cart-checkout-block/src/js/checkout-newsletter-subscription-block/block.json.mustache +++ b/packages/js/extend-cart-checkout-block/src/js/checkout-newsletter-subscription-block/block.json.mustache @@ -3,7 +3,7 @@ "name": "{{slug}}/checkout-newsletter-subscription", "version": "2.0.0", "title": "Newsletter Subscription!", - "category": "{{slug}}", + "category": "woocommerce", "description": "Adds a newsletter subscription checkbox to the checkout.", "supports": { "html": false, diff --git a/packages/js/extend-cart-checkout-block/webpack.config.js.mustache b/packages/js/extend-cart-checkout-block/webpack.config.js.mustache index ce8447b6078..4f850022df0 100644 --- a/packages/js/extend-cart-checkout-block/webpack.config.js.mustache +++ b/packages/js/extend-cart-checkout-block/webpack.config.js.mustache @@ -61,8 +61,7 @@ module.exports = { // Add code here to prepend to all .scss/.sass files. return ( - '@import "_colors"; ' + - content + '@import "colors"; ' + content ); }, },