Skip to content

Commit

Permalink
Wrap update_files calls in conditionals (#147)
Browse files Browse the repository at this point in the history
Co-authored-by: Grant Petersen-Speelman <grantspeelman@users.noreply.github.com>
  • Loading branch information
Judahmeek and grantspeelman committed Jan 4, 2024
1 parent 92ed2fd commit bce4b18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
### Changed
* Removed the update generator and reduced options for install generator [PR 149](https://github.com/shakacode/cypress-on-rails/pull/149)

### Fixed
* fix update index.js in install generatpr [PR 147](https://github.com/shakacode/cypress-on-rails/pull/147) by [Judahmeek]

## [1.16.0]
[Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.15.1...v1.16.0

Expand Down
16 changes: 10 additions & 6 deletions lib/generators/cypress_on_rails/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,16 @@ def add_initial_files
end

def update_files
append_to_file "#{options.cypress_folder}/support/index.js",
"\nimport './on-rails'",
after: 'import \'./commands\''
append_to_file "#{options.playwright_folder}/support/index.js",
"\nimport './on-rails'",
after: '// Import commands.js using ES2015 syntax:'
if options.framework == 'cypress'
append_to_file "#{options.install_folder}/cypress/support/index.js",
"\nimport './on-rails'",
after: 'import \'./commands\''
end
if options.framework == 'playwright'
append_to_file "#{options.install_folder}/playwright/support/index.js",
"\nimport './on-rails'",
after: '// Import commands.js using ES2015 syntax:'
end
end
end
end

0 comments on commit bce4b18

Please sign in to comment.