avo 2.14.3.pre.2.tailwindcss → 2.14.3.pre.3.jsbundling

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of avo might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 000cbbb5361f9e2b283d18b20421f360e510f1320563fa480060035b31070d2c
4
- data.tar.gz: ea51f134fedc9aacb232b4d5333d1d74807ffe93a32edc4daf46cc6c69cc0d3b
3
+ metadata.gz: 7ede274df957fa28cce74c79aee056b2e7da626cb5db843647cb56f3eeef8222
4
+ data.tar.gz: 5401228e96ad20d0e5d2e97937d8c83d135bdc666e7cf173166dd5b0d8c03ca5
5
5
  SHA512:
6
- metadata.gz: a696a065e0af86bb02b9d1b44ac26cee640baeae95207528890a4be21a38496f7282f3609edf6d4458c4ec65357c4526553d20300d51562fd1a1ed271280b47b
7
- data.tar.gz: 6f837374c20ef0a29b4382fefe9827de36f6c1543a9b7162c0ca9272d3fc1f99b4b5aff9823215f640711f86d9d33d106da69c819fcc111dc9d340361ad8bb78
6
+ metadata.gz: 8a4d2ac6b2011ddfd4dd8a6c699499dae18b6d3dbdfafaf31f2a27995f7c5d0301fa9b9e1927bba0efa16cc7207679265751500f07dfec247abfde869922b783
7
+ data.tar.gz: 0c7f1c148088882099d1c5f0c197b16232fa4f9300d6c422ad8db6fcd731b9386c9a1d3db29ab8dd7a588c3539a821e274afce051aaec87f6d1c8816865d265b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.14.3.pre.2.tailwindcss)
4
+ avo (2.14.3.pre.3.jsbundling)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
File without changes
@@ -9,10 +9,10 @@
9
9
  <%= render partial: 'avo/partials/head' %>
10
10
  <% if Avo::PACKED %>
11
11
  <%= javascript_include_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
12
- <%= stylesheet_link_tag "/avo-assets/avo.base", "data-turbo-track": "reload", defer: true %>
12
+ <%= stylesheet_link_tag "/avo-assets/avo", "data-turbo-track": "reload", defer: true %>
13
13
  <% else %>
14
14
  <%= javascript_include_tag "avo.base", "data-turbo-track": "reload", defer: true %>
15
- <%= stylesheet_link_tag "avo.base", "data-turbo-track": "reload", defer: true %>
15
+ <%= stylesheet_link_tag "avo", "data-turbo-track": "reload", defer: true %>
16
16
  <% if Rails.env.development? %>
17
17
  <%= javascript_include_tag "hotwire-livereload", defer: true %>
18
18
  <% end %>
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "2.14.3.pre.2.tailwindcss" unless const_defined?(:VERSION)
2
+ VERSION = "2.14.3.pre.3.jsbundling" unless const_defined?(:VERSION)
3
3
  end
@@ -7,11 +7,7 @@ module Generators
7
7
 
8
8
  def initialize(*args)
9
9
  super(*args)
10
-
11
- # Don't output the version if requested so
12
- unless args.include?(["--no-avo-version"])
13
- invoke "avo:version", *args
14
- end
10
+ invoke "avo:version", *args
15
11
  end
16
12
  end
17
13
  end
@@ -0,0 +1,64 @@
1
+ require_relative "../base_generator"
2
+
3
+ module Generators
4
+ module Avo
5
+ module Js
6
+ class InstallGenerator < BaseGenerator
7
+ source_root File.expand_path("../templates", __dir__)
8
+
9
+ namespace "avo:js:install"
10
+ desc "Add custom JavaScript assets to your Avo project."
11
+
12
+ # possible values: importmap or esbuild
13
+ class_option :bundler, type: :string, default: "importmap"
14
+
15
+ def create_files
16
+ case options[:bundler].to_s
17
+ when "importmap"
18
+ install_for_importmap
19
+ when "esbuild"
20
+ install_for_esbuild
21
+ else
22
+ say "We don't know how to install Avo JS for this bundler \"#{options[:bundler]}\""
23
+ end
24
+ end
25
+
26
+ no_tasks do
27
+ def install_for_importmap
28
+ unless Rails.root.join("app", "javascript", "avo.custom.js").exist?
29
+ say "Add default app/javascript/avo.custom.js"
30
+ copy_file template_path("avo.custom.js"), "app/javascript/avo.custom.js"
31
+ end
32
+
33
+ say "Ejecting the _head.html.erb partial"
34
+ Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
35
+
36
+ say "Adding the JS asset to the partial"
37
+ append_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= javascript_importmap_tags \"avo.custom\" %>"
38
+
39
+ # pin to importmap
40
+ say "Pin the new entrypoint to your importmap config"
41
+ append_to_file Rails.root.join("config", "importmap.rb"), "\n# Avo custom JS entrypoint\npin \"avo.custom\", preload: true\n"
42
+ end
43
+
44
+ def install_for_esbuild
45
+ unless Rails.root.join("app", "javascript", "avo.custom.js").exist?
46
+ say "Add default app/javascript/avo.custom.js"
47
+ copy_file template_path("avo.custom.js"), "app/javascript/avo.custom.js"
48
+ end
49
+
50
+ say "Ejecting the _head.html.erb partial"
51
+ Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
52
+
53
+ say "Adding the JS asset to the partial"
54
+ append_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= javascript_include_tag \"avo.custom\", \"data-turbo-track\": \"reload\", defer: true %>"
55
+ end
56
+
57
+ def template_path(filename)
58
+ Pathname.new(__dir__).join("..", "templates", "js", filename).to_s
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line no-console
2
+ console.log('Hi from Avo custom JS 👋')
@@ -3,9 +3,9 @@
3
3
  # # Task goes here
4
4
  # end
5
5
 
6
- desc "Installs Avo assets and bundles them for when you want to use the GitHub repo in your app"
7
- task "avo:build-assets" do
8
- spec = get_gem_spec "avo"
6
+ desc 'Installs Avo assets and bundles them for when you want to use the GitHub repo in your app'
7
+ task 'avo:build-assets' do
8
+ spec = get_gem_spec 'avo'
9
9
  # Uncomment to enable only when the source is github.com
10
10
  # enabled = spec.source.to_s.include?('https://github.com/avo-hq/avo')
11
11
  enabled = true
@@ -15,8 +15,8 @@ task "avo:build-assets" do
15
15
  path = spec.full_gem_path
16
16
 
17
17
  Dir.chdir(path) do
18
- system "yarn"
19
- system "yarn prod:build"
18
+ system 'yarn'
19
+ system 'yarn prod:build'
20
20
  end
21
21
 
22
22
  puts "Done"
@@ -28,10 +28,10 @@ end
28
28
  # From
29
29
  # https://stackoverflow.com/questions/9322078/programmatically-determine-gems-path-using-bundler
30
30
  def get_gem_spec(name)
31
- spec = Bundler.load.specs.find { |s| s.name == name }
31
+ spec = Bundler.load.specs.find{|s| s.name == name }
32
32
  raise GemNotFound, "Could not find gem '#{name}' in the current bundle." unless spec
33
- if spec.name == "bundler"
34
- return File.expand_path("../../../", __FILE__)
33
+ if spec.name == 'bundler'
34
+ return File.expand_path('../../../', __FILE__)
35
35
  end
36
36
 
37
37
  spec
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.3.pre.2.tailwindcss
4
+ version: 2.14.3.pre.3.jsbundling
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Marin
@@ -263,7 +263,7 @@ files:
263
263
  - README.md
264
264
  - Rakefile
265
265
  - app/assets/config/avo_manifest.js
266
- - app/assets/stylesheets/avo.base.css
266
+ - app/assets/stylesheets/avo.css
267
267
  - app/assets/stylesheets/css/active-storage.css
268
268
  - app/assets/stylesheets/css/breadcrumbs.css
269
269
  - app/assets/stylesheets/css/buttons.css
@@ -1887,11 +1887,11 @@ files:
1887
1887
  - lib/generators/avo/field_generator.rb
1888
1888
  - lib/generators/avo/filter_generator.rb
1889
1889
  - lib/generators/avo/install_generator.rb
1890
+ - lib/generators/avo/js/install_generator.rb
1890
1891
  - lib/generators/avo/locales_generator.rb
1891
1892
  - lib/generators/avo/named_base_generator.rb
1892
1893
  - lib/generators/avo/resource_generator.rb
1893
1894
  - lib/generators/avo/resource_tool_generator.rb
1894
- - lib/generators/avo/tailwindcss/install_generator.rb
1895
1895
  - lib/generators/avo/templates/action.tt
1896
1896
  - lib/generators/avo/templates/cards/chartkick_card.tt
1897
1897
  - lib/generators/avo/templates/cards/chartkick_card_sample.tt
@@ -1913,6 +1913,7 @@ files:
1913
1913
  - lib/generators/avo/templates/filters/select_filter.tt
1914
1914
  - lib/generators/avo/templates/filters/text_filter.tt
1915
1915
  - lib/generators/avo/templates/initializer/avo.tt
1916
+ - lib/generators/avo/templates/js/avo.custom.js
1916
1917
  - lib/generators/avo/templates/locales/avo.en.yml
1917
1918
  - lib/generators/avo/templates/locales/avo.fr.yml
1918
1919
  - lib/generators/avo/templates/locales/avo.nb-NO.yml
@@ -1923,18 +1924,15 @@ files:
1923
1924
  - lib/generators/avo/templates/resource_tools/partial.tt
1924
1925
  - lib/generators/avo/templates/resource_tools/resource_tool.tt
1925
1926
  - lib/generators/avo/templates/standalone_action.tt
1926
- - lib/generators/avo/templates/tailwindcss/Procfile.dev
1927
- - lib/generators/avo/templates/tailwindcss/avo.tailwind.css
1928
1927
  - lib/generators/avo/templates/tool/controller.tt
1929
1928
  - lib/generators/avo/templates/tool/sidebar_item.tt
1930
1929
  - lib/generators/avo/templates/tool/view.tt
1931
1930
  - lib/generators/avo/tool_generator.rb
1932
1931
  - lib/generators/avo/version_generator.rb
1933
1932
  - lib/tasks/avo_tasks.rake
1934
- - lib/tasks/tailwindcss_rails.rake
1935
- - public/avo-assets/avo.base.css
1936
1933
  - public/avo-assets/avo.base.js
1937
1934
  - public/avo-assets/avo.base.js.map
1935
+ - public/avo-assets/avo.css
1938
1936
  - public/avo-assets/fonts/inter-v7-latin-500.eot
1939
1937
  - public/avo-assets/fonts/inter-v7-latin-500.svg
1940
1938
  - public/avo-assets/fonts/inter-v7-latin-500.ttf
@@ -1,54 +0,0 @@
1
- require_relative "../base_generator"
2
-
3
- module Generators
4
- module Avo
5
- module Tailwindcss
6
- class InstallGenerator < BaseGenerator
7
- source_root File.expand_path("../templates", __dir__)
8
-
9
- namespace "avo:tailwindcss:install"
10
- desc "Add Tailwindcss to your Avo project."
11
-
12
- def create_files
13
- unless tailwindcss_installed?
14
- system "./bin/bundle add tailwindcss-rails"
15
- system "./bin/rails tailwindcss:install"
16
- end
17
-
18
- unless Rails.root.join("app", "assets", "stylesheets", "avo.tailwind.css").exist?
19
- say "Add default app/assets/stylesheets/avo.tailwind.css"
20
- copy_file template_path("avo.tailwind.css"), "app/assets/stylesheets/avo.tailwind.css"
21
- end
22
-
23
- if Rails.root.join("Procfile.dev").exist?
24
- append_to_file "Procfile.dev", "css: bin/rails avo:tailwindcss:watch\n"
25
- else
26
- say "Add default Procfile.dev"
27
- copy_file template_path("Procfile.dev"), "Procfile.dev"
28
-
29
- say "Ensure foreman is installed"
30
- run "gem install foreman"
31
- end
32
-
33
- append_to_file "Procfile.dev", "avo_css: bin/rails tailwindcss:watch\n"
34
-
35
- say "Ejecting the _head.html.erb partial"
36
- Rails::Generators.invoke("avo:eject", [":head", "--no-avo-version"], {destination_root: Rails.root})
37
-
38
- say "Adding the CSS asset to the partial"
39
- prepend_to_file Rails.root.join("app", "views", "avo", "partials", "_head.html.erb"), "<%= stylesheet_link_tag \"avo.tailwind.css\", media: \"all\" %>"
40
- end
41
-
42
- no_tasks do
43
- def template_path(filename)
44
- Pathname.new(__dir__).join("..", "templates", "tailwindcss", filename).to_s
45
- end
46
-
47
- def tailwindcss_installed?
48
- Rails.root.join("config", "tailwind.config.js").exist? || Rails.root.join("tailwind.config.js").exist?
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,2 +0,0 @@
1
- web: bin/rails server -p 3000
2
- css: bin/rails avo:tailwindcss:watch
@@ -1,13 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- /*
6
-
7
- @layer components {
8
- .btn-primary {
9
- @apply py-2 px-4 bg-blue-200;
10
- }
11
- }
12
-
13
- */
@@ -1,24 +0,0 @@
1
- # Use the user provided asset or use the default
2
- ASSET_FILE = ARGV[0] || "app/assets/builds/avo.tailwind.css"
3
- # Se the tailwindcss-rails package name
4
- TAILWINDCSS_RAILS = "tailwindcss-rails"
5
-
6
- # Check if tailwindcss-rails is being used
7
- if Gem.loaded_specs.key? TAILWINDCSS_RAILS
8
- # Get the path
9
- GEM_PATH = Gem.loaded_specs[TAILWINDCSS_RAILS].full_gem_path
10
- # Compose the compile command
11
- AVO_TAILWIND_COMPILE_COMMAND = "#{RbConfig.ruby} #{Pathname.new(GEM_PATH)}/exe/tailwindcss -i '#{Rails.root.join("app/assets/stylesheets/avo.css")}' -o '#{Rails.root.join(ASSET_FILE)}' -c '#{Rails.root.join("config/tailwind.config.js")}' --minify"
12
-
13
- namespace "avo:tailwindcss" do
14
- desc "Build your Tailwind CSS"
15
- task :build do
16
- system(AVO_TAILWIND_COMPILE_COMMAND, exception: true)
17
- end
18
-
19
- desc "Watch and build your Tailwind CSS on file changes"
20
- task :watch do
21
- system "#{AVO_TAILWIND_COMPILE_COMMAND} -w"
22
- end
23
- end
24
- end