From b3daef7f1dbc8ebf73541ed99dc13893341bded4 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Wed, 30 Nov 2022 17:01:16 +0100 Subject: [PATCH] WIP trying to run build_deps on webpack shell script --- Dockerfile.devserver | 2 +- build_deps.sh | 1 - package-lock.json | 15 ++++++++++++++- package.json | 4 ++-- webpack.config.js | 4 ++++ 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Dockerfile.devserver b/Dockerfile.devserver index a17d738..4f71e92 100644 --- a/Dockerfile.devserver +++ b/Dockerfile.devserver @@ -5,4 +5,4 @@ RUN chown node:node /opt EXPOSE 9000 WORKDIR /opt USER node -CMD npm run serve +CMD npm install && npm run serve diff --git a/build_deps.sh b/build_deps.sh index 696c69f..51a21ad 100755 --- a/build_deps.sh +++ b/build_deps.sh @@ -13,7 +13,6 @@ run_on_modules(){ done } -echo "Installing dependencies" npm install echo "Compiling submodules" run_on_modules build diff --git a/package-lock.json b/package-lock.json index d841e2a..d36b3cd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,8 @@ "devDependencies": { "webpack": "^4.43.0", "webpack-cli": "^4.3.12", - "webpack-dev-server": "^4.11.1" + "webpack-dev-server": "^4.11.1", + "webpack-shell-plugin": "^0.5.0" } }, "annotations-plugin": { @@ -24916,6 +24917,12 @@ "node": ">=10.0.0" } }, + "node_modules/webpack-shell-plugin": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-shell-plugin/-/webpack-shell-plugin-0.5.0.tgz", + "integrity": "sha512-BJMcVgXzA7Yc/Dq9JFj/wvquYG5qP3lgmCpMYzhP1a+LxZ/z3TbqKJ3W2xTkzQqBeYsgTdOcSdZ/+qYoFBhMhA==", + "dev": true + }, "node_modules/webpack-sources": { "version": "1.4.3", "license": "MIT", @@ -42373,6 +42380,12 @@ "wildcard": "^2.0.0" } }, + "webpack-shell-plugin": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-shell-plugin/-/webpack-shell-plugin-0.5.0.tgz", + "integrity": "sha512-BJMcVgXzA7Yc/Dq9JFj/wvquYG5qP3lgmCpMYzhP1a+LxZ/z3TbqKJ3W2xTkzQqBeYsgTdOcSdZ/+qYoFBhMhA==", + "dev": true + }, "webpack-sources": { "version": "1.4.3", "requires": { diff --git a/package.json b/package.json index fff3f6a..95e52a4 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "", "private": true, "scripts": { - "prebuild": "./build_deps.sh", "build": "webpack --config webpack.config.js", "preserve": "npm run build", "serve": "webpack serve --config webpack.config.js" @@ -25,6 +24,7 @@ "devDependencies": { "webpack": "^4.43.0", "webpack-cli": "^4.3.12", - "webpack-dev-server": "^4.11.1" + "webpack-dev-server": "^4.11.1", + "webpack-shell-plugin": "^0.5.0" } } diff --git a/webpack.config.js b/webpack.config.js index 60cf413..c0519ef 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,7 @@ const path = require('path'); const webpack = require('webpack'); const Dotenv = require('dotenv-webpack'); +const WebpackShellPlugin = require('webpack-shell-plugin'); module.exports = { mode: process.env.WEBPACK_MODE, @@ -38,6 +39,9 @@ module.exports = { /* cf https://gitlab.tetras-libre.fr/iiif/mirador-video-annotation/-/blob/annotation-on-video/webpack.config.js#L42 */ resourceRegExp: /@blueprintjs\/(core|icons)/, // ignore optional UI framework dependencies }), + new WebpackShellPlugin({ + onBuildStart:['./build_deps.sh'] + }), new Dotenv() ] }; -- GitLab