diff --git a/Gemfile b/Gemfile index 611f4f4c..69db4d93 100644 --- a/Gemfile +++ b/Gemfile @@ -7,6 +7,7 @@ gem "rails", "~> 6.1" gem "rails-i18n", "~> 7.0" gem "cssbundling-rails", "~> 1.1" +gem "jsbundling-rails", "~> 1.1" gem "sassc-rails" gem "sprockets", "~> 4.1" gem "sprockets-rails", require: "sprockets/railtie" diff --git a/Gemfile.lock b/Gemfile.lock index 5a759c3f..36cfcc00 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -224,6 +224,8 @@ GEM image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) + jsbundling-rails (1.1.1) + railties (>= 6.0.0) json (2.6.3) json-schema (3.0.0) addressable (>= 2.8) @@ -566,6 +568,7 @@ DEPENDENCIES hcaptcha (~> 7.0) httparty i18n-js (= 4.0) + jsbundling-rails (~> 1.1) json-schema jwt (~> 2.6) letter_opener diff --git a/Procfile.dev b/Procfile.dev index 8bbe0b92..bd494ae8 100644 --- a/Procfile.dev +++ b/Procfile.dev @@ -1,3 +1,4 @@ web: unset PORT && bin/rails server worker: bundle exec sidekiq css: yarn build:css --watch +js: yarn build --watch diff --git a/app/views/layouts/base.html.haml b/app/views/layouts/base.html.haml index ba091d29..6791f897 100644 --- a/app/views/layouts/base.html.haml +++ b/app/views/layouts/base.html.haml @@ -19,7 +19,7 @@ %link{ rel: 'icon', href: '/images/favicon/favicon-32.png', sizes: '32x32' } %title= yield(:title) = stylesheet_link_tag 'application', data: { 'turbo-track': 'reload' } - = javascript_pack_tag 'application', data: { 'turbo-track': 'reload' } + = javascript_include_tag 'application', data: { 'turbo-track': 'reload' }, defer: true = csrf_meta_tags = yield(:og) = yield(:meta) diff --git a/package.json b/package.json index 957a29b9..62b37072 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "scripts": { "lint": "yarn run eslint --ext .ts app/javascript", "lint:fix": "yarn run eslint --ext .ts app/javascript --fix", + "build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=assets", "build:css": "sass ./app/assets/stylesheets/application.sass.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules" }, "dependencies": { @@ -18,6 +19,7 @@ "cheet.js": "^0.3.3", "core-js": "^3.27.1", "croppr": "^2.3.1", + "esbuild": "^0.16.14", "i18n-js": "^4.0", "js-cookie": "2.2.1", "regenerator-runtime": "^0.13.11", diff --git a/yarn.lock b/yarn.lock index 2ed6799d..6c214434 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1079,6 +1079,116 @@ resolved "https://registry.yarnpkg.com/@csstools/convert-colors/-/convert-colors-1.4.0.tgz#ad495dc41b12e75d588c6db8b9834f08fa131eb7" integrity sha512-5a6wqoJV/xEdbRNKVo6I4hO3VjyDq//8q2f9I6PBAvMesJHFauXDorcNCsr9RzvsZnaWi5NYCcfyqP1QeFHFbw== +"@esbuild/android-arm64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.16.14.tgz#f02c9f0d43086ddf6ed2795b881ddf7990f74456" + integrity sha512-hTqB6Iq13pW4xaydeqQrs8vPntUnMjbkq+PgGiBMi69eYk74naG2ftHWqKnxn874kNrt5Or3rQ0PJutx2doJuQ== + +"@esbuild/android-arm@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.16.14.tgz#24e4faf569d0d6bbf9ed46f6ed395d68eb7f04fc" + integrity sha512-u0rITLxFIeYAvtJXBQNhNuV4YZe+MD1YvIWT7Nicj8hZAtRVZk2PgNH6KclcKDVHz1ChLKXRfX7d7tkbQBUfrg== + +"@esbuild/android-x64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.16.14.tgz#1173e706cf57c0d4dbf069d18e5d50ae6a5b0871" + integrity sha512-jir51K4J0K5Rt0KOcippjSNdOl7akKDVz5I6yrqdk4/m9y+rldGptQUF7qU4YpX8U61LtR+w2Tu2Ph+K/UaJOw== + +"@esbuild/darwin-arm64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.16.14.tgz#67f05693c5b097bcb4ff656ba5839459f30f79c2" + integrity sha512-vrlaP81IuwPaw1fyX8fHCmivP3Gr73ojVEZy+oWJLAiZVcG8o8Phwun/XDnYIFUHxIoUnMFEpg9o38MIvlw8zw== + +"@esbuild/darwin-x64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.16.14.tgz#519c9d127c5363d4a1e73b9d954460f798b41d2a" + integrity sha512-KV1E01eC2hGYA2qzFDRCK4wdZCRUvMwCNcobgpiiOzp5QXpJBqFPdxI69j8vvzuU7oxFXDgANwEkXvpeQqyOyg== + +"@esbuild/freebsd-arm64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.16.14.tgz#2e3f5de2951a8ec732a3e4ec4f5d47a7c9626001" + integrity sha512-xRM1RQsazSvL42BNa5XC7ytD4ZDp0ZyJcH7aB0SlYUcHexJUKiDNKR7dlRVlpt6W0DvoRPU2nWK/9/QWS4u2fw== + +"@esbuild/freebsd-x64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.16.14.tgz#d3cf84ff28357ac8d0123309bac37fcfcdd98f53" + integrity sha512-7ALTAn6YRRf1O6fw9jmn0rWmOx3XfwDo7njGtjy1LXhDGUjTY/vohEPM3ii5MQ411vJv1r498EEx2aBQTJcrEw== + +"@esbuild/linux-arm64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.16.14.tgz#f44b0e3d5d470cd763a9bc4855a12b8cb73d6c12" + integrity sha512-TLh2OcbBUQcMYRH4GbiDkDZfZ4t1A3GgmeXY27dHSI6xrU7IkO00MGBiJySmEV6sH3Wa6pAN6UtaVL0DwkGW4Q== + +"@esbuild/linux-arm@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.16.14.tgz#b239eb7e6cb7df9c34c6b08f4adf113da47e0e09" + integrity sha512-X6xULug66ulrr4IzrW7qq+eq9n4MtEyagdWvj4o4cmWr+JXOT47atjpDF9j5M2zHY0UQBmqnHhwl+tXpkpIb2w== + +"@esbuild/linux-ia32@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.16.14.tgz#f5f7886027cd61bed59178e981a0ef47ca5b72ef" + integrity sha512-oBZkcZ56UZDFCAfE3Fd/Jgy10EoS7Td77NzNGenM+HSY8BkdQAcI9VF9qgwdOLZ+tuftWD7UqZ26SAhtvA3XhA== + +"@esbuild/linux-loong64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.16.14.tgz#d2329371726f9778156c89ea0bed26fc1bc3cd7e" + integrity sha512-udz/aEHTcuHP+xdWOJmZ5C9RQXHfZd/EhCnTi1Hfay37zH3lBxn/fNs85LA9HlsniFw2zccgcbrrTMKk7Cn1Qg== + +"@esbuild/linux-mips64el@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.16.14.tgz#8af86bdc6ee937c8a2803b3c197b28824f48df8e" + integrity sha512-kJ2iEnikUOdC1SiTGbH0fJUgpZwa0ITDTvj9EHf9lm3I0hZ4Yugsb3M6XSl696jVxrEocLe519/8CbSpQWFSrg== + +"@esbuild/linux-ppc64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.16.14.tgz#3fa3f8c6c9db3127f2ec5b2eba1cec67ff9a9b8e" + integrity sha512-kclKxvZvX5YhykwlJ/K9ljiY4THe5vXubXpWmr7q3Zu3WxKnUe1VOZmhkEZlqtnJx31GHPEV4SIG95IqTdfgfg== + +"@esbuild/linux-riscv64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.16.14.tgz#1bd1b631de2533106a08876295bad3a19b20f629" + integrity sha512-fdwP9Dc+Kx/cZwp9T9kNqjAE/PQjfrxbio4rZ3XnC3cVvZBjuxpkiyu/tuCwt6SbAK5th6AYNjFdEV9kGC020A== + +"@esbuild/linux-s390x@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.16.14.tgz#c87440b6522b9a36a9cafd05b0f1ca3c5bad4cca" + integrity sha512-++fw3P4fQk9nqvdzbANRqimKspL8pDCnSpXomyhV7V/ISha/BZIYvZwLBWVKp9CVWKwWPJ4ktsezuLIvlJRHqA== + +"@esbuild/linux-x64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.16.14.tgz#49cd974dad6042ac0141ba332df6307c44e77fed" + integrity sha512-TomtswAuzBf2NnddlrS4W01Tv85RM9YtATB3OugY6On0PLM4Ksz5qvQKVAjtzPKoLgL1FiZtfc8mkZc4IgoMEA== + +"@esbuild/netbsd-x64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.16.14.tgz#53dcfb5131376feff0911adff7f01b4821706cf6" + integrity sha512-U06pfx8P5CqyoPNfqIJmnf+5/r4mJ1S62G4zE6eOjS59naQcxi6GnscUCPH3b+hRG0qdKoGX49RAyiqW+M9aSw== + +"@esbuild/openbsd-x64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.16.14.tgz#f36888f73087bcd12c5bf9a4b18e348da9c80ad0" + integrity sha512-/Jl8XVaWEZNu9rZw+n792GIBupQwHo6GDoapHSb/2xp/Ku28eK6QpR2O9cPBkzHH4OOoMH0LB6zg/qczJ5TTGg== + +"@esbuild/sunos-x64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.16.14.tgz#41e046bb0849ae59702a5cfa8be300431a61ee3a" + integrity sha512-2iI7D34uTbDn/TaSiUbEHz+fUa8KbN90vX5yYqo12QGpu6T8Jl+kxODsWuMCwoTVlqUpwfPV22nBbFPME9OPtw== + +"@esbuild/win32-arm64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.16.14.tgz#d6ed78742a6edd413e75796882ddaef8c1e23b93" + integrity sha512-SjlM7AHmQVTiGBJE/nqauY1aDh80UBsXZ94g4g60CDkrDMseatiqALVcIuElg4ZSYzJs8hsg5W6zS2zLpZTVgg== + +"@esbuild/win32-ia32@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.16.14.tgz#558bd53859a83fe887d7d2dcdc6cb3fc9aa9a9bc" + integrity sha512-z06t5zqk8ak0Xom5HG81z2iOQ1hNWYsFQp3sczVLVx+dctWdgl80tNRyTbwjaFfui2vFO12dfE3trCTvA+HO4g== + +"@esbuild/win32-x64@0.16.14": + version "0.16.14" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.16.14.tgz#90558dcb279989d92a42e5be4dfb884b2399361f" + integrity sha512-ED1UpWcM6lAbalbbQ9TrGqJh4Y9TaASUvu8bI/0mgJcxhSByJ6rbpgqRhxYMaQ682WfA71nxUreaTO7L275zrw== + "@eslint/eslintrc@^0.4.3": version "0.4.3" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" @@ -3258,6 +3368,34 @@ es-to-primitive@^1.2.1: is-date-object "^1.0.1" is-symbol "^1.0.2" +esbuild@^0.16.14: + version "0.16.14" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.16.14.tgz#366249a0a0fd431d3ab706195721ef1014198919" + integrity sha512-6xAn3O6ZZyoxZAEkwfI9hw4cEqSr/o1ViJtnkvImVkblmUN65Md04o0S/7H1WNu1XGf1Cjij/on7VO4psIYjkw== + optionalDependencies: + "@esbuild/android-arm" "0.16.14" + "@esbuild/android-arm64" "0.16.14" + "@esbuild/android-x64" "0.16.14" + "@esbuild/darwin-arm64" "0.16.14" + "@esbuild/darwin-x64" "0.16.14" + "@esbuild/freebsd-arm64" "0.16.14" + "@esbuild/freebsd-x64" "0.16.14" + "@esbuild/linux-arm" "0.16.14" + "@esbuild/linux-arm64" "0.16.14" + "@esbuild/linux-ia32" "0.16.14" + "@esbuild/linux-loong64" "0.16.14" + "@esbuild/linux-mips64el" "0.16.14" + "@esbuild/linux-ppc64" "0.16.14" + "@esbuild/linux-riscv64" "0.16.14" + "@esbuild/linux-s390x" "0.16.14" + "@esbuild/linux-x64" "0.16.14" + "@esbuild/netbsd-x64" "0.16.14" + "@esbuild/openbsd-x64" "0.16.14" + "@esbuild/sunos-x64" "0.16.14" + "@esbuild/win32-arm64" "0.16.14" + "@esbuild/win32-ia32" "0.16.14" + "@esbuild/win32-x64" "0.16.14" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40"