Skip to content

Commit

Permalink
Merge pull request #1 from andrecego/feat/initial-project-configs
Browse files Browse the repository at this point in the history
Initial setup for project
  • Loading branch information
andrecego authored Feb 8, 2024
2 parents 7db580b + 0719cc9 commit 0701e1d
Show file tree
Hide file tree
Showing 10 changed files with 58 additions and 54 deletions.
17 changes: 7 additions & 10 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ gem 'bootsnap', '>= 1.4.4', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]
gem 'rspec-rails', '~> 6.0.0', groups: %i[development test]
gem 'factory_bot_rails', '~> 6.0.0',
gem 'rubocop', '~> 1.48', require: false
gem 'rubocop-performance', '~> 1.16', require: false
gem 'rubocop-rails', '~> 2.18', require: false
gem 'rubocop-rake', '~> 0.6.0', require: false
gem 'rubocop-rspec', '~> 2.19', require: false
end

group :development do
Expand All @@ -36,13 +43,3 @@ end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]

gem 'rspec-rails', '~> 6.0.0', groups: %i[development test]

gem 'factory_bot_rails', '~> 6.0.0', groups: %i[development test]

gem 'rubocop', '~> 1.48', groups: %i[development test], require: false
gem 'rubocop-performance', '~> 1.16', groups: %i[development test], require: false
gem 'rubocop-rails', '~> 2.18', groups: %i[development test], require: false
gem 'rubocop-rake', '~> 0.6.0', groups: %i[development test], require: false
gem 'rubocop-rspec', '~> 2.19', groups: %i[development test], require: false
26 changes: 0 additions & 26 deletions app/javascript/packs/hello_react.jsx

This file was deleted.

11 changes: 11 additions & 0 deletions app/javascript/packs/react_app.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
// like app/views/layouts/application.html.erb. All it does is render <div>Hello React</div> at the bottom
// of the page.

import React from 'react'
import { createRoot } from 'react-dom/client'
import Main from '@/main.jsx'

document.addEventListener('DOMContentLoaded', () => {
createRoot(document.getElementById('root')).render(<Main />)
})
3 changes: 3 additions & 0 deletions app/javascript/src/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.main {
padding: 20px;
}
17 changes: 17 additions & 0 deletions app/javascript/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'
import PropTypes from 'prop-types'
import './main.css'

const Main = props => (
<div className='main'>Hello {props.name}!</div>
)

Main.defaultProps = {
name: 'World'
}

Main.propTypes = {
name: PropTypes.string
}

export default Main
7 changes: 0 additions & 7 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +0,0 @@
<h1>Haistack Coding Challenge</h1>

<p>Coding challenge presented to candidates interviewing for a role at <a href="https://www.linkedin.com/company/haistack/">Haistack.AI</a>.</p>

<p><em>#findyourneedle</em></p>

<p>Copyright 2023 <a href="https://www.linkedin.com/company/haistack/">Haistack.AI</a></p>
2 changes: 2 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

<%= stylesheet_pack_tag 'application', media: 'all' %>
<%= javascript_pack_tag 'application' %>
<%= javascript_pack_tag 'react_app' %>
</head>

<body>
<div id="root"></div>
<%= yield %>
</body>
</html>
7 changes: 7 additions & 0 deletions config/webpack/environment.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
const { environment } = require('@rails/webpacker')

const path = require('path')

// Add alias for @ symbol
environment.config.set('resolve.alias', {
'@': path.resolve(__dirname, '..', '..', 'app/javascript/src')
})

module.exports = environment
11 changes: 11 additions & 0 deletions jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"module": "CommonJS",
"target": "ES6",
"baseUrl": ".",
"paths": {
"@/*": ["app/javascript/src/*"]
}
},
"exclude": ["node_modules"],
}
11 changes: 0 additions & 11 deletions spec/views/home/index.html.erb_spec.rb

This file was deleted.

0 comments on commit 0701e1d

Please sign in to comment.