add 'npm' and 'npm-update' make targets and lockfile (#7246)
* add 'npm' and 'npm-update' make targets and lockfile - `make npm` installs and updates node_modules, triggered automatically on `make css` and `make js` as it completes reasonably fast and ensures consistent modules. - `make npm-update` updates all dependencies to their latest version, regenerates `node_modules` from scratch and updates `package-lock.json`. It uses npm modules `updates` written by yours truly to find the latest version of each dependency. * add suggested make dependencies * remove package-lock.json during npm-update * regenerate package-lock.json
This commit is contained in:
		
							parent
							
								
									33ad554800
								
							
						
					
					
						commit
						a71cabbd53
					
				
					 7 changed files with 4913 additions and 36 deletions
				
			
		|  | @ -52,7 +52,6 @@ pipeline: | ||||||
|     image: webhippie/nodejs:latest |     image: webhippie/nodejs:latest | ||||||
|     pull: true |     pull: true | ||||||
|     commands: |     commands: | ||||||
|       - npm install |  | ||||||
|       - make css |       - make css | ||||||
|       - make js |       - make js | ||||||
|     when: |     when: | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							|  | @ -67,7 +67,6 @@ coverage.all | ||||||
| /node_modules | /node_modules | ||||||
| /modules/indexer/issues/indexers | /modules/indexer/issues/indexers | ||||||
| routers/repo/authorized_keys | routers/repo/authorized_keys | ||||||
| /package-lock.json |  | ||||||
| /yarn.lock | /yarn.lock | ||||||
| 
 | 
 | ||||||
| # Snapcraft | # Snapcraft | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								.npmrc
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								.npmrc
									
									
									
									
									
								
							|  | @ -1,2 +1 @@ | ||||||
| package-lock=false |  | ||||||
| save-exact=true | save-exact=true | ||||||
|  |  | ||||||
							
								
								
									
										33
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								Makefile
									
									
									
									
									
								
							|  | @ -366,29 +366,32 @@ release-compress: | ||||||
| 	fi | 	fi | ||||||
| 	cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done; | 	cd $(DIST)/release/; for file in `find . -type f -name "*"`; do echo "compressing $${file}" && gxz -k -9 $${file}; done; | ||||||
| 
 | 
 | ||||||
| .PHONY: js | npm-check: | ||||||
| js: | 	@hash npm > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | ||||||
| 	@if ([ ! -d "$(PWD)/node_modules" ]); then \
 | 		echo "Please install Node.js 8.x or greater with npm"; \
 | ||||||
| 		echo "node_modules directory is absent, please run 'npm install' first"; \
 |  | ||||||
| 		exit 1; \
 | 		exit 1; \
 | ||||||
| 	fi; | 	fi; | ||||||
| 	@hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | 	@hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 | ||||||
| 		echo "Please install npm version 5.2+"; \
 | 		echo "Please install Node.js 8.x or greater with npm"; \
 | ||||||
| 		exit 1; \
 | 		exit 1; \
 | ||||||
| 	fi; | 	fi; | ||||||
|  | 
 | ||||||
|  | .PHONY: npm | ||||||
|  | npm: npm-check | ||||||
|  | 	npm install --no-save | ||||||
|  | 
 | ||||||
|  | .PHONY: npm-update | ||||||
|  | npm-update: npm-check | ||||||
|  | 	npx updates -cu | ||||||
|  | 	rm -rf node_modules package-lock.json | ||||||
|  | 	npm install --package-lock | ||||||
|  | 
 | ||||||
|  | .PHONY: js | ||||||
|  | js: npm | ||||||
| 	npx eslint public/js | 	npx eslint public/js | ||||||
| 
 | 
 | ||||||
| .PHONY: css | .PHONY: css | ||||||
| css: | css: npm | ||||||
| 	@if ([ ! -d "$(PWD)/node_modules" ]); then \
 |  | ||||||
| 		echo "node_modules directory is absent, please run 'npm install' first"; \
 |  | ||||||
| 		exit 1; \
 |  | ||||||
| 	fi; |  | ||||||
| 	@hash npx > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
 |  | ||||||
| 		echo "Please install npm version 5.2+"; \
 |  | ||||||
| 		exit 1; \
 |  | ||||||
| 	fi; |  | ||||||
| 
 |  | ||||||
| 	npx lesshint public/less/ | 	npx lesshint public/less/ | ||||||
| 	npx lessc --clean-css="--s0 -b" public/less/index.less public/css/index.css | 	npx lessc --clean-css="--s0 -b" public/less/index.less public/css/index.css | ||||||
| 	$(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),npx lessc --clean-css="--s0 -b" public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;) | 	$(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),npx lessc --clean-css="--s0 -b" public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;) | ||||||
|  |  | ||||||
|  | @ -138,14 +138,7 @@ make vet lint misspell-check | ||||||
| 
 | 
 | ||||||
| ### Updating CSS | ### Updating CSS | ||||||
| 
 | 
 | ||||||
| To generate the CSS, you will need [Node.js](https://nodejs.org/) 8.0 or greater and the build dependencies: | To generate the CSS, you will need [Node.js](https://nodejs.org/) 8.0 or greater with npm. At present we use [less](http://lesscss.org/) and [postcss](https://postcss.org) to generate our CSS. Do **not** edit the files in `public/css` directly, as they are generated from `lessc` from the files in `public/less`. | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| npm install |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| At present we use [less](http://lesscss.org/) and [postcss](https://postcss.org) to generate our CSS. Do |  | ||||||
| **not** edit the files in `public/css` directly, as they are generated from `lessc` from the files in `public/less`. |  | ||||||
| 
 | 
 | ||||||
| Edit files in `public/less`, run the linter, regenerate the CSS and commit all changed files: | Edit files in `public/less`, run the linter, regenerate the CSS and commit all changed files: | ||||||
| 
 | 
 | ||||||
|  | @ -155,13 +148,7 @@ make css | ||||||
| 
 | 
 | ||||||
| ### Updating JS | ### Updating JS | ||||||
| 
 | 
 | ||||||
| To run the JavaScript linter you will need [Node.js](https://nodejs.org/) 8.0 or greater and the build dependencies: | To run the JavaScript linter you will need [Node.js](https://nodejs.org/) 8.0 or greater with npm. Edit files in `public/js` and run the linter: | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| npm install |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| Edit files in `public/js` and run the linter: |  | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
| make js | make js | ||||||
|  | @ -250,7 +237,7 @@ TAGS="bindata sqlite sqlite_unlock_notify" make generate build test-sqlite | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| will run the integration tests in an sqlite environment. Other database tests | will run the integration tests in an sqlite environment. Other database tests | ||||||
| are available but may need adjustment to the local environment.  | are available but may need adjustment to the local environment. | ||||||
| 
 | 
 | ||||||
| Look at | Look at | ||||||
| [`integrations/README.md`](https://github.com/go-gitea/gitea/blob/master/integrations/README.md) | [`integrations/README.md`](https://github.com/go-gitea/gitea/blob/master/integrations/README.md) | ||||||
|  |  | ||||||
							
								
								
									
										4889
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										4889
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -1,12 +1,13 @@ | ||||||
| { | { | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "autoprefixer": "9.5.1", |     "autoprefixer": "9.6.0", | ||||||
|     "eslint": "5.16.0", |     "eslint": "5.16.0", | ||||||
|     "less": "3.9.0", |     "less": "3.9.0", | ||||||
|     "less-plugin-clean-css": "1.5.1", |     "less-plugin-clean-css": "1.5.1", | ||||||
|     "lesshint": "6.3.6", |     "lesshint": "6.3.6", | ||||||
|     "postcss-cli": "6.1.2" |     "postcss-cli": "6.1.2", | ||||||
|  |     "updates": "8.1.0" | ||||||
|   }, |   }, | ||||||
|   "browserslist": [ |   "browserslist": [ | ||||||
|     "> 1%", |     "> 1%", | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue