potassium 6.6.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +37 -0
  3. data/README.md +8 -1
  4. data/lib/potassium/assets/.circleci/config.yml.erb +31 -12
  5. data/lib/potassium/assets/.eslintrc.json +15 -8
  6. data/lib/potassium/assets/.rubocop.yml +62 -1
  7. data/lib/potassium/assets/README.yml +3 -9
  8. data/lib/potassium/assets/app/frontend/active_admin/jquery.js +2 -0
  9. data/lib/potassium/assets/app/frontend/api/__mocks__/index.mock.ts +3 -0
  10. data/lib/potassium/assets/app/frontend/api/index.ts +63 -0
  11. data/lib/potassium/assets/app/frontend/css/application.css +3 -0
  12. data/lib/potassium/assets/app/frontend/entrypoints/active_admin.js +7 -0
  13. data/lib/potassium/assets/app/frontend/entrypoints/active_admin.scss +38 -0
  14. data/lib/potassium/assets/app/frontend/entrypoints/application.js +12 -0
  15. data/lib/potassium/assets/app/{javascript → frontend}/types/vue.d.ts +1 -0
  16. data/lib/potassium/assets/app/frontend/utils/case-converter.ts +39 -0
  17. data/lib/potassium/assets/app/frontend/utils/csrf-token.ts +9 -0
  18. data/lib/potassium/assets/bin/setup.erb +1 -1
  19. data/lib/potassium/assets/bin/update.erb +1 -1
  20. data/lib/potassium/assets/config/sentry.rb.erb +2 -10
  21. data/lib/potassium/assets/lib/dotenv_monkeypatch.rb +19 -0
  22. data/lib/potassium/assets/package.json +7 -0
  23. data/lib/potassium/assets/tailwind.config.js +14 -0
  24. data/lib/potassium/assets/testing/simplecov_config.rb +9 -1
  25. data/lib/potassium/assets/tsconfig.config.json +8 -0
  26. data/lib/potassium/assets/tsconfig.json +11 -26
  27. data/lib/potassium/assets/vite.config.ts +46 -0
  28. data/lib/potassium/cli_options.rb +6 -4
  29. data/lib/potassium/platanus_config.rb +1 -1
  30. data/lib/potassium/recipes/admin.rb +40 -32
  31. data/lib/potassium/recipes/background_processor.rb +1 -1
  32. data/lib/potassium/recipes/bullet.rb +41 -0
  33. data/lib/potassium/recipes/ci.rb +1 -0
  34. data/lib/potassium/recipes/cleanup.rb +0 -1
  35. data/lib/potassium/recipes/coverage.rb +4 -27
  36. data/lib/potassium/recipes/database_container.rb +1 -1
  37. data/lib/potassium/recipes/error_reporting.rb +2 -2
  38. data/lib/potassium/recipes/file_storage.rb +1 -1
  39. data/lib/potassium/recipes/front_end_vite.rb +153 -0
  40. data/lib/potassium/recipes/google_tag_manager.rb +19 -23
  41. data/lib/potassium/recipes/mjml.rb +1 -1
  42. data/lib/potassium/recipes/node.rb +1 -1
  43. data/lib/potassium/recipes/style.rb +4 -5
  44. data/lib/potassium/recipes/vue_admin.rb +7 -13
  45. data/lib/potassium/recipes/yarn.rb +1 -1
  46. data/lib/potassium/templates/application.rb +4 -8
  47. data/lib/potassium/version.rb +9 -9
  48. data/spec/features/api_spec.rb +2 -2
  49. data/spec/features/background_processor_spec.rb +2 -2
  50. data/spec/features/bullet_spec.rb +29 -0
  51. data/spec/features/ci_spec.rb +10 -4
  52. data/spec/features/coverage_spec.rb +7 -6
  53. data/spec/features/database_container_spec.rb +1 -1
  54. data/spec/features/database_spec.rb +1 -1
  55. data/spec/features/draper_spec.rb +1 -1
  56. data/spec/features/error_reporting_spec.rb +2 -2
  57. data/spec/features/file_storage_spec.rb +4 -4
  58. data/spec/features/google_tag_manager_spec.rb +1 -1
  59. data/spec/features/i18n_spec.rb +1 -1
  60. data/spec/features/mailer_spec.rb +1 -0
  61. data/spec/features/new_project_spec.rb +1 -1
  62. data/spec/features/power_types_spec.rb +1 -1
  63. data/spec/features/pundit_spec.rb +1 -1
  64. data/spec/features/schedule_spec.rb +1 -1
  65. data/spec/features/testing_spec.rb +0 -1
  66. data/spec/features/vue_admin_spec.rb +1 -1
  67. data/spec/front_end_vite_spec.rb +81 -0
  68. metadata +26 -16
  69. data/lib/potassium/assets/config/webpack/rules/css.js +0 -5
  70. data/lib/potassium/assets/config/webpack/rules/index.js +0 -11
  71. data/lib/potassium/assets/config/webpack/rules/jquery.js +0 -11
  72. data/lib/potassium/assets/config/webpack/rules/typescript.js +0 -32
  73. data/lib/potassium/assets/config/webpack/rules/vue.js +0 -19
  74. data/lib/potassium/assets/config/webpack/webpack.config.js +0 -4
  75. data/lib/potassium/recipes/front_end.rb +0 -256
  76. data/spec/features/front_end_spec.rb +0 -71
  77. /data/lib/potassium/assets/app/{javascript → frontend}/components/app.spec.ts +0 -0
  78. /data/lib/potassium/assets/app/{javascript → frontend}/components/app.vue +0 -0
@@ -5,7 +5,6 @@ class Recipes::VueAdmin < Rails::AppBuilder
5
5
  Ask.confirm "Do you want Vue support for ActiveAdmin?"
6
6
  end
7
7
  set(:vue_admin, vue_admin)
8
- set(:front_end, :vue) if vue_admin
9
8
  end
10
9
  end
11
10
 
@@ -29,23 +28,18 @@ class Recipes::VueAdmin < Rails::AppBuilder
29
28
  end
30
29
 
31
30
  def installed?
32
- dir_exist?("app/assets/javascripts/admin")
31
+ file_exist?("lib/vue_component.rb")
33
32
  end
34
33
 
35
34
  def add_vue_admin
36
35
  add_vue_component_library
37
36
  add_component_integration
38
- js_line = 'import "activeadmin_addons"'
39
- gsub_file(
40
- 'app/javascript/active_admin.js',
41
- js_line,
42
- <<~HERE
43
- #{js_line}
44
- #{active_admin_js}
45
- HERE
37
+ insert_into_file(
38
+ 'app/frontend/entrypoints/active_admin.js',
39
+ active_admin_js
46
40
  )
47
41
  copy_file '../assets/active_admin/admin-component.vue',
48
- 'app/javascript/components/admin-component.vue',
42
+ 'app/frontend/components/admin-component.vue',
49
43
  force: true
50
44
  end
51
45
 
@@ -128,7 +122,7 @@ class Recipes::VueAdmin < Rails::AppBuilder
128
122
  def active_admin_js
129
123
  <<~HERE
130
124
  import { createApp } from 'vue';
131
- import AdminComponent from './components/admin-component.vue';
125
+ import AdminComponent from '../components/admin-component.vue';
132
126
 
133
127
  function onLoad() {
134
128
  if (document.getElementById('wrapper') !== null) {
@@ -141,7 +135,7 @@ class Recipes::VueAdmin < Rails::AppBuilder
141
135
  }));
142
136
  },
143
137
  });
144
- app.component('AdminComponent', AdminComponent);
138
+ app.component('admin_component', AdminComponent);
145
139
  app.mount('#wrapper');
146
140
  }
147
141
 
@@ -1,6 +1,6 @@
1
1
  class Recipes::Yarn < Rails::AppBuilder
2
2
  def create
3
- template '../assets/package.json', 'package.json' unless get(:front_end)
3
+ template '../assets/package.json', 'package.json'
4
4
  template '../assets/bin/update.erb', 'bin/update', force: true
5
5
  application "config.assets.paths << Rails.root.join('node_modules')"
6
6
  append_to_file ".gitignore", "node_modules/\n"
@@ -12,16 +12,11 @@ run_action(:cleaning) do
12
12
  clean_gemfile
13
13
  end
14
14
 
15
- run_action(:add_utils) do
16
- gather_gem("enumerize")
17
- end
18
-
19
15
  run_action(:asking) do
20
16
  ask :database
21
17
  ask :devise
22
18
  ask :admin
23
19
  ask :google_tag_manager
24
- ask :front_end
25
20
  ask :vue_admin
26
21
  ask :mailer
27
22
  ask :background_processor
@@ -77,11 +72,12 @@ run_action(:recipe_loading) do
77
72
  create :script
78
73
  create :github
79
74
  create :cleanup
80
- create :front_end
81
- create :admin
82
- create :vue_admin
83
75
  create :google_tag_manager
84
76
  create :mjml
77
+ create :bullet
78
+ create :front_end_vite
79
+ create :admin
80
+ create :vue_admin
85
81
  end
86
82
 
87
83
  info "Gathered enough information. Applying the template. Wait a minute."
@@ -1,17 +1,17 @@
1
1
  module Potassium
2
- VERSION = "6.6.0"
2
+ VERSION = "7.0.0"
3
3
  RUBY_VERSION = "2.7.0"
4
- RAILS_VERSION = "~> 6.1.4.4"
4
+ RAILS_VERSION = "~> 7.0.4.2"
5
5
  RUBOCOP_VERSION = "~> 1.9"
6
6
  RUBOCOP_RSPEC_VERSION = "~> 2.2"
7
7
  POSTGRES_VERSION = "11.3"
8
8
  MYSQL_VERSION = "5.7"
9
9
  NODE_VERSION = "14"
10
- TAILWINDCSS_VERSION = "^3"
11
- POSTCSS_VERSION = "^8"
12
- AUTOPREFIXER_VERSION = "^10"
13
- VUE_VERSION = "^3"
14
- VUE_LOADER_VERSION = "^16"
15
- VUE_TEST_UTILS_VERSION = "^2.0.0-rc.18"
16
- VUE_JEST_VERSION = "^27.0.0-alpha.1"
10
+ TAILWINDCSS_VERSION = "^3.2.7"
11
+ POSTCSS_VERSION = "^8.4.21"
12
+ AUTOPREFIXER_VERSION = "^10.4.13"
13
+ VUE_VERSION = "^3.2.33"
14
+ VUE_LOADER_VERSION = "^16.8.3"
15
+ VUE_TEST_UTILS_VERSION = "^2.0.2"
16
+ JEST_VERSION = "^29.0.0"
17
17
  end
@@ -9,8 +9,8 @@ RSpec.describe "Api" do
9
9
 
10
10
  it "adds power_api related gems to Gemfile" do
11
11
  gemfile_content = IO.read("#{project_path}/Gemfile")
12
- expect(gemfile_content).to include("gem 'power_api'")
13
- expect(gemfile_content).to include("gem 'rswag-specs'")
12
+ expect(gemfile_content).to include("power_api")
13
+ expect(gemfile_content).to include("rswag-specs")
14
14
  end
15
15
 
16
16
  it "adds the power_api brief to README file" do
@@ -11,7 +11,7 @@ RSpec.describe "BackgroundProcessor" do
11
11
 
12
12
  it "adds sidekiq gem to Gemfile" do
13
13
  gemfile_content = IO.read("#{project_path}/Gemfile")
14
- expect(gemfile_content).to include("gem 'sidekiq'")
14
+ expect(gemfile_content).to include("sidekiq")
15
15
  end
16
16
 
17
17
  it "adds queue_adapter to application.rb" do
@@ -43,7 +43,7 @@ RSpec.describe "BackgroundProcessor" do
43
43
  content = IO.read("#{project_path}/.env.development")
44
44
  expect(content).to include("DB_POOL=25")
45
45
  expect(content).to include('REDIS_HOST=127.0.0.1')
46
- expect(content).to include('REDIS_PORT=$(make services-port SERVICE=redis PORT=6379)')
46
+ expect(content).to include('REDIS_PORT=COMMAND_EXPAND(make services-port SERVICE=redis PORT=6379)')
47
47
  expect(content).to include('REDIS_URL=redis://${REDIS_HOST}:${REDIS_PORT}/1')
48
48
  end
49
49
 
@@ -0,0 +1,29 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe "Bullet" do
4
+ before(:all) do
5
+ drop_dummy_database
6
+ remove_project_directory
7
+ create_dummy_project
8
+ end
9
+
10
+ context "with all the bullet config" do
11
+ let(:dev_config) { IO.read("#{project_path}/config/environments/development.rb") }
12
+
13
+ it { expect(dev_config).to include("config.after_initialize do") }
14
+ it { expect(dev_config).to include("Bullet.enable = true") }
15
+ it { expect(dev_config).to include("Bullet.alert = true") }
16
+ it { expect(dev_config).to include("Bullet.bullet_logger = true") }
17
+ it { expect(dev_config).to include("Bullet.console = true") }
18
+ it { expect(dev_config).to include("Bullet.rails_logger = true") }
19
+ it { expect(dev_config).to include("Bullet.add_footer = true") }
20
+ end
21
+
22
+ context "with bullet application job config" do
23
+ let(:application_job) { IO.read("#{project_path}/app/jobs/application_job.rb") }
24
+
25
+ it 'adds bullet configuration to application_job.rb' do
26
+ expect(application_job).to include(" include Bullet::ActiveJob if Rails.env.development?\n")
27
+ end
28
+ end
29
+ end
@@ -2,6 +2,11 @@ require "spec_helper"
2
2
  require "rubocop"
3
3
 
4
4
  RSpec.describe 'CI' do
5
+ let(:ci_config) do
6
+ yml_path = "#{project_path}/.circleci/config.yml"
7
+ IO.read(yml_path)
8
+ end
9
+
5
10
  before(:all) do
6
11
  drop_dummy_database
7
12
  remove_project_directory
@@ -9,9 +14,10 @@ RSpec.describe 'CI' do
9
14
  end
10
15
 
11
16
  it "correctly bundles the config file" do
12
- yml_path = "#{project_path}/.circleci/config.yml"
13
- content = IO.read(yml_path)
14
- expect(File.exist?(yml_path)).to be true
15
- expect(content).to include('cimg/ruby', 'cache', 'rspec', 'reviewdog')
17
+ expect(ci_config).to include('cimg/ruby', 'cache', 'rspec', 'reviewdog')
18
+ end
19
+
20
+ it "adds repo analyzer config" do
21
+ expect(ci_config).to include('bin/rake "repo_analyzer:analyze[platanus/dummy_app]"')
16
22
  end
17
23
  end
@@ -9,9 +9,9 @@ RSpec.describe "Coverage" do
9
9
 
10
10
  it "adds simplecov related gems to Gemfile" do
11
11
  content = IO.read("#{project_path}/Gemfile")
12
- expect(content).to include("gem 'simplecov'")
13
- expect(content).to include("gem 'simplecov_linter_formatter'")
14
- expect(content).to include("gem 'simplecov_text_formatter'")
12
+ expect(content).to include("simplecov")
13
+ expect(content).to include("simplecov_linter_formatter")
14
+ expect(content).to include("simplecov_text_formatter")
15
15
  end
16
16
 
17
17
  it "requires simplecov config file before rails" do
@@ -26,14 +26,15 @@ RSpec.describe "Coverage" do
26
26
 
27
27
  context "with vue" do
28
28
  let(:node_modules_file) { IO.read("#{project_path}/package.json") }
29
+ let(:vite_config) { IO.read("#{project_path}/vite.config.ts") }
29
30
 
30
31
  before(:all) do
31
32
  remove_project_directory
32
- create_dummy_project("front_end" => "vue")
33
+ create_dummy_project("front_end_vite" => true)
33
34
  end
34
35
 
35
- it "adds jest coverage configuration" do
36
- expect(node_modules_file).to include('"collectCoverage": true')
36
+ it "adds vitest coverage configuration" do
37
+ expect(vite_config).to include("provider: 'c8',")
37
38
  end
38
39
 
39
40
  it "adds jest text formatter package" do
@@ -25,7 +25,7 @@ RSpec.describe "DatabaseContainer" do
25
25
  db_port = compose_content[:services][service_name][:ports].first
26
26
 
27
27
  expect(env_file)
28
- .to include("DB_PORT=$(make services-port SERVICE=#{service_name} PORT=#{db_port})")
28
+ .to include("DB_PORT=COMMAND_EXPAND(make services-port SERVICE=#{service_name} PORT=#{db_port})")
29
29
  expect(env_file).to include("DB_HOST=127.0.0.1")
30
30
  expect(File.exist?("#{project_path}/Makefile")).to be true
31
31
  expect(setup_file).to include("docker-compose up -d")
@@ -9,6 +9,6 @@ RSpec.describe "Database" do
9
9
 
10
10
  it "adds the Strong Migrations gem to Gemfile" do
11
11
  gemfile_content = IO.read("#{project_path}/Gemfile")
12
- expect(gemfile_content).to include("gem 'strong_migrations'")
12
+ expect(gemfile_content).to include("strong_migrations")
13
13
  end
14
14
  end
@@ -9,7 +9,7 @@ RSpec.describe "Draper" do
9
9
 
10
10
  it "adds the Draper gem to Gemfile" do
11
11
  gemfile_content = IO.read("#{project_path}/Gemfile")
12
- expect(gemfile_content).to include("gem 'draper'")
12
+ expect(gemfile_content).to include("draper")
13
13
  end
14
14
 
15
15
  it "adds the Draper brief to README file" do
@@ -10,13 +10,13 @@ RSpec.describe "Error Reporting" do
10
10
  it "adds the Sentry gem to Gemfile" do
11
11
  gemfile_content = IO.read("#{project_path}/Gemfile")
12
12
 
13
- expect(gemfile_content).to include("gem 'sentry-raven'")
13
+ expect(gemfile_content).to include("sentry-rails")
14
14
  end
15
15
 
16
16
  it "creates the initializer" do
17
17
  initializer_content = IO.read("#{project_path}/config/initializers/sentry.rb")
18
18
 
19
- expect(initializer_content).to include("Raven.configure")
19
+ expect(initializer_content).to include("Sentry.init")
20
20
  end
21
21
 
22
22
  it "adds the environment variable to .env.development" do
@@ -10,7 +10,7 @@ RSpec.describe "File Storage" do
10
10
 
11
11
  it "adds the aws-sdk-s3 gem to Gemfile" do
12
12
  gemfile_content = IO.read("#{project_path}/Gemfile")
13
- expect(gemfile_content).to include("gem 'aws-sdk-s3'")
13
+ expect(gemfile_content).to include("aws-sdk-s3")
14
14
  end
15
15
 
16
16
  it "customizes config file" do
@@ -43,9 +43,9 @@ RSpec.describe "File Storage" do
43
43
  shared_examples 'common shrine setup' do
44
44
  it "adds the aws-sdk-s3, shrine and marcel gems to Gemfile" do
45
45
  gemfile_content = IO.read("#{project_path}/Gemfile")
46
- expect(gemfile_content).to include("gem 'aws-sdk-s3'")
47
- expect(gemfile_content).to include("gem 'shrine'")
48
- expect(gemfile_content).to include("gem 'marcel'")
46
+ expect(gemfile_content).to include("aws-sdk-s3")
47
+ expect(gemfile_content).to include("shrine")
48
+ expect(gemfile_content).to include("marcel")
49
49
  end
50
50
 
51
51
  it "adds brief to README file" do
@@ -31,6 +31,6 @@ RSpec.describe "Google Tag Manager" do
31
31
 
32
32
  it 'add content security policy' do
33
33
  expect(content_security_policy_file)
34
- .to include("\nRails.application.config.content_security_policy do |policy|")
34
+ .to include("https://developers.google.com/tag-manager/web/csp")
35
35
  end
36
36
  end
@@ -10,7 +10,7 @@ RSpec.describe "I18n" do
10
10
  it "adds the Clockwork gem to Gemfile" do
11
11
  content = IO.read("#{project_path}/Gemfile")
12
12
 
13
- expect(content).to include("gem 'rails-i18n'")
13
+ expect(content).to include("rails-i18n")
14
14
  end
15
15
 
16
16
  it "configures application.rb" do
@@ -102,3 +102,4 @@ RSpec.describe "Mailer" do
102
102
  end
103
103
  end
104
104
  end
105
+ # rubocop:enable Rspec/MultipleMemoizedHelpers
@@ -23,7 +23,7 @@ RSpec.describe "A new project" do
23
23
  gemfile = IO.read("#{project_path}/Gemfile")
24
24
 
25
25
  expect(database_config_file).to include(%{adapter: postgresql})
26
- expect(gemfile).to include %{gem 'pg'}
26
+ expect(gemfile).to include %{pg}
27
27
  end
28
28
 
29
29
  it "configures the correct ruby version" do
@@ -9,7 +9,7 @@ RSpec.describe "PowerTypes" do
9
9
 
10
10
  it "adds the PowerTypes gem to Gemfile" do
11
11
  gemfile_content = IO.read("#{project_path}/Gemfile")
12
- expect(gemfile_content).to include("gem 'power-types'")
12
+ expect(gemfile_content).to include("power-types")
13
13
  end
14
14
 
15
15
  it "adds the PowerTypes brief to README file" do
@@ -10,7 +10,7 @@ RSpec.describe "Pundit" do
10
10
  it "adds the Pundit gem to Gemfile" do
11
11
  content = IO.read("#{project_path}/Gemfile")
12
12
 
13
- expect(content).to include("gem 'pundit'")
13
+ expect(content).to include("pundit")
14
14
  end
15
15
 
16
16
  it "setup active admin" do
@@ -13,7 +13,7 @@ RSpec.describe "schedule" do
13
13
 
14
14
  it "adds the sidekiq-scheduler gem to Gemfile" do
15
15
  gemfile_content = IO.read("#{project_path}/Gemfile")
16
- expect(gemfile_content).to include("gem 'sidekiq-scheduler'")
16
+ expect(gemfile_content).to include("sidekiq-scheduler")
17
17
  end
18
18
 
19
19
  it "adds schedule section to sidekiq config" do
@@ -31,7 +31,6 @@ RSpec.describe "Testing" do
31
31
  create_dummy_project(devise: true)
32
32
  end
33
33
 
34
- it { expect(gemfile_content).to include("gem 'rspec-rails'") }
35
34
  it { expect(gemfile_content).to include('rspec-rails') }
36
35
  it { expect(gemfile_content).to include('factory_bot_rails') }
37
36
  it { expect(gemfile_content).to include('faker') }
@@ -22,7 +22,7 @@ RSpec.describe "VueAdmin" do
22
22
  end
23
23
 
24
24
  it "adds admin_component to vue components" do
25
- application_pack_path = "#{project_path}/app/javascript/components/admin-component.vue"
25
+ application_pack_path = "#{project_path}/app/frontend/components/admin-component.vue"
26
26
  expect(File).to be_file(application_pack_path)
27
27
  end
28
28
 
@@ -0,0 +1,81 @@
1
+ # rubocop:disable RSpec/MultipleMemoizedHelpers
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe 'Front end' do
5
+ before :all do
6
+ drop_dummy_database
7
+ remove_project_directory
8
+ create_dummy_project('front_end_vite' => true)
9
+ end
10
+
11
+ def read_file(file_path)
12
+ IO.read("#{project_path}/#{file_path}")
13
+ end
14
+
15
+ let(:gemfile) { read_file('Gemfile') }
16
+ let(:application_file) { read_file('config/application.rb') }
17
+ let(:node_modules_file) { read_file('package.json') }
18
+ let(:application_js_file) { read_file('app/frontend/entrypoints/application.js') }
19
+ let(:layout_file) { read_file('app/views/layouts/application.html.erb') }
20
+ let(:csp_initializer) { read_file('config/initializers/content_security_policy.rb') }
21
+ let(:application_css_file) { read_file('app/frontend/css/application.css') }
22
+ let(:tailwind_config_file) { read_file('tailwind.config.js') }
23
+ let(:rails_css_file) { read_file('app/assets/stylesheets/application.css') }
24
+ let(:api_index_file) { read_file('app/frontend/api/index.ts') }
25
+ let(:case_converter_file) { read_file('app/frontend/utils/case-converter.ts') }
26
+ let(:csrf_token_file) { read_file('app/frontend/utils/csrf-token.ts') }
27
+ let(:mock_example_file) { read_file('app/frontend/api/__mocks__/index.mock.ts') }
28
+
29
+ it 'creates a project with vite' do
30
+ expect(gemfile).to include('vite_rails')
31
+ expect(layout_file.scan('vite_client_tag').length).to eq(1)
32
+ expect(layout_file.scan('vite_javascript_tag').length).to eq(2)
33
+ end
34
+
35
+ it 'creates a project with vue as frontend framework' do
36
+ expect(node_modules_file).to include('"vue"')
37
+ expect(application_js_file).to include('vue')
38
+ expect(application_js_file).to include("app.mount('#vue-app')")
39
+ expect(layout_file).to include('id="vue-app"')
40
+ end
41
+
42
+ it 'creates a vue project with client css' do
43
+ expect(application_js_file).to include("import '../css/application.css';")
44
+ end
45
+
46
+ it 'creates a vue project with tailwindcss' do
47
+ expect(node_modules_file).to include('"tailwindcss"')
48
+ expect(application_css_file).to include(
49
+ '@tailwind base;',
50
+ '@tailwind components;'
51
+ )
52
+ expect(tailwind_config_file).to include('module.exports')
53
+ expect(File.exists?(File.join(project_path, 'tailwind.config.js'))).to be(true)
54
+ expect(File.exists?(File.join(project_path, 'postcss.config.js'))).to be(true)
55
+ end
56
+
57
+ it 'updates suggested csp policy' do
58
+ expect(csp_initializer).to include('ViteRuby.config.host_with_port')
59
+ end
60
+
61
+ it 'includes correct packages for basic api client' do
62
+ expect(node_modules_file).to include('"axios"')
63
+ expect(node_modules_file).to include('"humps"')
64
+ end
65
+
66
+ it 'includes api client files' do
67
+ expect(api_index_file).to include('axios.create')
68
+ expect(case_converter_file).to include('humps')
69
+ expect(csrf_token_file).to include('meta[name=csrf-token]')
70
+ end
71
+
72
+ it 'includes mock example' do
73
+ expect(mock_example_file).to include('jest.fn()')
74
+ end
75
+
76
+ it 'includes the dotenv monkeypatch' do
77
+ expect(application_file).to include("require_relative '../lib/dotenv_monkeypatch'")
78
+ expect(File.exists?(File.join(project_path, 'lib/dotenv_monkeypatch.rb'))).to be(true)
79
+ end
80
+ end
81
+ # rubocop:enable RSpec/MultipleMemoizedHelpers
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: potassium
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.6.0
4
+ version: 7.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliogarciag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-15 00:00:00.000000000 Z
11
+ date: 2023-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -212,14 +212,14 @@ dependencies:
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 6.1.4.4
215
+ version: 7.0.4.2
216
216
  type: :runtime
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 6.1.4.4
222
+ version: 7.0.4.2
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: semantic
225
225
  requirement: !ruby/object:Gem::Requirement
@@ -281,9 +281,18 @@ files:
281
281
  - lib/potassium/assets/active_admin/policies/comment_policy.rb
282
282
  - lib/potassium/assets/active_admin/policies/default_policy.rb
283
283
  - lib/potassium/assets/active_admin/policies/page_policy.rb
284
- - lib/potassium/assets/app/javascript/components/app.spec.ts
285
- - lib/potassium/assets/app/javascript/components/app.vue
286
- - lib/potassium/assets/app/javascript/types/vue.d.ts
284
+ - lib/potassium/assets/app/frontend/active_admin/jquery.js
285
+ - lib/potassium/assets/app/frontend/api/__mocks__/index.mock.ts
286
+ - lib/potassium/assets/app/frontend/api/index.ts
287
+ - lib/potassium/assets/app/frontend/components/app.spec.ts
288
+ - lib/potassium/assets/app/frontend/components/app.vue
289
+ - lib/potassium/assets/app/frontend/css/application.css
290
+ - lib/potassium/assets/app/frontend/entrypoints/active_admin.js
291
+ - lib/potassium/assets/app/frontend/entrypoints/active_admin.scss
292
+ - lib/potassium/assets/app/frontend/entrypoints/application.js
293
+ - lib/potassium/assets/app/frontend/types/vue.d.ts
294
+ - lib/potassium/assets/app/frontend/utils/case-converter.ts
295
+ - lib/potassium/assets/app/frontend/utils/csrf-token.ts
287
296
  - lib/potassium/assets/app/jobs/shrine_promote_job.rb
288
297
  - lib/potassium/assets/app/mailers/application_mailer.rb
289
298
  - lib/potassium/assets/app/mailers/example_mailer.rb
@@ -309,14 +318,9 @@ files:
309
318
  - lib/potassium/assets/config/sentry.rb.erb
310
319
  - lib/potassium/assets/config/shrine.rb
311
320
  - lib/potassium/assets/config/storage.yml
312
- - lib/potassium/assets/config/webpack/rules/css.js
313
- - lib/potassium/assets/config/webpack/rules/index.js
314
- - lib/potassium/assets/config/webpack/rules/jquery.js
315
- - lib/potassium/assets/config/webpack/rules/typescript.js
316
- - lib/potassium/assets/config/webpack/rules/vue.js
317
- - lib/potassium/assets/config/webpack/webpack.config.js
318
321
  - lib/potassium/assets/docker-compose.yml
319
322
  - lib/potassium/assets/es-CL.yml
323
+ - lib/potassium/assets/lib/dotenv_monkeypatch.rb
320
324
  - lib/potassium/assets/lib/tasks/auto_annotate_models.rake
321
325
  - lib/potassium/assets/package.json
322
326
  - lib/potassium/assets/public/mails/platanus-logo.png
@@ -327,6 +331,7 @@ files:
327
331
  - lib/potassium/assets/seeds/seeds.rb
328
332
  - lib/potassium/assets/sidekiq.rb.erb
329
333
  - lib/potassium/assets/sidekiq.yml
334
+ - lib/potassium/assets/tailwind.config.js
330
335
  - lib/potassium/assets/testing/.rspec
331
336
  - lib/potassium/assets/testing/devise_config.rb
332
337
  - lib/potassium/assets/testing/factory_bot_config.rb
@@ -337,7 +342,9 @@ files:
337
342
  - lib/potassium/assets/testing/shoulda_matchers_config.rb
338
343
  - lib/potassium/assets/testing/simplecov_config.rb
339
344
  - lib/potassium/assets/testing/system_tests_config.rb
345
+ - lib/potassium/assets/tsconfig.config.json
340
346
  - lib/potassium/assets/tsconfig.json
347
+ - lib/potassium/assets/vite.config.ts
341
348
  - lib/potassium/cli.rb
342
349
  - lib/potassium/cli/commands/create.rb
343
350
  - lib/potassium/cli/commands/install.rb
@@ -364,6 +371,7 @@ files:
364
371
  - lib/potassium/recipes/api.rb
365
372
  - lib/potassium/recipes/background_processor.rb
366
373
  - lib/potassium/recipes/better_errors.rb
374
+ - lib/potassium/recipes/bullet.rb
367
375
  - lib/potassium/recipes/ci.rb
368
376
  - lib/potassium/recipes/cleanup.rb
369
377
  - lib/potassium/recipes/coverage.rb
@@ -376,7 +384,7 @@ files:
376
384
  - lib/potassium/recipes/env.rb
377
385
  - lib/potassium/recipes/error_reporting.rb
378
386
  - lib/potassium/recipes/file_storage.rb
379
- - lib/potassium/recipes/front_end.rb
387
+ - lib/potassium/recipes/front_end_vite.rb
380
388
  - lib/potassium/recipes/github.rb
381
389
  - lib/potassium/recipes/google_tag_manager.rb
382
390
  - lib/potassium/recipes/heroku.rb
@@ -415,6 +423,7 @@ files:
415
423
  - spec/fakes/bin/hub
416
424
  - spec/features/api_spec.rb
417
425
  - spec/features/background_processor_spec.rb
426
+ - spec/features/bullet_spec.rb
418
427
  - spec/features/ci_spec.rb
419
428
  - spec/features/coverage_spec.rb
420
429
  - spec/features/data_migrate_spec.rb
@@ -423,7 +432,6 @@ files:
423
432
  - spec/features/draper_spec.rb
424
433
  - spec/features/error_reporting_spec.rb
425
434
  - spec/features/file_storage_spec.rb
426
- - spec/features/front_end_spec.rb
427
435
  - spec/features/github_spec.rb
428
436
  - spec/features/google_tag_manager_spec.rb
429
437
  - spec/features/heroku_spec.rb
@@ -437,6 +445,7 @@ files:
437
445
  - spec/features/schedule_spec.rb
438
446
  - spec/features/testing_spec.rb
439
447
  - spec/features/vue_admin_spec.rb
448
+ - spec/front_end_vite_spec.rb
440
449
  - spec/spec_helper.rb
441
450
  - spec/support/fake_github.rb
442
451
  - spec/support/fake_heroku.rb
@@ -472,6 +481,7 @@ test_files:
472
481
  - spec/fakes/bin/hub
473
482
  - spec/features/api_spec.rb
474
483
  - spec/features/background_processor_spec.rb
484
+ - spec/features/bullet_spec.rb
475
485
  - spec/features/ci_spec.rb
476
486
  - spec/features/coverage_spec.rb
477
487
  - spec/features/data_migrate_spec.rb
@@ -480,7 +490,6 @@ test_files:
480
490
  - spec/features/draper_spec.rb
481
491
  - spec/features/error_reporting_spec.rb
482
492
  - spec/features/file_storage_spec.rb
483
- - spec/features/front_end_spec.rb
484
493
  - spec/features/github_spec.rb
485
494
  - spec/features/google_tag_manager_spec.rb
486
495
  - spec/features/heroku_spec.rb
@@ -494,6 +503,7 @@ test_files:
494
503
  - spec/features/schedule_spec.rb
495
504
  - spec/features/testing_spec.rb
496
505
  - spec/features/vue_admin_spec.rb
506
+ - spec/front_end_vite_spec.rb
497
507
  - spec/spec_helper.rb
498
508
  - spec/support/fake_github.rb
499
509
  - spec/support/fake_heroku.rb
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- resolve: {
3
- extensions: ['.css', '.scss']
4
- }
5
- }
@@ -1,11 +0,0 @@
1
- const vueConfig = require('./vue');
2
- const cssConfig = require('./css');
3
- const jQueryConfig = require('./jquery');
4
- const typescriptConfig = require('./typescript');
5
-
6
- module.exports = {
7
- vueConfig,
8
- cssConfig,
9
- jQueryConfig,
10
- typescriptConfig,
11
- };