mirror of
				https://github.com/lingble/chatwoot.git
				synced 2025-10-31 11:08:04 +00:00 
			
		
		
		
	chore: Upgrade Node.js to v20 (#7759)
Co-authored-by: Vishnu Narayanan <vishnu@chatwoot.com> Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
		| @@ -46,7 +46,7 @@ jobs: | |||||||
|             export NVM_DIR="$HOME/.nvm" |             export NVM_DIR="$HOME/.nvm" | ||||||
|             [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" |             [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | ||||||
|             [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" |             [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" | ||||||
|             nvm install v16 |             nvm install v20 | ||||||
|             echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV |             echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV | ||||||
|             echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV |             echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV | ||||||
|  |  | ||||||
| @@ -64,7 +64,6 @@ jobs: | |||||||
|             - ~/.bundle |             - ~/.bundle | ||||||
|           key: chatwoot-bundle-{{ .Environment.CACHE_VERSION }}-v20220524-{{ checksum "Gemfile.lock" }} |           key: chatwoot-bundle-{{ .Environment.CACHE_VERSION }}-v20220524-{{ checksum "Gemfile.lock" }} | ||||||
|  |  | ||||||
|  |  | ||||||
|       # Only necessary if app uses webpacker or yarn in some other way |       # Only necessary if app uses webpacker or yarn in some other way | ||||||
|       - restore_cache: |       - restore_cache: | ||||||
|           keys: |           keys: | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								.github/workflows/run_foss_spec.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/workflows/run_foss_spec.yml
									
									
									
									
										vendored
									
									
								
							| @@ -52,7 +52,8 @@ jobs: | |||||||
|  |  | ||||||
|     - uses: actions/setup-node@v3 |     - uses: actions/setup-node@v3 | ||||||
|       with: |       with: | ||||||
|         node-version: 16 |         node-version: 20 | ||||||
|  |         cache: yarn | ||||||
|  |  | ||||||
|     - name: yarn |     - name: yarn | ||||||
|       run: yarn install |       run: yarn install | ||||||
| @@ -75,6 +76,8 @@ jobs: | |||||||
|     - name: Run backend tests |     - name: Run backend tests | ||||||
|       run: | |       run: | | ||||||
|         bundle exec rspec --profile=10 --format documentation |         bundle exec rspec --profile=10 --format documentation | ||||||
|  |       env:  | ||||||
|  |         NODE_OPTIONS: --openssl-legacy-provider | ||||||
|  |  | ||||||
|     - name: Upload rails log folder |     - name: Upload rails log folder | ||||||
|       uses: actions/upload-artifact@v3 |       uses: actions/upload-artifact@v3 | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								.github/workflows/run_response_bot_spec.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.github/workflows/run_response_bot_spec.yml
									
									
									
									
										vendored
									
									
								
							| @@ -51,7 +51,8 @@ jobs: | |||||||
|  |  | ||||||
|     - uses: actions/setup-node@v3 |     - uses: actions/setup-node@v3 | ||||||
|       with: |       with: | ||||||
|         node-version: 16 |         node-version: 20 | ||||||
|  |         cache: yarn | ||||||
|  |  | ||||||
|     - name: yarn |     - name: yarn | ||||||
|       run: yarn install |       run: yarn install | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								.github/workflows/size-limit.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.github/workflows/size-limit.yml
									
									
									
									
										vendored
									
									
								
							| @@ -21,7 +21,8 @@ jobs: | |||||||
|  |  | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v3 | ||||||
|         with: |         with: | ||||||
|           node-version: 16 |           node-version: 20 | ||||||
|  |           cache: 'yarn' | ||||||
|  |  | ||||||
|       - name: yarn |       - name: yarn | ||||||
|         run: yarn install |         run: yarn install | ||||||
| @@ -33,6 +34,8 @@ jobs: | |||||||
|            |            | ||||||
|       - name: Run asset compile |       - name: Run asset compile | ||||||
|         run: bundle exec rake assets:precompile |         run: bundle exec rake assets:precompile | ||||||
|  |         env: | ||||||
|  |           NODE_OPTIONS: --openssl-legacy-provider | ||||||
|  |  | ||||||
|       - name: Size Check |       - name: Size Check | ||||||
|         run: yarn run size |         run: yarn run size | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| backend: bin/rails s -p 3000 | backend: bin/rails s -p 3000 | ||||||
| frontend: bin/webpack-dev-server | frontend: export NODE_OPTIONS=--openssl-legacy-provider && bin/webpack-dev-server | ||||||
| # https://github.com/mperham/sidekiq/issues/3090#issuecomment-389748695 | # https://github.com/mperham/sidekiq/issues/3090#issuecomment-389748695 | ||||||
| worker: dotenv bundle exec sidekiq -C config/sidekiq.yml | worker: dotenv bundle exec sidekiq -C config/sidekiq.yml | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								app.json
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								app.json
									
									
									
									
									
								
							| @@ -60,6 +60,9 @@ | |||||||
|   ], |   ], | ||||||
|   "stack": "heroku-20", |   "stack": "heroku-20", | ||||||
|   "buildpacks": [ |   "buildpacks": [ | ||||||
|  |     { | ||||||
|  |       "url": "heroku/nodejs" | ||||||
|  |     }, | ||||||
|     { |     { | ||||||
|       "url": "heroku/ruby" |       "url": "heroku/ruby" | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -172,7 +172,7 @@ EOF | |||||||
| function install_dependencies() { | function install_dependencies() { | ||||||
|   apt update && apt upgrade -y |   apt update && apt upgrade -y | ||||||
|   apt install -y curl |   apt install -y curl | ||||||
|   curl -sL https://deb.nodesource.com/setup_16.x | bash - |   curl -sL https://deb.nodesource.com/setup_20.x | bash - | ||||||
|   curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - |   curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | ||||||
|   echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list |   echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | ||||||
|   curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg |   curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg | ||||||
| @@ -349,7 +349,7 @@ function setup_chatwoot() { | |||||||
|   sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env |   sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .env | ||||||
|   echo -en "\nINSTALLATION_ENV=linux_script" >> ".env" |   echo -en "\nINSTALLATION_ENV=linux_script" >> ".env" | ||||||
|  |  | ||||||
|   rake assets:precompile RAILS_ENV=production |   rake assets:precompile RAILS_ENV=production NODE_OPTIONS=--openssl-legacy-provider | ||||||
| EOF | EOF | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| # pre-build stage | # pre-build stage | ||||||
| FROM ruby:3.2.2-alpine3.16 AS pre-builder | FROM ruby:3.2.2-alpine3.18 AS pre-builder | ||||||
|  |  | ||||||
| # ARG default to production settings | # ARG default to production settings | ||||||
| # For development docker-compose file overrides ARGS | # For development docker-compose file overrides ARGS | ||||||
| @@ -13,6 +13,9 @@ ENV RAILS_SERVE_STATIC_FILES ${RAILS_SERVE_STATIC_FILES} | |||||||
| ARG RAILS_ENV=production | ARG RAILS_ENV=production | ||||||
| ENV RAILS_ENV ${RAILS_ENV} | ENV RAILS_ENV ${RAILS_ENV} | ||||||
|  |  | ||||||
|  | ARG NODE_OPTIONS="--openssl-legacy-provider" | ||||||
|  | ENV NODE_OPTIONS ${NODE_OPTIONS} | ||||||
|  |  | ||||||
| ENV BUNDLE_PATH="/gems" | ENV BUNDLE_PATH="/gems" | ||||||
|  |  | ||||||
| RUN apk update && apk add --no-cache \ | RUN apk update && apk add --no-cache \ | ||||||
| @@ -22,7 +25,7 @@ RUN apk update && apk add --no-cache \ | |||||||
|   tzdata \ |   tzdata \ | ||||||
|   postgresql-dev \ |   postgresql-dev \ | ||||||
|   postgresql-client \ |   postgresql-client \ | ||||||
|     nodejs \ |   nodejs-current \ | ||||||
|   yarn \ |   yarn \ | ||||||
|   git \ |   git \ | ||||||
|   && mkdir -p /var/app \ |   && mkdir -p /var/app \ | ||||||
| @@ -70,7 +73,7 @@ RUN rm -rf /gems/ruby/3.2.0/cache/*.gem \ | |||||||
|   && rm .gitignore |   && rm .gitignore | ||||||
|  |  | ||||||
| # final build stage | # final build stage | ||||||
| FROM ruby:3.2.2-alpine3.16 | FROM ruby:3.2.2-alpine3.18 | ||||||
|  |  | ||||||
|  |  | ||||||
| ARG BUNDLE_WITHOUT="development:test" | ARG BUNDLE_WITHOUT="development:test" | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| # https://github.com/rails/rails/issues/43906#issuecomment-1099992310 | # https://github.com/rails/rails/issues/43906#issuecomment-1099992310 | ||||||
| task before_assets_precompile: :environment do | task before_assets_precompile: :environment do | ||||||
|   # run a command which starts your packaging |   # run a command which starts your packaging | ||||||
|  |   ENV['NODE_OPTIONS'] = '--openssl-legacy-provider' | ||||||
|   system('yarn') |   system('yarn') | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,7 +18,8 @@ | |||||||
|     "prepare": "husky install", |     "prepare": "husky install", | ||||||
|     "size": "size-limit" |     "size": "size-limit" | ||||||
|   }, |   }, | ||||||
|   "size-limit": [{ |   "size-limit": [ | ||||||
|  |     { | ||||||
|       "path": "public/packs/js/widget-*.js", |       "path": "public/packs/js/widget-*.js", | ||||||
|       "limit": "270 KB" |       "limit": "270 KB" | ||||||
|     }, |     }, | ||||||
| @@ -146,9 +147,9 @@ | |||||||
|     "webpack-dev-server": "^3" |     "webpack-dev-server": "^3" | ||||||
|   }, |   }, | ||||||
|   "engines": { |   "engines": { | ||||||
|     "node": ">=10.x", |     "node": "20.x", | ||||||
|     "npm": ">=6.x", |     "npm": ">=6.x", | ||||||
|     "yarn": ">=1.x" |     "yarn": "1.22.x" | ||||||
|   }, |   }, | ||||||
|   "husky": { |   "husky": { | ||||||
|     "hooks": { |     "hooks": { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Shivam Mishra
					Shivam Mishra