8000 Update Bundle and Yarn Dependencies by aaronskiba · Pull Request #3483 · DMPRoadmap/roadmap · GitHub
[go: up one dir, main page]

Skip to content

Update Bundle and Yarn Dependencies #3483

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

Merged
merged 10 commits into from
Mar 26, 2025

Conversation

aaronskiba
Copy link
Contributor
@aaronskiba aaronskiba commented Mar 14, 2025

Changes proposed in this PR:

  • Bumped dependencies via bundle update && yarn upgrade in preparation for upcoming release
  • Addressed rubocop offences that resulted from the rubocop bump
  • Replaced require: with plugins: in .rubocop.yml (This also resulted from the rubocop bump: https://docs.rubocop.org/rubocop/plugin_migration_guide.html)

Copy link
github-actions bot commented Mar 14, 2025
2 Warnings
⚠️ There are code changes, but no corresponding tests. Please include tests if this PR introduces any modifications in behavior. \n
Ignore this warning if the PR ONLY contains translation.io synced updates.
⚠️ This PR is too big! Consider breaking it down into smaller PRs.

Generated by 🚫 Danger

@aaronskiba aaronskiba force-pushed the aaron/bundler-update-yarn-upgrade branch from fae4102 to f3fa057 Compare March 20, 2025 21:23
This change addresses the following warning:

```
rubocop-performance extension supports plugin, specify `plugins: rubocop-performance` instead of `require: rubocop-performance` in /path/to/file/.rubocop.yml.
For more information, see https://docs.rubocop.org/rubocop/plugin_migration_guide.html.
```

- The docs point out that "The plugin system was introduced in RuboCop 1.72". Commit eb23992 bumped Rubocop from v1.66.1 to v1.74.0, so it makes sense that we are suddenly seeing this warning.
The following terminal output was displayed while executing `rubocop -A`:

```
Offenses:

app/controllers/api/v1/templates_controller.rb:39:7: W: Lint/CopDirectiveSyntax: Malformed directive comment detected. The cop name is missing.
      # rubocop:enable
      ^^^^^^^^^^^^^^^^
app/controllers/concerns/paginable.rb:217:1: C: [Corrected] Layout/EmptyLinesAroundMethodBody: Extra empty line detected at method body beginning. (https://rubystyle.guide#empty-lines-around-bodies)
app/controllers/contributors_controller.rb:78:3: W: Lint/CopDirectiveSyntax: Malformed directive comment detected. The cop name is missing.
  # rubocop:enable
  ^^^^^^^^^^^^^^^^
app/models/template.rb:287:36: W: [Corrected] Lint/RedundantTypeConversion: Redundant to_sym detected.
        copy.send(:"#{attribute}=".to_sym, value) if copy.respond_to?(:"#{attribute}=".to_sym)
                                   ^^^^^^
app/models/template.rb:287:88: W: [Corrected] Lint/RedundantTypeConversion: Redundant to_sym detected.
        copy.send(:"#{attribute}=".to_sym, value) if copy.respond_to?(:"#{attribute}=".to_sym)
                                                                                       ^^^^^^
app/services/external_apis/base_service.rb:68:49: W: [Corrected] Lint/RedundantStringCoercion: Redundant use of Object#to_s in interpolation. (https://rubystyle.guide#no-to-s)
        msg = "received an invalid uri: '#{uri&.to_s}'!"
                                                ^^^^
app/services/org_selection/hash_to_org_service.rb:43:5: C: [Corrected] Layout/IndentationWidth: Use 2 (not 8) spaces for indentation. (https://rubystyle.guide#spaces-indentation)
            def to_identifiers(hash:)
    ^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:43:7: W: [Corrected] Lint/RedundantCopDisableDirective: Unnecessary disabling of Metrics/AbcSize.
      # rubocop:disable Metrics/AbcSize
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:43:13: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. (https://rubystyle.guide#spaces-indentation, https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
            def to_identifiers(hash:) ...
            ^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:44:3: C: [Corrected] Layout/IndentationWidth: Use 2 (not -4) spaces for indentation. (https://rubystyle.guide#spaces-indentation)
  return [] unless hash.present?
  ^^^^
app/services/org_selection/hash_to_org_service.rb:46:3: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. (https://rubystyle.guide#spaces-indentation, https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
  out = []
  ^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:47:3: C: [Corrected] Layout/CommentIndentation: Incorrect indentation detected (column 2 instead of 8).
  # Process each of the identifiers
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:48:3: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. (https://rubystyle.guide#spaces-indentation, https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
  hash = hash.with_indifferent_access
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:49:3: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. (https://rubystyle.guide#spaces-indentation, https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
  idents = hash.slice(*identifier_keys)
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:50:3: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. (https://rubystyle.guide#spaces-indentation, https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
  idents.each do |key, value| ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:50:23: C: [Corrected] Style/HashSlice: Use slice(*identifier_keys) instead.
        idents = hash.select { |k, _v| identifier_keys.include?(k) }
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:52:24: C: [Corrected] Style/HashSlice: Use slice(*attr_keys(hash: hash)) instead.
          attrs = hash.select { |k, _v| attr_keys(hash: hash).include?(k) }
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:59:3: C: [Corrected] Layout/IndentationConsistency: Inconsistent indentation detected. (https://rubystyle.guide#spaces-indentation, https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
  out
  ^^^
app/services/org_selection/hash_to_org_service.rb:60:7: W: [Corrected] Layout/DefEndAlignment: end at 60, 6 is not aligned with def at 43, 12.
      end
      ^^^
app/services/org_selection/hash_to_org_service.rb:61:13: C: [Corrected] Layout/AccessModifierIndentation: Indent access modifiers like private. (https://rubystyle.guide#indent-public-private-protected)
            private
            ^^^^^^^
app/services/org_selection/hash_to_org_service.rb:61:13: C: [Corrected] Layout/EmptyLinesAroundAccessModifier: Keep a blank line before and after private. (https://rubystyle.guide#empty-lines-around-access-modifier, https://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
            private
            ^^^^^^^
app/services/org_selection/hash_to_org_service.rb:61:24: W: [Corrected] Lint/RedundantCopEnableDirective: Unnecessary enabling of Metrics/AbcSize.
      # rubocop:enable Metrics/AbcSize
                       ^^^^^^^^^^^^^^^
app/services/org_selection/hash_to_org_service.rb:74:28: C: [Corrected] Style/HashSlice: Use slice(*identifier_keys) instead.
        identifiers = hash.select { |k, _v| identifier_keys.include?(k) }
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/tasks/data_cleanup.rake:181:88: W: [Corrected] Lint/RedundantTypeConversion: Redundant to_sym detected.
    group = [filter.attributes.map { |a| instance.respond_to?(:"#{a}_id") ? :"#{a}_id".to_sym : a }]
                                                                                       ^^^^^^

565 files inspected, 24 offenses detected, 22 offenses corrected
```
The removed `# rubocop:enable` lines were not corresponding to any `# rubocop:disable` lines (which is a rubocop offense in itself).
- Commit a7fd832 executed `yarn upgrade`.
- Since that upgrade, errors are encountered when executing `rails assets:precompile` (see below) These changes resolves the error.
```
$ DISABLE_SPRING=1 rails assets:precompile
Copying Bootstrap glyphicons to the public directory ...
Copying TinyMCE skins to the public directory ...
yarn install v1.22.22
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.16s.
yarn run v1.22.22
$ webpack --config ./config/webpack/webpack.config.js
assets by status 4.71 KiB [cached] 1 asset
./app/javascript/application.js 39 bytes [built] [code generated] [1 error]

ERROR in ./app/javascript/application.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find package '@babel/plugin-syntax-dynamic-import' imported from /home/aaron/Documents/GitHub/roadmap_upstream/babel-virtual-resolve-base.js
    at new NodeError (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:195:5)
    at packageResolve (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:899:9)
    at moduleResolve (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:939:18)
    at defaultResolve (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:1017:15)
    at resolve (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/vendor/import-meta-resolve.js:1030:12)
    at tryImportMetaResolve (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/files/plugins.js:149:45)
    at resolveStandardizedNameForImport (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/files/plugins.js:174:19)
    at resolveStandardizedName (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/files/plugins.js:186:22)
    at loadPlugin (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/files/plugins.js:56:7)
    at loadPlugin.next (<anonymous>)
    at createDescriptor (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/config-descriptors.js:140:16)
    at createDescriptor.next (<anonymous>)
    at step (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:261:32)
    at evaluateAsync (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:291:5)
    at /home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:44:11
    at Array.forEach (<anonymous>)
    at Function.async (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:43:15)
    at Function.all (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:216:13)
    at Generator.next (<anonymous>)
    at createDescriptors (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/config-descriptors.js:102:41)
    at createDescriptors.next (<anonymous>)
    at createPluginDescriptors (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/config-descriptors.js:99:17)
    at createPluginDescriptors.next (<anonymous>)
    at /home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/gensync-utils/functional.js:39:27
    at Generator.next (<anonymous>)
    at mergeChainOpts (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/config-chain.js:349:34)
    at mergeChainOpts.next (<anonymous>)
    at chainWalker (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/config-chain.js:316:14)
    at chainWalker.next (<anonymous>)
    at loadFileChain (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/config-chain.js:191:24)
    at loadFileChain.next (<anonymous>)
    at buildRootChain (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/config-chain.js:77:27)
    at buildRootChain.next (<anonymous>)
    at loadPrivatePartialConfig (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/partial.js:72:62)
    at loadPrivatePartialConfig.next (<anonymous>)
    at loadPartialConfig (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/partial.js:115:25)
    at loadPartialConfig.next (<anonymous>)
    at step (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:269:25)
    at evaluateAsync (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:291:5)
    at /home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:93:9
    at new Promise (<anonymous>)
    at async (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/gensync/index.js:92:14)
    at stopHiding - secret - don't use this - v1 (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:47:12)
    at Object.loadPartialConfigAsync (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/@babel/core/lib/config/index.js:34:85)
    at Object.loader (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/babel-loader/lib/index.js:116:30)
    at Object.<anonymous> (/home/aaron/Documents/GitHub/roadmap_upstream/node_modules/babel-loader/lib/index.js:39:12)

webpack 5.98.0 compiled with 1 error in 259 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
bin/rails aborted!
jsbundling-rails: Command build failed, ensure `yarn build` runs without errors

Tasks: TOP => assets:precompile => javascript:build
(See full trace by running task with --trace)
```
@aaronskiba aaronskiba force-pushed the aaron/bundler-update-yarn-upgrade branch from f3fa057 to b20e952 Compare March 24, 2025 15:13
@aaronskiba aaronskiba marked this pull request as ready for review March 24, 2025 15:27
@johnpinto1 johnpinto1 self-requested a review March 25, 2025 16:09
Copy link
Contributor
@johnpinto1 johnpinto1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lesson in dealing in upgrades of dependencies for furture reference.

aaronskiba and others added 3 commits March 25, 2025 10:33
- `@babel/plugin-syntax-dynamic-import` was manually specified in babel.config.js, but it is no longer needed.

- https://babeljs.io/docs/babel-plugin-syntax-dynamic-import states "You can safely remove this plugin from your Babel config if using @babel/core 7.8.0 or above."
  - We are currently using @babel/core@7.26.10:
    ```
    $ yarn list --pattern "@babel/core"
    yarn list v1.22.22
    └─ @babel/core@7.26.10
    ```
This commit follows up on the revert of the unnecessary yarn add --dev @babel/plugin-syntax-dynamic-import (see commit 5ebffd6).
@aaronskiba aaronskiba merged commit ad67842 into development Mar 26, 2025
8 checks passed
@aaronskiba aaronskiba deleted the aaron/bundler-update-yarn-upgrade branch March 26, 2025 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0