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

DPL-1047-18: Upgrade Node to v18 (as a stepping stone) #1645

Merged
merged 96 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
3a006c9
build: upgrade to node v18
StephenHulme Jul 12, 2024
4b37898
build: update broweser versions
StephenHulme Jul 12, 2024
54442d6
build: upgrade webpack-cli
StephenHulme Jul 12, 2024
3b6a19a
build: add missing css-loader peer dependency
StephenHulme Jul 12, 2024
3bea9f2
build: upgrade webpacker to v5
StephenHulme Jul 15, 2024
3fcac4e
build: remove unused conflicting plugin
StephenHulme Jul 15, 2024
6eb5a11
build: replace webpacker with vite
StephenHulme Jul 15, 2024
f46d4b0
build: install vite
StephenHulme Jul 15, 2024
42fed55
build: partial removal of webpacker
StephenHulme Jul 15, 2024
3f43ceb
build: update bundle
StephenHulme Jul 15, 2024
d32d2a3
build: partial update of vite config
StephenHulme Jul 15, 2024
65cc278
build: add missing dependencies
StephenHulme Jul 15, 2024
22bb8d3
build: remove more webpack-related files
StephenHulme Jul 15, 2024
fe843b2
build: fix more broken dependencies
StephenHulme Jul 15, 2024
9107274
build: move packs to entrypoints
StephenHulme Jul 15, 2024
0f03204
build: update imports and references for vite
StephenHulme Jul 15, 2024
bb97653
build: specify undefined dependency
StephenHulme Jul 15, 2024
591c2c2
build: install vue plugin for vite
StephenHulme Jul 16, 2024
90ca3a6
fix: specify vue files in imports
StephenHulme Jul 16, 2024
b33af8c
build: add sass dependency
StephenHulme Jul 16, 2024
f9fbf0a
build: update docker install to node v18
StephenHulme Jul 16, 2024
f617ea7
fix: simplify asset tags to always use vite instead of rails assets
StephenHulme Jul 16, 2024
fc92601
style: lint
StephenHulme Jul 16, 2024
e63b1e4
fix: apply stricter linting to sass files
StephenHulme Jul 16, 2024
1bfcee3
style: add upgrade note
StephenHulme Jul 16, 2024
fcdd18a
build: replace select2-rails gem with node install
StephenHulme Jul 16, 2024
109a86b
build: specify scss imports
StephenHulme Jul 16, 2024
67baeea
build: rename vite config file
StephenHulme Jul 17, 2024
a3514ac
build: relocate assets to frontend directory
StephenHulme Jul 18, 2024
e319841
build: update references to frontend directory
StephenHulme Jul 18, 2024
1dd4200
refactor: move pipeline-graph css to seperate entrypoint
StephenHulme Jul 18, 2024
55e2020
refactor: remove pipeline-graph js from application entrypoint
StephenHulme Jul 18, 2024
21b6486
refactor: remove unused select2 library
StephenHulme Jul 18, 2024
f200953
build: remove libraries replaced with yarn equivalents
StephenHulme Jul 18, 2024
a914d3d
build: add JS dependecies to entrypoints
StephenHulme Jul 18, 2024
ed3d045
refactor: relink images to files, includes custom SVG inlining
StephenHulme Jul 18, 2024
4b2d51a
build: update javascript directory
StephenHulme Jul 18, 2024
ba1a3e9
build: update eslint and plugins to work with node 18
StephenHulme Jul 18, 2024
930b9e0
refactor: disable_enter_key_submit for linting
StephenHulme Jul 19, 2024
fcf3f13
refactor: keycodes for linting
StephenHulme Jul 19, 2024
fd978b8
tests: address jest warnings
StephenHulme Jul 19, 2024
6434dd2
docs: remove references to supporting old browsers
StephenHulme Jul 19, 2024
1f4099b
style: add SCAPE as a known global for linting
StephenHulme Jul 19, 2024
fe1a614
style: prefix unused variables with underscore
StephenHulme Jul 19, 2024
eb3c0ed
build: update javascript directories
StephenHulme Jul 19, 2024
d21470b
builds: install missing test dependency
StephenHulme Jul 19, 2024
7a6eaf3
build: attempt to resolve broken paths and imports
StephenHulme Jul 22, 2024
18dc515
wip: resolve more paths
StephenHulme Jul 22, 2024
d8e6912
fix: remove unused UUIDs
StephenHulme Jul 22, 2024
cad7a58
style: remove overwritten user_name
StephenHulme Jul 22, 2024
23dea25
style: remove unused variable
StephenHulme Jul 22, 2024
9e1406a
build: update linting standards
StephenHulme Jul 22, 2024
1e04a16
refactor: fix validator imports
StephenHulme Jul 22, 2024
26b1f95
style: remove unused variable
StephenHulme Jul 22, 2024
d3c6ec3
refactor: fix status collector imports
StephenHulme Jul 22, 2024
cf8acd7
refactor: fix tag collector imports
StephenHulme Jul 22, 2024
120d182
tests: convert to vite equivalent
StephenHulme Jul 22, 2024
fcbba61
build: update prettier ignore file to ignore Vite and JS coverage files
StephenHulme Jul 23, 2024
d5e87d5
style:l lint
StephenHulme Jul 23, 2024
98f6db7
style: rubocop
StephenHulme Jul 23, 2024
a73842e
fix: reinstate html_safe, but add rubocop ignore and note
StephenHulme Jul 23, 2024
aaa7776
refactor: repair missing disable-animations entrypoints
StephenHulme Jul 23, 2024
4fd3306
build: add missing javascript files that were previously loaded globally
StephenHulme Jul 23, 2024
91b18fd
refactor: add missing imports for jQuery
StephenHulme Jul 23, 2024
2bb9baf
fix: remove hopefully unused underscore.js
StephenHulme Jul 23, 2024
d520001
refactor: extract embedded javascript code into javascript module
StephenHulme Jul 23, 2024
9f7b4a8
refactor: remove jQuery from tagged-plate script
StephenHulme Jul 23, 2024
7b74ff4
style: add todo
StephenHulme Jul 24, 2024
e879392
fix: prevent duplicated id field warning
StephenHulme Jul 24, 2024
c3b8b84
fix: retrieve dataset attributes using camelcase
StephenHulme Jul 24, 2024
b1d1db2
style: lint
StephenHulme Jul 24, 2024
64c5a94
tests: add tests for Vite inline SVG loader
StephenHulme Jul 24, 2024
3bac875
style: lint
StephenHulme Jul 24, 2024
0943fc9
style: lint again
StephenHulme Jul 24, 2024
3b28314
Merge branch 'develop' into dpl-1047-18-upgrade
StephenHulme Jul 24, 2024
7a84c4b
Merge branch 'dpl-1047-16-upgrade' into dpl-1047-18-upgrade
StephenHulme Jul 24, 2024
bc54734
docs: add notes on debugging feature tests
StephenHulme Jul 24, 2024
3ef99c4
build: add instructions for starting the development server
StephenHulme Jul 24, 2024
7e01093
fix: specify filetypes and some absolute paths in JS imports
StephenHulme Jul 26, 2024
95bc8f3
build: remove rails bootstrap now that it's been replaced in Yarn
StephenHulme Jul 29, 2024
eef3c21
style: fix comment typo
StephenHulme Jul 29, 2024
b69a5cd
style: replace grandfathered with legacy
StephenHulme Jul 29, 2024
b8a767b
build: remove assets and sprockets
StephenHulme Jul 29, 2024
9283dce
Merge branch 'develop' into dpl-1047-18-upgrade
StephenHulme Jul 30, 2024
572c56e
style: lint
StephenHulme Jul 30, 2024
123f7a9
fix: remove another assets config
StephenHulme Jul 30, 2024
bb2cfdf
build: remove now-unused directories from gitignore
StephenHulme Jul 30, 2024
c84aec2
build: update docker ignore
StephenHulme Jul 30, 2024
d78d8ef
docs: add MissingEntrypointError debugging suggestions
StephenHulme Jul 30, 2024
f55d78c
build: remove more unused asset references and packages
StephenHulme Jul 31, 2024
1ab870b
build: update gemfile.lock
StephenHulme Jul 31, 2024
f2209fe
Revert "Merge pull request #1819 from sanger/depfu/update/yarn/group/…
StephenHulme Aug 2, 2024
e135335
Merge branch 'develop-sans-depfu-js-updates' into dpl-1047-18-upgrade
StephenHulme Aug 2, 2024
d6cda1f
build: set RAILS_ENV to production in compilation script
StephenHulme Aug 2, 2024
5df096e
fix: add missing sprint_uri to production config
StephenHulme Aug 2, 2024
2257718
Merge branch 'develop' into dpl-1047-18-upgrade
StephenHulme Aug 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
module.exports = {
env: {
browser: true,
commonjs: true,
es6: true,
amd: true,
jasmine: true,
node: true,
},
plugins: ['vue'],
extends: ['eslint:recommended', 'plugin:vue/recommended', 'prettier'],
parserOptions: {
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
sourceType: 'module',
requireConfigFile: false,
},
rules: {
'linebreak-style': ['error', 'unix'],
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ jobs:
flags: javascript,${{ github.event_name }}
fail_ci_if_error: true
disable_search: true
files: ${{ github.workspace }}/app/javascript/coverage/lcov.info
files: ${{ github.workspace }}/app/frontend/coverage/lcov.info
# Note: see codecov.yml for more additional settings
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public/stylesheets/*.css
doc/

# Testing
/app/frontend/coverage/
/coverage
/spec/examples.txt
app/javascript/coverage/
lcov.info

# Tempfiles
Expand All @@ -49,5 +49,12 @@ REVISION
TAG
release.tar.gz

# Vite Ruby
/public/vite*
node_modules
# Vite uses dotenv and suggests to ignore local-only env files. See
# https://vitejs.dev/guide/env-and-mode.html#env-files
*.local

# Bye-bug history
.byebug_history
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.20.2
v18.20.4
5 changes: 3 additions & 2 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public/stylesheets/*.css
/node_modules
/public/app/assets
/public/assets
/public/vite-*/
release.tar.gz
REVISION
/vendor
Expand All @@ -31,10 +32,10 @@ yarn-error.log
/yarn-error.log
yarn-debug.log*
.yarn-integrity
app/javascript/coverage/
app/frontend/coverage/

# Special formatting here
app/javascript/shared/resources.js
app/frontend/javascript/shared/resources.js

# if using LSP for Ruby
.ruby-lsp/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get install -y git
# Set Node to install version 16+, a more recent version such as 20 is recommended
# https://github.com/nodesource/distributions
RUN set -uex \
&& NODE_MAJOR=16 \
&& NODE_MAJOR=18 \
&& apt-get update \
&& apt-get install -y ca-certificates curl gnupg \
&& mkdir -p /etc/apt/keyrings \
Expand Down
20 changes: 5 additions & 15 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ group :default do
gem 'bootsnap'
gem 'rails'

# Lets us easily inline our svg to allow styling. Supports the rails asset pipeline.
gem 'inline_svg'

gem 'exception_notification'
gem 'rake'
gem 'state_machines'
gem 'webpacker'

# Build dependencies
gem 'vite_rails'
gem 'vite_ruby'

# Adds easy conversions between units
gem 'ruby-units'
Expand Down Expand Up @@ -54,18 +54,8 @@ group :test do
end

StephenHulme marked this conversation as resolved.
Show resolved Hide resolved
group :development, :test do
gem 'uglifier'

# Bootstrap is a css framework
# Pinning to v4 as bootstrap 5 drops compatibility with the latest versions of chrome and FF on XP
# Some lab machines are locked to XP due to vendor compatibility
StephenHulme marked this conversation as resolved.
Show resolved Hide resolved
gem 'bootstrap', '~>4'

# gem 'coffee-rails', require: false
# Use jquery as the JavaScript library
gem 'jquery-rails'
gem 'sass-rails'
gem 'select2-rails'
gem 'uglifier'
end

group :development do
Expand Down
31 changes: 10 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ GEM
diff-lcs (1.5.1)
docile (1.4.0)
drb (2.2.1)
dry-cli (1.1.0)
erubi (1.13.0)
exception_notification (4.5.0)
actionmailer (>= 5.2, < 8)
Expand Down Expand Up @@ -196,17 +197,10 @@ GEM
hashie (5.0.0)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
inline_svg (1.9.0)
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.7.2)
irb (1.13.2)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.7.1)
language_server-protocol (3.17.0.3)
launchy (3.0.1)
Expand Down Expand Up @@ -374,8 +368,6 @@ GEM
ruby-units (4.0.2)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.4.0)
ffi (~> 1.9)
sassc-rails (2.1.2)
Expand All @@ -384,13 +376,11 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
select2-rails (4.0.13)
selenium-webdriver (4.18.1)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_range (3.0.0)
sequencescape-client-api (2.0.0)
activemodel (>= 5.0.0)
activesupport (>= 5.0.0)
Expand Down Expand Up @@ -423,6 +413,13 @@ GEM
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.5.0)
vite_rails (3.0.17)
railties (>= 5.1, < 8)
vite_ruby (~> 3.0, >= 3.2.2)
vite_ruby (3.6.0)
dry-cli (>= 0.7, < 2)
rack-proxy (~> 0.6, >= 0.6.1)
zeitwerk (~> 2.2)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand All @@ -432,11 +429,6 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webpacker (5.4.4)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
railties (>= 5.2)
semantic_range (>= 2.3.0)
webrick (1.8.1)
websocket (1.2.10)
websocket-driver (0.7.6)
Expand All @@ -459,8 +451,6 @@ DEPENDENCIES
factory_bot
guard-rspec
hashie
inline_svg
jquery-rails
json_api_client!
launchy
oj
Expand All @@ -479,8 +469,6 @@ DEPENDENCIES
rubocop-rails
ruby-units
sanger_barcode_format!
sass-rails
select2-rails
selenium-webdriver (~> 4.1)
sequencescape-client-api
simplecov
Expand All @@ -489,9 +477,10 @@ DEPENDENCIES
sprockets-rails
state_machines
uglifier
vite_rails
vite_ruby
web-console
webmock
webpacker
yard

BUNDLED WITH
Expand Down
3 changes: 3 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

vite: bin/vite dev
web: bin/rails s
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ Only one terminal for Limber is needed (unless running the integration suite)
bundle exec rails s
```

1. In a second Limber terminal, start the Vite development server for faster development of frontend resources (will start on port 3036):

```shell
yarn dev
```

## Linting and formatting

Linting and formatting are provided by rubocop, prettier and Eslint. I strongly
Expand Down Expand Up @@ -175,15 +181,6 @@ yarn test
yarn test "path/to/file" -t "name of the test"
```

If you get '[Webpacker] Compilation Failed' when trying to run specs, you might need to get yarn to install its dependencies properly. One way of doing this is by precompiling the assets:

```bash
yarn
rake assets:precompile
```

This has the added benefit that it reduces the risk of timeouts when the tests are running, as assets will not get compiled on the fly.

### Writing specs

There are a few tools available to assist with writing specs:
Expand All @@ -206,6 +203,18 @@ Request stubs are provided by webmock. Two helper methods will assist with the m

**Note**: Due to the way the api functions, the factories don't yet support nested associations.

#### Feature debugging

To help with debugging feature specs, temporarily comment out the line `options.add_argument('--headless')` in `spec/spec_helper.rb`. This will allow you to see the browser as the tests run. To pause the execution at certain point, possibly before an expected failure, insert `binding.pry` at the appropriate place in the spec.

To save a screenshot of the browser, insert the line below into the spec.

```rb
save_screenshot("#{Time.now.iso8601}.png")
```

Screenshots will be saved to `tmp/capybara/`.

### Lefthook

[Lefthook](https://github.com/Arkweid/lefthook) is a git-hook manager that will
Expand Down
4 changes: 1 addition & 3 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
//= link_tree ../images
//= link_directory ../javascripts application.js
//= link_directory ../stylesheets .css
// Required to keep Sprockets happy, else Sprockets::Railtie::ManifestNeededError is raised
8 changes: 0 additions & 8 deletions app/assets/javascripts/application.js

This file was deleted.

9 changes: 0 additions & 9 deletions app/assets/javascripts/choose_workflow.js

This file was deleted.

2 changes: 0 additions & 2 deletions app/assets/javascripts/lib/keycodes.js

This file was deleted.

Loading
Loading