-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mod] make static.build.commit more robust #574
Conversation
- use single quote in the STATIC_BUILT_PATHS to avoid bash globbing - don't try to commit if no files have been changed Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
If I try to call
A possible workaround:
But I don't understand when this is useful. |
Very complicate to reproduce the issue I addressed, because there is a commit (patch) noise .. see #566 (comment) and https://github.com/searxng/searxng/commits/master/searx/static/themes/oscar/css/logicodev.min.css.map If this patch noise from oscar disappears one day, a By example: if you then checkout master branch, don't modify any file and just run To simulate the issue, checkout current master branch and comment out themes.all: iff --git a/utils/lib_static.sh b/utils/lib_static.sh
index 2a5efeda..a905a9b7 100755
--- a/utils/lib_static.sh
+++ b/utils/lib_static.sh
@@ -105,7 +105,7 @@ static.build.commit() {
( set -e
# build the themes
- themes.all
+ #themes.all
# add build files
for built_path in "${STATIC_BUILT_PATHS[@]}"; do commit this patch and then run
|
With changes in the source code
👍 With no change in source code
Do I miss something? |
If the purpose is to produce the same build for the same source including the .map files here a patch that fixes the issue (after 5 compilations there is no change to commit, so I guess the issue is fixed). patchdiff --git a/searx/static/themes/oscar/gruntfile.js b/searx/static/themes/oscar/gruntfile.js
index 8e118afd..f5ee68b8 100644
--- a/searx/static/themes/oscar/gruntfile.js
+++ b/searx/static/themes/oscar/gruntfile.js
@@ -107,7 +107,7 @@ module.exports = function(grunt) {
options: {
paths: ["src/less/pointhi", "src/less/logicodev", "src/less/logicodev-dark", "src/less/bootstrap"],
plugins: [
- new (require('less-plugin-clean-css'))()
+ new (require('@wikimedia/less-plugin-clean-css'))()
],
sourceMap: true,
sourceMapURL: (name) => { const s = name.split('/'); return s[s.length - 1] + '.map';},
diff --git a/searx/static/themes/oscar/package.json b/searx/static/themes/oscar/package.json
index ea522b9d..db84af70 100644
--- a/searx/static/themes/oscar/package.json
+++ b/searx/static/themes/oscar/package.json
@@ -10,7 +10,7 @@
"grunt-contrib-watch": "~1.1.0",
"jslint": "^0.12.1",
"less": "^4.1.1",
- "less-plugin-clean-css": "^1.5.1"
+ "@wikimedia/less-plugin-clean-css": "^1.5.2"
},
"dependencies": {
"bootstrap": "^3.4.1",
diff --git a/searx/static/themes/simple/gruntfile.js b/searx/static/themes/simple/gruntfile.js
index ca59cb56..bc5f2d88 100644
--- a/searx/static/themes/simple/gruntfile.js
+++ b/searx/static/themes/simple/gruntfile.js
@@ -108,7 +108,7 @@ module.exports = function(grunt) {
options: {
paths: ["less"],
plugins: [
- new (require('less-plugin-clean-css'))()
+ new (require('@wikimedia/less-plugin-clean-css'))()
],
sourceMap: true,
sourceMapURL: (name) => { const s = name.split('/'); return s[s.length - 1] + '.map';},
diff --git a/searx/static/themes/simple/package.json b/searx/static/themes/simple/package.json
index 356230f5..55c5de06 100644
--- a/searx/static/themes/simple/package.json
+++ b/searx/static/themes/simple/package.json
@@ -14,7 +14,7 @@
"grunt-image": "^6.4.0",
"ionicons": "^6.0.0",
"less": "^4.1.1",
- "less-plugin-clean-css": "^1.5.1",
+ "@wikimedia/less-plugin-clean-css": "^1.5.2",
"sharp": "^0.29.3",
"stylelint": "^13.13.1",
"stylelint-config-standard": "^22.0.0", It uses @wikimedia/less-plugin-clean-css instead of less-plugin-clean-css --> the compilation is done with clean-css version "^4.2.1" instead of the old version "^3.0.1". |
No, this is not the intention of this PR / this might be the topic of an other PR
static.build.drop drops only local builds / that makes the scenario more complex I think. But intention of the new added condition is very simple: # check if any file has been added (in case of no changes)
if [ -z "$(git diff --name-only --cached)" ]; then
build_msg STATIC "no changes applied / nothing to commit"
return 0
fi No matter what the scenario of the context is, if non files has been added, it does not make sense to try a commit.
AFAIK this command is used to print out added (staged) files .. see: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-emgitdiffemltoptionsgt--cached--merge-baseltcommitgt--ltpathgt82308203 Maybe it is better to use the alias option If you have a doubt in this PR, you can mark this PR as a Draft .. later when oscar is removed, we will see, that this PR fixes an issue .. and then, we can decide to merge / or not. |
I still don't understand when this happen, but
ok 👍 |
What does this PR do?
[mod] make static.build.commit more robust
How to test this PR locally?
Run
make static.build.commit
if nothing has been changed, you should see a "no changes applied / nothing to commit" message:Author's checklist
Related issues