mirror of
https://github.com/lingble/chatwoot.git
synced 2025-10-28 17:52:39 +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:
@@ -15,9 +15,9 @@ defaults: &defaults
|
||||
- image: cimg/postgres:15.3
|
||||
- image: cimg/redis:6.2.6
|
||||
environment:
|
||||
- RAILS_LOG_TO_STDOUT: false
|
||||
- COVERAGE: true
|
||||
- LOG_LEVEL: warn
|
||||
- RAILS_LOG_TO_STDOUT: false
|
||||
- COVERAGE: true
|
||||
- LOG_LEVEL: warn
|
||||
parallelism: 4
|
||||
resource_class: large
|
||||
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
||||
nvm install v16
|
||||
nvm install v20
|
||||
echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
|
||||
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
|
||||
|
||||
@@ -64,7 +64,6 @@ jobs:
|
||||
- ~/.bundle
|
||||
key: chatwoot-bundle-{{ .Environment.CACHE_VERSION }}-v20220524-{{ checksum "Gemfile.lock" }}
|
||||
|
||||
|
||||
# Only necessary if app uses webpacker or yarn in some other way
|
||||
- restore_cache:
|
||||
keys:
|
||||
@@ -82,7 +81,7 @@ jobs:
|
||||
- ~/.cache/yarn
|
||||
|
||||
- run:
|
||||
name: Download cc-test-reporter
|
||||
name: Download cc-test-reporter
|
||||
command: |
|
||||
mkdir -p ~/tmp
|
||||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ~/tmp/cc-test-reporter
|
||||
@@ -182,7 +181,7 @@ jobs:
|
||||
- attach_workspace:
|
||||
at: ~/build
|
||||
- run:
|
||||
name: Download cc-test-reporter
|
||||
name: Download cc-test-reporter
|
||||
command: |
|
||||
mkdir -p ~/tmp
|
||||
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ~/tmp/cc-test-reporter
|
||||
@@ -204,4 +203,4 @@ workflows:
|
||||
- build
|
||||
- upload-coverage:
|
||||
requires:
|
||||
- build
|
||||
- build
|
||||
|
||||
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
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
|
||||
- name: yarn
|
||||
run: yarn install
|
||||
@@ -75,6 +76,8 @@ jobs:
|
||||
- name: Run backend tests
|
||||
run: |
|
||||
bundle exec rspec --profile=10 --format documentation
|
||||
env:
|
||||
NODE_OPTIONS: --openssl-legacy-provider
|
||||
|
||||
- name: Upload rails log folder
|
||||
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
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
cache: yarn
|
||||
|
||||
- name: yarn
|
||||
run: yarn install
|
||||
|
||||
7
.github/workflows/size-limit.yml
vendored
7
.github/workflows/size-limit.yml
vendored
@@ -21,7 +21,8 @@ jobs:
|
||||
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
node-version: 20
|
||||
cache: 'yarn'
|
||||
|
||||
- name: yarn
|
||||
run: yarn install
|
||||
@@ -30,9 +31,11 @@ jobs:
|
||||
run: |
|
||||
rm -rf enterprise
|
||||
rm -rf spec/enterprise
|
||||
|
||||
|
||||
- name: Run asset compile
|
||||
run: bundle exec rake assets:precompile
|
||||
env:
|
||||
NODE_OPTIONS: --openssl-legacy-provider
|
||||
|
||||
- name: Size Check
|
||||
run: yarn run size
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
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
|
||||
worker: dotenv bundle exec sidekiq -C config/sidekiq.yml
|
||||
|
||||
3
app.json
3
app.json
@@ -60,6 +60,9 @@
|
||||
],
|
||||
"stack": "heroku-20",
|
||||
"buildpacks": [
|
||||
{
|
||||
"url": "heroku/nodejs"
|
||||
},
|
||||
{
|
||||
"url": "heroku/ruby"
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ EOF
|
||||
function install_dependencies() {
|
||||
apt update && apt upgrade -y
|
||||
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 -
|
||||
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
|
||||
@@ -349,7 +349,7 @@ function setup_chatwoot() {
|
||||
sed -i -e '/RAILS_ENV/ s/=.*/=$RAILS_ENV/' .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
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# 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
|
||||
# For development docker-compose file overrides ARGS
|
||||
@@ -13,18 +13,21 @@ ENV RAILS_SERVE_STATIC_FILES ${RAILS_SERVE_STATIC_FILES}
|
||||
ARG RAILS_ENV=production
|
||||
ENV RAILS_ENV ${RAILS_ENV}
|
||||
|
||||
ARG NODE_OPTIONS="--openssl-legacy-provider"
|
||||
ENV NODE_OPTIONS ${NODE_OPTIONS}
|
||||
|
||||
ENV BUNDLE_PATH="/gems"
|
||||
|
||||
RUN apk update && apk add --no-cache \
|
||||
openssl \
|
||||
tar \
|
||||
build-base \
|
||||
tzdata \
|
||||
postgresql-dev \
|
||||
postgresql-client \
|
||||
nodejs \
|
||||
yarn \
|
||||
git \
|
||||
openssl \
|
||||
tar \
|
||||
build-base \
|
||||
tzdata \
|
||||
postgresql-dev \
|
||||
postgresql-client \
|
||||
nodejs-current \
|
||||
yarn \
|
||||
git \
|
||||
&& mkdir -p /var/app \
|
||||
&& gem install bundler
|
||||
|
||||
@@ -70,7 +73,7 @@ RUN rm -rf /gems/ruby/3.2.0/cache/*.gem \
|
||||
&& rm .gitignore
|
||||
|
||||
# final build stage
|
||||
FROM ruby:3.2.2-alpine3.16
|
||||
FROM ruby:3.2.2-alpine3.18
|
||||
|
||||
|
||||
ARG BUNDLE_WITHOUT="development:test"
|
||||
@@ -92,12 +95,12 @@ ENV BUNDLE_PATH="/gems"
|
||||
|
||||
RUN apk update && apk add --no-cache \
|
||||
build-base \
|
||||
openssl \
|
||||
tzdata \
|
||||
postgresql-client \
|
||||
imagemagick \
|
||||
git \
|
||||
vips \
|
||||
openssl \
|
||||
tzdata \
|
||||
postgresql-client \
|
||||
imagemagick \
|
||||
git \
|
||||
vips \
|
||||
&& gem install bundler
|
||||
|
||||
RUN if [ "$RAILS_ENV" != "production" ]; then \
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# https://github.com/rails/rails/issues/43906#issuecomment-1099992310
|
||||
task before_assets_precompile: :environment do
|
||||
# run a command which starts your packaging
|
||||
ENV['NODE_OPTIONS'] = '--openssl-legacy-provider'
|
||||
system('yarn')
|
||||
end
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
"prepare": "husky install",
|
||||
"size": "size-limit"
|
||||
},
|
||||
"size-limit": [{
|
||||
"size-limit": [
|
||||
{
|
||||
"path": "public/packs/js/widget-*.js",
|
||||
"limit": "270 KB"
|
||||
},
|
||||
@@ -146,9 +147,9 @@
|
||||
"webpack-dev-server": "^3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.x",
|
||||
"node": "20.x",
|
||||
"npm": ">=6.x",
|
||||
"yarn": ">=1.x"
|
||||
"yarn": "1.22.x"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
||||
Reference in New Issue
Block a user