From a36068bee2be7735b3fd39da815d420958791148 Mon Sep 17 00:00:00 2001 From: Fernando Garcia Date: Thu, 15 Jul 2021 14:47:00 -0300 Subject: [PATCH 1/2] Install webpack automatically --- scripts/preBuildHTML.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/scripts/preBuildHTML.py b/scripts/preBuildHTML.py index 8e61414..3794add 100644 --- a/scripts/preBuildHTML.py +++ b/scripts/preBuildHTML.py @@ -1,4 +1,17 @@ -import os +from subprocess import call +import os.path + def preBuildHTMLFun(): - os.system("npm run build") \ No newline at end of file + webpackInst = os.path.isdir("../node_modules/webpack") + + if webpackInst == False: + print("Running npm install...") + call(["npm", "install"]) + print("Running npm audit fix...") + call(["npm", "audit", "fix"]) + print("Running npx browserslist@latest --update-db...") + call(["npx", "browserslist@latest", "--update-db"]) + + print("Running npm run build...") + call(["npm", "run", "build"]) From c4ff6ffd35a1c65a45cbb2cfb68ab7c59386a23f Mon Sep 17 00:00:00 2001 From: Fernando Garcia Date: Thu, 15 Jul 2021 15:34:25 -0300 Subject: [PATCH 2/2] Changes requested --- scripts/preBuildHTML.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/preBuildHTML.py b/scripts/preBuildHTML.py index 3794add..28dfbe6 100644 --- a/scripts/preBuildHTML.py +++ b/scripts/preBuildHTML.py @@ -3,13 +3,11 @@ def preBuildHTMLFun(): - webpackInst = os.path.isdir("../node_modules/webpack") + webpackInst = os.path.isdir("../node_modules") if webpackInst == False: - print("Running npm install...") - call(["npm", "install"]) - print("Running npm audit fix...") - call(["npm", "audit", "fix"]) + print("Running npm ci...") + call(["npm", "ci"]) print("Running npx browserslist@latest --update-db...") call(["npx", "browserslist@latest", "--update-db"])