Conversation
kylesmile
left a comment
There was a problem hiding this comment.
One thing we'll want to keep in mind is that this repo is public at the moment, whereas LightningCAD is private. We'll want to be mindful of how much L.CAD-specific code ends up in this repo.
| @@ -0,0 +1,123 @@ | |||
| export default { | |||
There was a problem hiding this comment.
Probably better to just use the ESLint config provided by the generic (non-L.CAD) generator. There might be changes from projects that could be good to bring in to our base config.
| say 'Adding jasmine' | ||
| run "yarn add --dev jasmine@^5.1.0" | ||
|
|
||
| run 'npm pkg set scripts.test_shared="NODE_ENV=test NODE_PATH="./node_modules:./app/javascript:$NODE_PATH" jasmine --config=jasmine.json"' |
There was a problem hiding this comment.
I don't think NODE_PATH works with ESM, but we can add a custom import hook to replicate the behavior.
| say 'Updating esbuild loader in the config' | ||
|
|
||
| insert_into_file 'webpack.config.js', " include: /app\\/javascript|@rolemodel\\/lightning-cad/,\n", before: " loader: 'esbuild-loader'," | ||
| gsub_file 'webpack.config.js', 'es2021', 'esnext' |
There was a problem hiding this comment.
We probably don't want to change the output target.
| def update_esbuild_loader | ||
| say 'Updating esbuild loader in the config' | ||
|
|
||
| insert_into_file 'webpack.config.js', " include: /app\\/javascript|@rolemodel\\/lightning-cad/,\n", before: " loader: 'esbuild-loader'," |
There was a problem hiding this comment.
I don't think this is needed, since the base config doesn't seem to exclude node_modules from being processed with esbuild-loader.
a32aac9 to
62a7dd6
Compare
a3e66e0 to
1900cf7
Compare
|
@Malachirwin Looks like there is a lot here. Since LightningCAD apps are a thing unto themselves, would it make sense to convert this into a stand alone application template instead? That may be easier to maintain over time & across major Rails versions. That wouldn't prevent you from making use of generators in the gem_group :development do
gem 'rolemodel_rails', github: 'RoleModel/rolemodel_rails'
end
# ...
after_bundle do
rails_command('generate rolemodel:slim')
rails_command('generate rolemodel:webpack') if yes?('Use Webpack?')
rails_command('generate rolemodel:testing:all')
endcc @kylesmile , @Jeremy-Walton |
1900cf7 to
9d6cb01
Compare
|
@OutlawAndy @Malachirwin I like this idea. Seems like a sensible way to move this forward.
|
Why?
The former system for spinning up a L.CAD app doesn't work in the slightest and was not worth repairing. This pulls some pieces from that but is implemented on
rolemodel_railsWhat Changed
What the generator adds
.npmrc.eslintrc.jsjavascript/config/initializers/smartJSON.jsjavascript/components/LocalIconFactory.jsxjavascript/components/MaterialIcon.jsxcontrollers/editor_controller.rbviews/editor/editor.html.slimjavascript/components/App.jsxjasmine.jsonspec/javascript/shared/TestSetup.jsspec/javascript/shared/testSpec.jsLater
This doesn't fully support the setup for persisted project setup which is most of the use case we need to setup. This only replaces the old generators that don't work. After we have the replacement we can look at some of those other bells and whistles.