Correct bug in packroot

This commit is contained in:
Eric Schultz 2018-06-20 14:22:28 -05:00
parent 62b45b07b3
commit 39755dcd33
2 changed files with 4 additions and 4 deletions

View file

@ -3,8 +3,8 @@ module React
class PackrootGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
def copy_file_to_app
template 'page.ts.erb', "javascripts/app/#{file_name.underscore}.ts"
generate 'react:component', "#{file_name.underscore}/#{file_name.underscore}"
template 'page.tsx.erb', "javascripts/app/#{file_name.underscore}.tsx"
generate 'react:component', "#{file_name.underscore}/#{file_name.camelize}"
end
end
end

View file

@ -1,13 +1,13 @@
// License: LGPL-3.0-or-later
// require a root component here. This will be treated as the root of a webpack package
import Root from "../src/components/common/Root"
import RegistrationPage from "../src/components/<%= file_name.underscore%>/<%= file_name.underscore%>"
import <%=file_name.camelize %> from "../src/components/<%= file_name.underscore%>/<%= file_name.camelize%>"
import * as ReactDOM from 'react-dom'
import * as React from 'react'
function LoadReactPage(element:HTMLElement) {
ReactDOM.render(<Root><RegistrationPage/></Root>, element)
ReactDOM.render(<Root><<%=file_name.camelize %>/></Root>, element)
}