From 75ea440f89a5aac2e3c9f5d82dad2be1a509ac2b Mon Sep 17 00:00:00 2001 From: bach Date: Wed, 10 Aug 2022 14:49:59 +0200 Subject: [PATCH] updated webpack dev build to run 'drush cc css-js' --- build/webpack.config.dev.js | 14 ++++++++++++++ package-lock.json | 6 ++++++ package.json | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/build/webpack.config.dev.js b/build/webpack.config.dev.js index 9e4b602a..8019b1b8 100644 --- a/build/webpack.config.dev.js +++ b/build/webpack.config.dev.js @@ -5,6 +5,7 @@ const { merge } = require('webpack-merge') const baseConfig = require('./webpack.config.base') const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; +const WebpackShellPluginNext = require('webpack-shell-plugin-next'); module.exports = merge(baseConfig, { mode: 'development', @@ -51,6 +52,19 @@ module.exports = merge(baseConfig, { // new webpack.HotModuleReplacementPlugin() new BundleAnalyzerPlugin({ 'analyzerMode': 'static' + }), + new WebpackShellPluginNext({ + // onBuildStart:{ + // scripts: ['echo "Webpack Start"'], + // blocking: true, + // parallel: false + // }, + // drush is not installed in this container so we have to ssh on the php container + onAfterDone:{ + scripts: ['echo "Clearing drupal cache $USER_UNAME $DRUPAL_ROOT"', 'sshpass -p "$USER_UNAME" ssh $USER_UNAME@php "cd $DRUPAL_ROOT && drush cc css-js"', 'echo "Done"'], + blocking: true, + parallel: false + } }) ] }) diff --git a/package-lock.json b/package-lock.json index eb8bb776..f8fd5b71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11351,6 +11351,12 @@ "wildcard": "^2.0.0" } }, + "webpack-shell-plugin-next": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/webpack-shell-plugin-next/-/webpack-shell-plugin-next-2.2.2.tgz", + "integrity": "sha512-2HeC1e0cCvTgA3SD4XPAD69DnILM92mCschrtKdlLRORHCR+oG7xnibQMkVySxTAYWTQOcBRHlqa88x4syWwhQ==", + "dev": true + }, "webpack-sources": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.4.3.tgz", diff --git a/package.json b/package.json index 465d5520..5de5d7f0 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,7 @@ "webpack-bundle-analyzer": "^4.4.0", "webpack-cli": "^4.2.0", "webpack-extraneous-file-cleanup-plugin": "^2.0.0", - "webpack-merge": "^5.4.0" + "webpack-merge": "^5.4.0", + "webpack-shell-plugin-next": "^2.2.2" } }