diff --git a/.gitignore b/.gitignore index 85fe9d1..91a5bdf 100644 --- a/.gitignore +++ b/.gitignore @@ -30,4 +30,8 @@ # Ignore master key for decrypting credentials and more. /config/master.key -.env \ No newline at end of file +.env +/app/assets/builds/* +!/app/assets/builds/.keep + +/node_modules diff --git a/Gemfile b/Gemfile index 514376c..a33ae6b 100644 --- a/Gemfile +++ b/Gemfile @@ -11,7 +11,7 @@ gem "pg", "~> 1.1" gem "puma", "~> 5.0" -gem "importmap-rails" +gem "jsbundling-rails" gem "turbo-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 63fcdbc..def0681 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -136,9 +136,6 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) - importmap-rails (1.1.5) - actionpack (>= 6.0.0) - railties (>= 6.0.0) inherited_resources (1.13.1) actionpack (>= 5.2, < 7.1) has_scope (~> 0.6) @@ -154,6 +151,8 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + jsbundling-rails (1.0.3) + railties (>= 6.0.0) jwt (2.4.1) kaminari (1.2.2) activesupport (>= 4.1.0) @@ -348,8 +347,8 @@ DEPENDENCIES graphql (~> 2.0) graphql_playground-rails image_processing (~> 1.2) - importmap-rails jbuilder + jsbundling-rails omniauth (~> 1.9.1) omniauth-google-oauth2 (~> 0.8.2) pg (~> 1.1) diff --git a/Procfile.dev b/Procfile.dev new file mode 100644 index 0000000..03c54b1 --- /dev/null +++ b/Procfile.dev @@ -0,0 +1,2 @@ +web: bin/rails server -p 3000 +js: yarn build --watch diff --git a/app/assets/builds/.keep b/app/assets/builds/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js index ddd546a..338a0e8 100644 --- a/app/assets/config/manifest.js +++ b/app/assets/config/manifest.js @@ -1,4 +1,3 @@ //= link_tree ../images //= link_directory ../stylesheets .css -//= link_tree ../../javascript .js -//= link_tree ../../../vendor/javascript .js +//= link_tree ../builds diff --git a/app/controllers/entrypoint_controller.rb b/app/controllers/entrypoint_controller.rb new file mode 100644 index 0000000..a0eab01 --- /dev/null +++ b/app/controllers/entrypoint_controller.rb @@ -0,0 +1,4 @@ +class EntrypointController < ApplicationController + def index + end +end diff --git a/app/javascript/application.js b/app/javascript/application.js deleted file mode 100644 index 0d7b494..0000000 --- a/app/javascript/application.js +++ /dev/null @@ -1,3 +0,0 @@ -// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails -import "@hotwired/turbo-rails" -import "controllers" diff --git a/app/javascript/application.ts b/app/javascript/application.ts new file mode 100644 index 0000000..8ca1b03 --- /dev/null +++ b/app/javascript/application.ts @@ -0,0 +1 @@ +console.log('Hello, Typescript!') \ No newline at end of file diff --git a/app/views/entrypoint/index.html.erb b/app/views/entrypoint/index.html.erb new file mode 100644 index 0000000..470a4be --- /dev/null +++ b/app/views/entrypoint/index.html.erb @@ -0,0 +1,2 @@ +
Find me in app/views/entrypoint/index.html.erb
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 1f69897..f2d9d10 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,7 +7,7 @@ <%= csp_meta_tag %> <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> - <%= javascript_importmap_tags %> + <%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %> diff --git a/bin/dev b/bin/dev new file mode 100755 index 0000000..c1cb98b --- /dev/null +++ b/bin/dev @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if ! foreman version &> /dev/null +then + echo "Installing foreman..." + gem install foreman +fi + +foreman start -f Procfile.dev "$@" diff --git a/config/cable.yml b/config/cable.yml index 2571aca..b4f2cec 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -1,6 +1,5 @@ development: - adapter: redis - url: redis://localhost:6379/1 + adapter: async test: adapter: test diff --git a/config/routes.rb b/config/routes.rb index c0157cd..352b3d5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,13 @@ Rails.application.routes.draw do devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' } + + root to: "entrypoint#index" + get "*all" => "entrypoint#index", constraints: lambda { |req| + ["playground", "rails", "graphql"].filter do |path| + req.path.include?(path) + end.blank? + } + post "/graphql", to: "graphql#execute" ActiveAdmin.routes(self) diff --git a/package.json b/package.json new file mode 100644 index 0000000..149d49f --- /dev/null +++ b/package.json @@ -0,0 +1,10 @@ +{ + "name": "app", + "private": "true", + "dependencies": { + "esbuild": "^0.14.49" + }, + "scripts": { + "build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..b002517 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,129 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +esbuild-android-64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-android-64/-/esbuild-android-64-0.14.49.tgz#9e4682c36dcf6e7b71b73d2a3723a96e0fdc5054" + integrity sha512-vYsdOTD+yi+kquhBiFWl3tyxnj2qZJsl4tAqwhT90ktUdnyTizgle7TjNx6Ar1bN7wcwWqZ9QInfdk2WVagSww== + +esbuild-android-arm64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-android-arm64/-/esbuild-android-arm64-0.14.49.tgz#9861b1f7e57d1dd1f23eeef6198561c5f34b51f6" + integrity sha512-g2HGr/hjOXCgSsvQZ1nK4nW/ei8JUx04Li74qub9qWrStlysaVmadRyTVuW32FGIpLQyc5sUjjZopj49eGGM2g== + +esbuild-darwin-64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-darwin-64/-/esbuild-darwin-64-0.14.49.tgz#fd30a5ebe28704a3a117126c60f98096c067c8d1" + integrity sha512-3rvqnBCtX9ywso5fCHixt2GBCUsogNp9DjGmvbBohh31Ces34BVzFltMSxJpacNki96+WIcX5s/vum+ckXiLYg== + +esbuild-darwin-arm64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.49.tgz#c04a3a57dad94a972c66a697a68a25aa25947f41" + integrity sha512-XMaqDxO846srnGlUSJnwbijV29MTKUATmOLyQSfswbK/2X5Uv28M9tTLUJcKKxzoo9lnkYPsx2o8EJcTYwCs/A== + +esbuild-freebsd-64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-64/-/esbuild-freebsd-64-0.14.49.tgz#c404dbd66c98451395b1eef0fa38b73030a7be82" + integrity sha512-NJ5Q6AjV879mOHFri+5lZLTp5XsO2hQ+KSJYLbfY9DgCu8s6/Zl2prWXVANYTeCDLlrIlNNYw8y34xqyLDKOmQ== + +esbuild-freebsd-arm64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-freebsd-arm64/-/esbuild-freebsd-arm64-0.14.49.tgz#b62cec96138ebc5937240ce3e1b97902963ea74a" + integrity sha512-lFLtgXnAc3eXYqj5koPlBZvEbBSOSUbWO3gyY/0+4lBdRqELyz4bAuamHvmvHW5swJYL7kngzIZw6kdu25KGOA== + +esbuild-linux-32@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-linux-32/-/esbuild-linux-32-0.14.49.tgz#495b1cc011b8c64d8bbaf65509c1e7135eb9ddbf" + integrity sha512-zTTH4gr2Kb8u4QcOpTDVn7Z8q7QEIvFl/+vHrI3cF6XOJS7iEI1FWslTo3uofB2+mn6sIJEQD9PrNZKoAAMDiA== + +esbuild-linux-64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-linux-64/-/esbuild-linux-64-0.14.49.tgz#3f28dd8f986e6ff42f38888ee435a9b1fb916a56" + integrity sha512-hYmzRIDzFfLrB5c1SknkxzM8LdEUOusp6M2TnuQZJLRtxTgyPnZZVtyMeCLki0wKgYPXkFsAVhi8vzo2mBNeTg== + +esbuild-linux-arm64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm64/-/esbuild-linux-arm64-0.14.49.tgz#a52e99ae30246566dc5f33e835aa6ca98ef70e33" + integrity sha512-KLQ+WpeuY+7bxukxLz5VgkAAVQxUv67Ft4DmHIPIW+2w3ObBPQhqNoeQUHxopoW/aiOn3m99NSmSV+bs4BSsdA== + +esbuild-linux-arm@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-linux-arm/-/esbuild-linux-arm-0.14.49.tgz#7c33d05a64ec540cf7474834adaa57b3167bbe97" + integrity sha512-iE3e+ZVv1Qz1Sy0gifIsarJMQ89Rpm9mtLSRtG3AH0FPgAzQ5Z5oU6vYzhc/3gSPi2UxdCOfRhw2onXuFw/0lg== + +esbuild-linux-mips64le@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-linux-mips64le/-/esbuild-linux-mips64le-0.14.49.tgz#ed062bd844b587be649443831eb84ba304685f25" + integrity sha512-n+rGODfm8RSum5pFIqFQVQpYBw+AztL8s6o9kfx7tjfK0yIGF6tm5HlG6aRjodiiKkH2xAiIM+U4xtQVZYU4rA== + +esbuild-linux-ppc64le@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-linux-ppc64le/-/esbuild-linux-ppc64le-0.14.49.tgz#c0786fb5bddffd90c10a2078181513cbaf077958" + integrity sha512-WP9zR4HX6iCBmMFH+XHHng2LmdoIeUmBpL4aL2TR8ruzXyT4dWrJ5BSbT8iNo6THN8lod6GOmYDLq/dgZLalGw== + +esbuild-linux-riscv64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-linux-riscv64/-/esbuild-linux-riscv64-0.14.49.tgz#579b0e7cc6fce4bfc698e991a52503bb616bec49" + integrity sha512-h66ORBz+Dg+1KgLvzTVQEA1LX4XBd1SK0Fgbhhw4akpG/YkN8pS6OzYI/7SGENiN6ao5hETRDSkVcvU9NRtkMQ== + +esbuild-linux-s390x@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-linux-s390x/-/esbuild-linux-s390x-0.14.49.tgz#09eb15c753e249a500b4e28d07c5eef7524a9740" + integrity sha512-DhrUoFVWD+XmKO1y7e4kNCqQHPs6twz6VV6Uezl/XHYGzM60rBewBF5jlZjG0nCk5W/Xy6y1xWeopkrhFFM0sQ== + +esbuild-netbsd-64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-netbsd-64/-/esbuild-netbsd-64-0.14.49.tgz#f7337cd2bddb7cc9d100d19156f36c9ca117b58d" + integrity sha512-BXaUwFOfCy2T+hABtiPUIpWjAeWK9P8O41gR4Pg73hpzoygVGnj0nI3YK4SJhe52ELgtdgWP/ckIkbn2XaTxjQ== + +esbuild-openbsd-64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-openbsd-64/-/esbuild-openbsd-64-0.14.49.tgz#1f8bdc49f8a44396e73950a3fb6b39828563631d" + integrity sha512-lP06UQeLDGmVPw9Rg437Btu6J9/BmyhdoefnQ4gDEJTtJvKtQaUcOQrhjTq455ouZN4EHFH1h28WOJVANK41kA== + +esbuild-sunos-64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-sunos-64/-/esbuild-sunos-64-0.14.49.tgz#47d042739365b61aa8ca642adb69534a8eef9f7a" + integrity sha512-4c8Zowp+V3zIWje329BeLbGh6XI9c/rqARNaj5yPHdC61pHI9UNdDxT3rePPJeWcEZVKjkiAS6AP6kiITp7FSw== + +esbuild-windows-32@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-windows-32/-/esbuild-windows-32-0.14.49.tgz#79198c88ec9bde163c18a6b430c34eab098ec21a" + integrity sha512-q7Rb+J9yHTeKr9QTPDYkqfkEj8/kcKz9lOabDuvEXpXuIcosWCJgo5Z7h/L4r7rbtTH4a8U2FGKb6s1eeOHmJA== + +esbuild-windows-64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-windows-64/-/esbuild-windows-64-0.14.49.tgz#b36b230d18d1ee54008e08814c4799c7806e8c79" + integrity sha512-+Cme7Ongv0UIUTniPqfTX6mJ8Deo7VXw9xN0yJEN1lQMHDppTNmKwAM3oGbD/Vqff+07K2gN0WfNkMohmG+dVw== + +esbuild-windows-arm64@0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.14.49.tgz#d83c03ff6436caf3262347cfa7e16b0a8049fae7" + integrity sha512-v+HYNAXzuANrCbbLFJ5nmO3m5y2PGZWLe3uloAkLt87aXiO2mZr3BTmacZdjwNkNEHuH3bNtN8cak+mzVjVPfA== + +esbuild@^0.14.49: + version "0.14.49" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.14.49.tgz#b82834760eba2ddc17b44f05cfcc0aaca2bae492" + integrity sha512-/TlVHhOaq7Yz8N1OJrjqM3Auzo5wjvHFLk+T8pIue+fhnhIMpfAzsG6PLVMbFveVxqD2WOp3QHei+52IMUNmCw== + optionalDependencies: + esbuild-android-64 "0.14.49" + esbuild-android-arm64 "0.14.49" + esbuild-darwin-64 "0.14.49" + esbuild-darwin-arm64 "0.14.49" + esbuild-freebsd-64 "0.14.49" + esbuild-freebsd-arm64 "0.14.49" + esbuild-linux-32 "0.14.49" + esbuild-linux-64 "0.14.49" + esbuild-linux-arm "0.14.49" + esbuild-linux-arm64 "0.14.49" + esbuild-linux-mips64le "0.14.49" + esbuild-linux-ppc64le "0.14.49" + esbuild-linux-riscv64 "0.14.49" + esbuild-linux-s390x "0.14.49" + esbuild-netbsd-64 "0.14.49" + esbuild-openbsd-64 "0.14.49" + esbuild-sunos-64 "0.14.49" + esbuild-windows-32 "0.14.49" + esbuild-windows-64 "0.14.49" + esbuild-windows-arm64 "0.14.49"