From 935bfe3c260d2f43c92b626bed61af26c6628e70 Mon Sep 17 00:00:00 2001 From: Mike L Date: Fri, 2 Apr 2021 22:30:55 +0200 Subject: [PATCH 1/4] Synthesize .npmrc only before initial npm install --- .gitignore | 3 +++ .npmrc | 5 ----- Makefile | 13 ++++++++++--- web_src/fomantic/.npmrc | 3 --- 4 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 .npmrc delete mode 100644 web_src/fomantic/.npmrc diff --git a/.gitignore b/.gitignore index 6cf366df6c52a..59e6fecebf7bc 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,9 @@ coverage.all /integrations/mysql8.ini /integrations/pgsql.ini /integrations/mssql.ini + +# Frontend +.npmrc /node_modules /yarn.lock /public/js diff --git a/.npmrc b/.npmrc deleted file mode 100644 index 25ed63413bbc4..0000000000000 --- a/.npmrc +++ /dev/null @@ -1,5 +0,0 @@ -audit=false -fund=false -package-lock=true -save-exact=true -cache=.npm-cache diff --git a/Makefile b/Makefile index c99483dec54f7..c03adb221202b 100644 --- a/Makefile +++ b/Makefile @@ -662,20 +662,27 @@ docs: fi cd docs; make trans-copy clean build-offline; -node_modules: package-lock.json +.npmrc: + echo "audit=false fund=false package-lock=true save-exact=true " | tr " " "\n" > $@ + +$(FOMANTIC_WORK_DIR)/.npmrc: + echo "optional=false package-lock=false " | tr " " "\n" > $@ + +node_modules: package-lock.json .npmrc $(FOMANTIC_WORK_DIR)/.npmrc npm install --no-save @touch node_modules .PHONY: npm-cache npm-cache: .npm-cache $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui -.npm-cache: package-lock.json +.npm-cache: package-lock.json .npmrc $(FOMANTIC_WORK_DIR)/.npmrc rm -rf .npm-cache $(eval ESBUILD_VERSION := $(shell node -p "require('./package-lock.json').dependencies.esbuild.version")) + $(eval ESBUILD_PLATFORMS := darwin-64 $(foreach arch,arm arm64 32 64,linux-${arch}) $(foreach arch,32 64,windows-${arch})) npm config --userconfig=.npmrc set cache=.npm-cache rm -rf node_modules && npm install --no-save npm config --userconfig=$(FOMANTIC_WORK_DIR)/.npmrc set cache=../../.npm-cache - echo $(foreach build, darwin-64 $(foreach arch,arm arm64 32 64,linux-${arch}) $(foreach arch,32 64,windows-${arch}), esbuild-${build}@$(ESBUILD_VERSION)) | tr " " "\n" | xargs -n 1 -P 4 npm cache add + echo $(ESBUILD_PLATFORMS) | xargs printf "esbuild-%s@$(ESBUILD_VERSION)\n" | xargs -n 1 -P 4 npm cache add rm -rf $(FOMANTIC_WORK_DIR)/node_modules @touch .npm-cache diff --git a/web_src/fomantic/.npmrc b/web_src/fomantic/.npmrc deleted file mode 100644 index 5f8054bbb037c..0000000000000 --- a/web_src/fomantic/.npmrc +++ /dev/null @@ -1,3 +0,0 @@ -optional=false -package-lock=false -cache=../../.npm-cache From cfa1b6326372e9548fd7c71b077ec5a00d630eae Mon Sep 17 00:00:00 2001 From: Mike L Date: Fri, 2 Apr 2021 22:31:11 +0200 Subject: [PATCH 2/4] Fix bsdtar on Debian/Ubuntu and legacy macOS --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c03adb221202b..9f556673ae4d9 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,10 @@ else # This is the "normal" part of the Makefile -TAR := $(shell hash bsdtar > /dev/null 2>&1 && echo "bsdtar --no-xattrs" || echo "tar" ) +TAR := $(shell hash bsdtar > /dev/null 2>&1 && echo "bsdtar" || echo "tar" ) +ifneq ($(shell $(TAR) --version | grep "bsdtar 3"),) + TAR += --format=gnutar +endif DIST := dist DIST_DIRS := $(DIST)/binaries $(DIST)/release From 780c8ab69523c58a6ab1d02882aac83616edc2a5 Mon Sep 17 00:00:00 2001 From: Mike L Date: Sat, 3 Apr 2021 04:15:40 +0200 Subject: [PATCH 3/4] Fix cache/path issue with npm 7 --- .gitignore | 5 +++-- Makefile | 21 ++++++++------------- web_src/fomantic/package.json | 5 +++++ 3 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 web_src/fomantic/package.json diff --git a/.gitignore b/.gitignore index 59e6fecebf7bc..77d18bb1be245 100644 --- a/.gitignore +++ b/.gitignore @@ -76,7 +76,8 @@ coverage.all # Frontend .npmrc -/node_modules +.npm-cache +node_modules /yarn.lock /public/js /public/serviceworker.js @@ -84,6 +85,7 @@ coverage.all /public/fonts /public/img/webpack /web_src/fomantic/node_modules +/web_src/fomantic/package-lock.json /web_src/fomantic/semantic.json /web_src/fomantic/build/* !/web_src/fomantic/build/semantic.js @@ -98,7 +100,6 @@ coverage.all !/web_src/fomantic/build/themes/default/assets/fonts/outline-icons.woff2 /VERSION /.air -/.npm-cache # Snapcraft snap/.snapcraft/ diff --git a/Makefile b/Makefile index 9f556673ae4d9..de7b59f53c606 100644 --- a/Makefile +++ b/Makefile @@ -668,31 +668,26 @@ docs: .npmrc: echo "audit=false fund=false package-lock=true save-exact=true " | tr " " "\n" > $@ -$(FOMANTIC_WORK_DIR)/.npmrc: - echo "optional=false package-lock=false " | tr " " "\n" > $@ - -node_modules: package-lock.json .npmrc $(FOMANTIC_WORK_DIR)/.npmrc +node_modules: package-lock.json .npmrc npm install --no-save @touch node_modules .PHONY: npm-cache npm-cache: .npm-cache $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui -.npm-cache: package-lock.json .npmrc $(FOMANTIC_WORK_DIR)/.npmrc +.npm-cache: package-lock.json .npmrc rm -rf .npm-cache $(eval ESBUILD_VERSION := $(shell node -p "require('./package-lock.json').dependencies.esbuild.version")) $(eval ESBUILD_PLATFORMS := darwin-64 $(foreach arch,arm arm64 32 64,linux-${arch}) $(foreach arch,32 64,windows-${arch})) - npm config --userconfig=.npmrc set cache=.npm-cache + npm config --userconfig=.npmrc rm cache; echo cache=.npm-cache >> .npmrc rm -rf node_modules && npm install --no-save - npm config --userconfig=$(FOMANTIC_WORK_DIR)/.npmrc set cache=../../.npm-cache echo $(ESBUILD_PLATFORMS) | xargs printf "esbuild-%s@$(ESBUILD_VERSION)\n" | xargs -n 1 -P 4 npm cache add - rm -rf $(FOMANTIC_WORK_DIR)/node_modules + rm -rf $(FOMANTIC_WORK_DIR)/node_modules $(FOMANTIC_WORK_DIR)/package-lock.json @touch .npm-cache .PHONY: npm-uncache npm-uncache: rm -rf .npm-cache - npm config --userconfig=$(FOMANTIC_WORK_DIR)/.npmrc rm cache npm config --userconfig=.npmrc rm cache .PHONY: npm-update @@ -706,17 +701,17 @@ npm-update: node-check | node_modules fomantic: $(FOMANTIC_DEST) $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui: - ln -sf ../../semantic.json $(FOMANTIC_WORK_DIR) cd $(FOMANTIC_WORK_DIR); \ + cp "$$OLDPWD/semantic.json" ./; \ rm -rf node_modules && mkdir node_modules && \ - npm install fomantic-ui; \ + npm install --no-optional --cache="$$OLDPWD/.npm-cache"; \ rm -f semantic.json @touch $(FOMANTIC_WORK_DIR)/node_modules $(FOMANTIC_DEST): $(FOMANTIC_CONFIGS) $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui - ln -sf ../../semantic.json $(FOMANTIC_WORK_DIR) - rm -rf $(FOMANTIC_WORK_DIR)/build cd $(FOMANTIC_WORK_DIR); \ + rm -rf build; \ + cp "$$OLDPWD/semantic.json" ./; \ cp -f theme.config.less node_modules/fomantic-ui/src/theme.config; \ cp -rf _site node_modules/fomantic-ui/src/; \ npx gulp -f node_modules/fomantic-ui/gulpfile.js build; \ diff --git a/web_src/fomantic/package.json b/web_src/fomantic/package.json new file mode 100644 index 0000000000000..964fe1d1a9134 --- /dev/null +++ b/web_src/fomantic/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "fomantic-ui": "^2.8.7" + } +} From e6174ca3884dc76b92b25a5a91bbc60218d419b6 Mon Sep 17 00:00:00 2001 From: Mike L Date: Sat, 3 Apr 2021 17:37:00 +0200 Subject: [PATCH 4/4] Do not use bsdtar in CI --- .drone.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.drone.yml b/.drone.yml index 52e9cf48597ef..f73b5cbb7001c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -495,7 +495,7 @@ steps: pull: always image: techknowlogick/xgo:go-1.16.x commands: - - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt -y install nodejs bsdtar\|libarchive-tools + - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs - export PATH=$PATH:$GOPATH/bin - make release environment: @@ -591,7 +591,7 @@ steps: pull: always image: techknowlogick/xgo:go-1.16.x commands: - - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs bsdtar\|libarchive-tools + - curl -sL https://deb.nodesource.com/setup_14.x | bash - && apt-get install -y nodejs - export PATH=$PATH:$GOPATH/bin - make release environment: