update starter pack (https://github.com/woocommerce/woocommerce-admin/pull/5254)
This commit is contained in:
parent
8466859eb9
commit
90cad8c945
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": [ "plugin:@woocommerce/eslint-plugin/recommended" ]
|
||||
}
|
|
@ -31,10 +31,10 @@ function add_extension_register_script() {
|
|||
|
||||
wp_register_style(
|
||||
'{{extension_slug}}',
|
||||
plugins_url( '/build/style.css', __FILE__ ),
|
||||
plugins_url( '/build/index.css', __FILE__ ),
|
||||
// Add any dependencies styles may have, such as wp-components.
|
||||
array(),
|
||||
filemtime( dirname( __FILE__ ) . '/build/style.css' )
|
||||
filemtime( dirname( __FILE__ ) . '/build/index.css' )
|
||||
);
|
||||
|
||||
wp_enqueue_script( '{{extension_slug}}' );
|
||||
|
|
|
@ -8,18 +8,19 @@
|
|||
"build": "wp-scripts build",
|
||||
"check-engines": "wp-scripts check-engines",
|
||||
"check-licenses": "wp-scripts check-licenses",
|
||||
"format:js": "wp-scripts format-js",
|
||||
"lint:css": "wp-scripts lint-style",
|
||||
"lint:js": "wp-scripts lint-js",
|
||||
"lint:md:docs": "wp-scripts lint-md-docs",
|
||||
"lint:md:js": "wp-scripts lint-md-js",
|
||||
"lint:pkg-json": "wp-scripts lint-pkg-json",
|
||||
"packages-update": "wp-scripts packages-update",
|
||||
"start": "wp-scripts start",
|
||||
"test:e2e": "wp-scripts test-e2e",
|
||||
"test:unit": "wp-scripts test-unit-js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@wordpress/scripts": "^6.0.0",
|
||||
"mini-css-extract-plugin": "^0.8.0",
|
||||
"sass-loader": "7.3.1",
|
||||
"css-loader": "3.3.0",
|
||||
"node-sass": "4.13.0"
|
||||
"@wordpress/scripts": "^12.2.1",
|
||||
"@woocommerce/eslint-plugin": "1.0.0-beta.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
const defaultConfig = require( "@wordpress/scripts/config/webpack.config" );
|
||||
const defaultConfig = require( '@wordpress/scripts/config/webpack.config' );
|
||||
const DependencyExtractionWebpackPlugin = require( '@wordpress/dependency-extraction-webpack-plugin' );
|
||||
const MiniCssExtractPlugin = require( 'mini-css-extract-plugin' );
|
||||
|
||||
const requestToExternal = request => {
|
||||
const requestToExternal = ( request ) => {
|
||||
const wcDepMap = {
|
||||
'@woocommerce/components': [ 'window', 'wc', 'components' ],
|
||||
'@woocommerce/csv-export': [ 'window', 'wc', 'csvExport' ],
|
||||
|
@ -19,7 +18,7 @@ const requestToExternal = request => {
|
|||
}
|
||||
};
|
||||
|
||||
const requestToHandle = request => {
|
||||
const requestToHandle = ( request ) => {
|
||||
const wcHandleMap = {
|
||||
'@woocommerce/components': 'wc-components',
|
||||
'@woocommerce/csv-export': 'wc-csv',
|
||||
|
@ -40,31 +39,13 @@ module.exports = {
|
|||
...defaultConfig,
|
||||
plugins: [
|
||||
...defaultConfig.plugins.filter(
|
||||
plugin => plugin.constructor.name !== 'DependencyExtractionWebpackPlugin',
|
||||
( plugin ) =>
|
||||
plugin.constructor.name !== 'DependencyExtractionWebpackPlugin'
|
||||
),
|
||||
new DependencyExtractionWebpackPlugin( {
|
||||
injectPolyfill: true,
|
||||
requestToExternal,
|
||||
requestToHandle,
|
||||
} ),
|
||||
new MiniCssExtractPlugin( {
|
||||
filename: 'style.css',
|
||||
} ),
|
||||
],
|
||||
module: {
|
||||
...defaultConfig.module,
|
||||
rules: [
|
||||
...defaultConfig.module.rules,
|
||||
{
|
||||
test: /\.(sa|sc|c)ss$/,
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
},
|
||||
'css-loader',
|
||||
'sass-loader',
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@ const files = [
|
|||
'_webpack.config.js',
|
||||
'_main.php',
|
||||
'_package.json',
|
||||
'._eslintrc',
|
||||
];
|
||||
const maybeThrowError = ( error ) => {
|
||||
if ( error ) throw error;
|
||||
|
|
Loading…
Reference in New Issue