fixlr / codemirror-rails

Use CodeMirror with Rails
https://rubygems.org/gems/codemirror-rails
MIT License
159 stars 87 forks source link

rails 6 support #61

Open vpereira opened 5 years ago

vpereira commented 5 years ago

Hi, trying to update a rails from 5.2 to 6.0 and codemirror-rails is blocking it.

from bundle update rails I get the following error:

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    codemirror-rails was resolved to 5.16.0, which depends on
      railties (< 6.0, >= 3.0)
fixlr commented 5 years ago

Hi @vpereira. I'm not planning on updating this gem for modern versions of Rails. This gem was created during a time long before we had official support for managing JavaScript dependencies via yarn, and it contains no other ruby code that would require it to be distributed as a gem.

If you're maintaining a Rails application that is configured with yarn, I would recommend using the official codemirror package instead.

If you haven't configured npm or yarn, and don't want to, the official codemirror releases have always been available at codemirror.net. You can download the latest release, unzip it, and copy the files you need into vendor/assets/.

epugh commented 2 years ago

Would it be worth archiving this project to indicate that it's no longer being updated?

jaigouk commented 2 years ago

for rails 6 without adding raw package in vendor/assets, I used npm package

app/assets/javascripts/application.js

//= require jquery
//= require codemirror/lib/codemirror

//= require_tree .

config/webpack/environment.js

const { environment } = require('@rails/webpacker')
const webpack = require('webpack')

// // Adds `var CodeMirror = require('codemirror') to legacy codemirror plugins
environment.plugins.append(
  'Provide',
  new webpack.ProvidePlugin({
    CodeMirror: 'codemirror/src/codemirror',
    CodeMirror: 'codemirror/src/codemirror',
  }),
)
module.exports = environment

package.json

"codemirror": "^5.65.9"