Skip to content
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

Fix release expansion issue #15251

Merged
merged 4 commits into from
Apr 2, 2021

Conversation

zeripath
Copy link
Contributor

@zeripath zeripath commented Apr 2, 2021

Use native makefile foreach expansion instead of bash specific brace expansion

Fix #14578

Signed-off-by: Andrew Thornton art27@cantab.net

Fix go-gitea#14578

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath zeripath added this to the 1.15.0 milestone Apr 2, 2021
@silverwind
Copy link
Member

Better alternative for the eval above:

$(eval ESBUILD_VERSION := $(shell node -p "require('./package-lock.json').dependencies.esbuild.version"))

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 2, 2021
@silverwind
Copy link
Member

silverwind commented Apr 2, 2021

Got below to work. apparenly the .npmrc changes were not committed and make .npm-cache left the files dirty. I'm not sure why the .npmrc changes were reverted, they were there already in a previous version of that PR.

diff --git a/.npmrc b/.npmrc
index c5ac9901c..25ed63413 100644
--- a/.npmrc
+++ b/.npmrc
@@ -1,4 +1,5 @@
 audit=false
 fund=false
 package-lock=true
 save-exact=true
+cache=.npm-cache
diff --git a/Makefile b/Makefile
index f2114b643..c99483dec 100644
--- a/Makefile
+++ b/Makefile
@@ -670,9 +670,9 @@ node_modules: package-lock.json
 npm-cache: .npm-cache $(FOMANTIC_WORK_DIR)/node_modules/fomantic-ui

 .npm-cache: package-lock.json
 	rm -rf .npm-cache
-	$(eval ESBUILD_VERSION := `node -p "require('./package-lock.json').dependencies.esbuild.version"`)
+	$(eval ESBUILD_VERSION := $(shell node -p "require('./package-lock.json').dependencies.esbuild.version"))
 	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
diff --git a/web_src/fomantic/.npmrc b/web_src/fomantic/.npmrc
index cc243d01b..5f8054bbb 100644
--- a/web_src/fomantic/.npmrc
+++ b/web_src/fomantic/.npmrc
@@ -1,2 +1,3 @@
 optional=false
 package-lock=false
+cache=../../.npm-cache

zeripath added 2 commits April 2, 2021 04:25
Signed-off-by: Andrew Thornton <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
@zeripath
Copy link
Contributor Author

zeripath commented Apr 2, 2021

lol I was just discovering this myself

@6543 6543 added the skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. label Apr 2, 2021
Co-authored-by: silverwind <me@silverwind.io>
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 2, 2021
@lunny lunny merged commit cc2d540 into go-gitea:master Apr 2, 2021
@CL-Jeremy
Copy link
Contributor

Sorry, those cache= lines were not meant to be committed per my design. After all, .npm-cache is not included when doing git clone, so the cache settings should only take effect when make npm-cache is executed manually, which is what happens during the release of tarball.

Could you please revert this last commit @zeripath ? Thanks in advance.

@silverwind
Copy link
Member

silverwind commented Apr 2, 2021

Can we somehow make those npm commands not write into the .npmrc files? Make targets should not leave a unclean git worktree.

@zeripath
Copy link
Contributor Author

zeripath commented Apr 2, 2021

@CL-Jeremy just make another pr removing the .npm-cache files

@zeripath zeripath deleted the fix-14578-fix-makefile-expansion branch April 2, 2021 10:12
@CL-Jeremy
Copy link
Contributor

CL-Jeremy commented Apr 2, 2021

Can we somehow make those npm commands not write into the .npmrc files? Make targets should not leave a unclean git worktree.

It's possible to make .npm-cache auto-detected for Makefile (i. e. run npm with corresponding arguments if cache exists), but I'd like to have plain npm also working to give the user as much freedom as possible.

Is it feasible to make a pre-commit hook to prevent commit when .npm-cache exists? That'll be perfect. Not possible to apply globally.

Trying to implement this: https://stackoverflow.com/questions/16244969/how-to-tell-git-to-ignore-individual-lines-i-e-gitignore-for-specific-lines-of

@silverwind
Copy link
Member

silverwind commented Apr 2, 2021

Is it feasible to make a pre-commit hook to prevent commit when .npm-cache exists?

Out of question for me at least, I hate all kinds of pre-commit hooks. I think we should just keep it simple and go with #14578 (comment). Will probably follow up on that later today.

@go-gitea go-gitea locked and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants