diff --git a/knip.ts b/knip.ts index d7047863b6..b72cd573e0 100644 --- a/knip.ts +++ b/knip.ts @@ -10,8 +10,6 @@ const config: KnipConfig = { ignoreBinaries: [ // Has to be installed globally 'yalc', - // Used in package.json scripts (devDependency, so unlisted in production mode) - 'nps', // Pro package binaries used in Pro workflows 'playwright', 'e2e-test', @@ -112,6 +110,12 @@ const config: KnipConfig = { '**/app-react16/**/*', // Playwright support files and helpers - generated by cypress-on-rails gem 'e2e/playwright/support/**', + // Components and files used dynamically by React on Rails (registered at runtime) + 'client/app/actions/**', + 'client/app/components/**', + 'client/app/routes/**', + 'client/app/startup/**', + 'client/app/store/**', ], project: ['**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx}!', 'config/webpack/*.js'], paths: { @@ -124,9 +128,6 @@ const config: KnipConfig = { 'bin/.*', ], ignoreDependencies: [ - // Build-time dependencies not detected by Knip in any mode - '@babel/runtime', - 'mini-css-extract-plugin', // There's no ReScript plugin for Knip '@rescript/react', // The Babel plugin fails to detect it @@ -136,18 +137,27 @@ const config: KnipConfig = { 'node-libs-browser', // The below dependencies are not detected by the Webpack plugin // due to the config issue. - 'css-loader', 'expose-loader', 'file-loader', 'imports-loader', 'null-loader', - 'sass', - 'sass-loader', 'sass-resources-loader', 'style-loader', 'url-loader', // Transitive dependency of shakapacker but listed as direct dependency 'webpack-merge', + // Dependencies not detected in production mode + '@babel/runtime', + 'mini-css-extract-plugin', + 'css-loader', + 'sass', + 'sass-loader', + // Dependencies used dynamically by React on Rails + 'create-react-class', + 'react-helmet', + '@types/react-helmet', + 'react-redux', + 'react-router-dom', ], }, }, diff --git a/react_on_rails_pro/spec/dummy/bin/dev b/react_on_rails_pro/spec/dummy/bin/dev index 2daf77649c..9fb5cf7573 100755 --- a/react_on_rails_pro/spec/dummy/bin/dev +++ b/react_on_rails_pro/spec/dummy/bin/dev @@ -1,9 +1,5 @@ -#!/usr/bin/env bash +#!/usr/bin/env ruby +# frozen_string_literal: true -if ! command -v foreman &> /dev/null -then - echo "Installing foreman..." - gem install foreman -fi - -foreman start -f Procfile.dev +# This script calls the base dev script with a fixed route for the dummy app +exec File.join(__dir__, "../../../../lib/generators/react_on_rails/templates/base/base/bin/dev"), "--route=/", *ARGV diff --git a/spec/dummy/bin/dev b/spec/dummy/bin/dev deleted file mode 120000 index a253a84c49..0000000000 --- a/spec/dummy/bin/dev +++ /dev/null @@ -1 +0,0 @@ -../../../lib/generators/react_on_rails/templates/base/base/bin/dev \ No newline at end of file diff --git a/spec/dummy/bin/dev b/spec/dummy/bin/dev new file mode 100755 index 0000000000..de10fbc303 --- /dev/null +++ b/spec/dummy/bin/dev @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# This script calls the base dev script with a fixed route for the dummy app +exec File.join(__dir__, "../../../lib/generators/react_on_rails/templates/base/base/bin/dev"), "--route=/", *ARGV