potassium 6.7.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 +23 -0
  3. data/README.md +8 -1
  4. data/lib/potassium/assets/.circleci/config.yml.erb +14 -8
  5. data/lib/potassium/assets/.eslintrc.json +13 -7
  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/{javascript → frontend}/utils/case-converter.ts +2 -2
  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 -27
  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 +42 -72
  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/front_end_vite.rb +153 -0
  39. data/lib/potassium/recipes/google_tag_manager.rb +19 -23
  40. data/lib/potassium/recipes/mjml.rb +1 -1
  41. data/lib/potassium/recipes/node.rb +1 -1
  42. data/lib/potassium/recipes/style.rb +3 -5
  43. data/lib/potassium/recipes/vue_admin.rb +7 -13
  44. data/lib/potassium/recipes/yarn.rb +1 -1
  45. data/lib/potassium/templates/application.rb +4 -8
  46. data/lib/potassium/version.rb +6 -6
  47. data/spec/features/api_spec.rb +2 -2
  48. data/spec/features/background_processor_spec.rb +2 -2
  49. data/spec/features/bullet_spec.rb +29 -0
  50. data/spec/features/ci_spec.rb +10 -4
  51. data/spec/features/coverage_spec.rb +7 -6
  52. data/spec/features/database_container_spec.rb +1 -1
  53. data/spec/features/database_spec.rb +1 -1
  54. data/spec/features/draper_spec.rb +1 -1
  55. data/spec/features/error_reporting_spec.rb +2 -2
  56. data/spec/features/file_storage_spec.rb +4 -4
  57. data/spec/features/google_tag_manager_spec.rb +1 -1
  58. data/spec/features/i18n_spec.rb +1 -1
  59. data/spec/features/mailer_spec.rb +1 -0
  60. data/spec/features/new_project_spec.rb +1 -1
  61. data/spec/features/power_types_spec.rb +1 -1
  62. data/spec/features/pundit_spec.rb +1 -1
  63. data/spec/features/schedule_spec.rb +1 -1
  64. data/spec/features/testing_spec.rb +0 -1
  65. data/spec/features/vue_admin_spec.rb +1 -1
  66. data/spec/front_end_vite_spec.rb +81 -0
  67. metadata +26 -18
  68. data/lib/potassium/assets/app/javascript/api/index.ts +0 -55
  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 -270
  76. data/spec/features/front_end_spec.rb +0 -76
  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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81ec8c6408ed21f78421ecb48565bcd42e6478fc0a08a7ca0881035eb8d0c444
4
- data.tar.gz: 0b925fa5a1344c3f284d91f8fdb092d984d47f8434b4beed51678e4a909e2ada
3
+ metadata.gz: 3d5e76dc98fd706504cc3247552cef3ca64a0bb7d849d3e5fb22aad2fee7ec9d
4
+ data.tar.gz: a5957889e338657dabad861765c2febd8c75c20a26eb2cec5603245feb265735
5
5
  SHA512:
6
- metadata.gz: 8a07cf43e021c0350e84eb0213f5ac513fa2446c16cfd492a0b7947acdd45776b817004d5f4cf42962947137dc988ccaa1e61020f23b89a63040b85d04e61a2e
7
- data.tar.gz: af4598c990bede9a8be8cbf47dd324f9f13b584b5b0982ab277806f71318b4d97da289e9cad725d45398e66cc7454578bd89fc086b550ebc586286d46d217f98
6
+ metadata.gz: 0c44956c6e4a6a85b0235f643ba73fd254a54743a2fd5ee9628849416b9718088474db66a80b4c8f1392eb370fe219ce5cee41b2d3d68baa3cbf156836f1d25b
7
+ data.tar.gz: b6a540e566d9ec3119e40c0d2001564c2d59a785806d6f1c2fa384fccaabf1f6bb6b2ff5dfb603c2f684cfa72c723efffcab1f8562bde7afcd82609b46b360a0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 7.0.0
6
+
7
+ Features
8
+ - Updates to ActiveAdmin Addons 2 (beta) [#431](https://github.com/platanus/potassium/pull/431)
9
+ - Replaces Shakapacker with Vite [#431](https://github.com/platanus/potassium/pull/431)
10
+ - Update to Rails 7 [#431](https://github.com/platanus/potassium/pull/431)
11
+ - Install repo analyzer gem to run in CI environment
12
+ - Removes enumerize in favor of built-in enums [#428](https://github.com/platanus/potassium/pull/428)
13
+ - Add linter rule to enforce the use of named exports [#427](https://github.com/platanus/potassium/pull/427)
14
+ - Enable new rubocop rules [#429](https://github.com/platanus/potassium/pull/429)
15
+ <details>
16
+ <summary>See rules</summary>
17
+
18
+ - [Rails/Delegate](https://docs.rubocop.org/rubocop-rails/2.17/cops_rails.html#railsdelegate)
19
+ - [Rails/I18nLocaleAssignment](https://docs.rubocop.org/rubocop-rails/2.17/cops_rails.html#railsi18nlocaleassignment)
20
+ - [Rails/WhereEquals](https://docs.rubocop.org/rubocop-rails/2.17/cops_rails.html#railswhereequals)
21
+ - [Rails/WhereNot](https://docs.rubocop.org/rubocop-rails/2.17/cops_rails.html#railswherenot)
22
+ - [Rails/RedundantPresenceValidationOnBelongsTo](https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsredundantpresencevalidationonbelongsto)
23
+ - [Layout/ClassStructure](https://docs.rubocop.org/rubocop/1.24/cops_layout.html#layoutclassstructure)
24
+ </details>
25
+
3
26
  ## 6.7.0
4
27
 
5
28
  Features
data/README.md CHANGED
@@ -43,12 +43,18 @@ This will create a project with the following configuration:
43
43
  13. `draper`: `true`
44
44
  14. `schedule`: `true`
45
45
  15. `sentry`: `true`
46
- 16. `front_end`: `'vue'`
46
+ 16. `front_end_vite`: `true`
47
47
  17. `google_tag_manager`: `true`
48
48
  18. `test`: `true`
49
49
  19. `spring`: `true`
50
50
 
51
51
  The remaining question will be asked as usual.
52
+
53
+ ### Running from Repository
54
+
55
+ If you cloned this repository and are running the gem using the bin script (`potassium/bin/potassium create`), take careful note of the gem versions that are used. Sometimes the local Rails version is used instead of the one specified in the gemspec. Remove your local Gemfile.lock after pulling from the repository to help prevent these issues.
56
+
57
+
52
58
  ### Adding recipes to an existing project
53
59
 
54
60
  Use the `potassium install` command to add a recipe to a project:
@@ -82,6 +88,7 @@ Potassium Rails apps includes the following gems and technologies:
82
88
  - [Faker](https://github.com/stympy/faker) for creating development data
83
89
  - [Scout](https://github.com/scoutapp/scout_apm_ruby) for monitoring performance
84
90
  - [Mjml](https://github.com/sighmon/mjml-rails) for mails style
91
+ - [Bullet](https://github.com/flyerhzm/bullet) to identify eager loading (N+1 queries)
85
92
 
86
93
  The following optional integrations are also added:
87
94
 
@@ -116,6 +116,14 @@ jobs:
116
116
  RSPEC_FORMAT_ARGS="-f progress --no-color -p 10"
117
117
  bundle exec rspec spec $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
118
118
 
119
+ - run:
120
+ name: Update repo analyzer gem
121
+ command: bundle update --conservative repo_analyzer
122
+
123
+ - run:
124
+ name: POST extracted data to nest
125
+ command: bin/rake "repo_analyzer:analyze[platanus/<%= get(:app_name) %>]"
126
+
119
127
  - run:
120
128
  name: Run simplecov
121
129
  shell: /bin/bash
@@ -129,14 +137,12 @@ jobs:
129
137
  RSPEC_FORMAT_ARGS="--tag type:system -f progress --no-color -p 10"
130
138
  bundle exec rspec spec $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
131
139
 
132
- <%- if selected?(:front_end, :vue) -%>
133
- - run:
134
- name: Run jest
135
- command: |
136
- yarn run test > coverage/input_jest.txt
137
- ./node_modules/.bin/format-coverage coverage/input_jest.txt coverage/output_jest.txt /home/circleci/project/app/javascript
138
- cat coverage/output_jest.txt | ./bin/reviewdog -reporter=github-pr-review -efm="%f:%l:%c: %m"
139
- <%- end -%>
140
+ - run:
141
+ name: Run vitest
142
+ command: |
143
+ yarn run test > coverage/input_vitest.txt
144
+ ./node_modules/.bin/format-coverage coverage/input_vitest.txt coverage/output_vitest.txt /home/circleci/project/app/frontend
145
+ cat coverage/output_vitest.txt | ./bin/reviewdog -reporter=github-pr-review -efm="%f:%l:%c: %m"
140
146
 
141
147
  - store_test_results:
142
148
  path: test_results
@@ -209,7 +209,7 @@
209
209
  "newlines-between": "never"
210
210
  }],
211
211
  "import/newline-after-import": 2,
212
- "import/prefer-default-export": 2,
212
+ "import/no-default-export": 2,
213
213
  "array-bracket-spacing": [2, "never"],
214
214
  "block-spacing": [2, "always"],
215
215
  "brace-style": [2, "1tbs", {
@@ -255,7 +255,7 @@
255
255
  "lines-around-comment": 0,
256
256
  "max-depth": [2, 4],
257
257
  "max-len": [2, 120, {
258
- "ignorePattern": "^\\s.+class=\""
258
+ "ignorePattern": "^\\s.+class=|\\s.d=\""
259
259
  }],
260
260
  "max-nested-callbacks": [2, 4],
261
261
  "max-params": [1, 4],
@@ -287,7 +287,7 @@
287
287
  "no-new-object": 2,
288
288
  "no-plusplus": 0,
289
289
  "no-restricted-syntax": [2, "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"],
290
- "no-spaced-func": 2,
290
+ "no-spaced-func": 0,
291
291
  "no-ternary": 0,
292
292
  "no-trailing-spaces": 2,
293
293
  "no-underscore-dangle": [1],
@@ -346,14 +346,20 @@
346
346
  "vue/max-len": ["error", {
347
347
  "code": 120,
348
348
  "ignoreHTMLAttributeValues": true
349
+ }],
350
+ "tailwindcss/no-custom-classname": ["warn", {
351
+ "cssFiles": ["**/*.css", "!**/node_modules", "!**/.*", "!**/dist", "!**/build", "!**/vendor"]
349
352
  }]
350
353
  },
351
354
  "overrides": [
352
355
  {
353
- "files": ["*.ts", "*.vue"],
354
- "rules": {
355
- "no-undef": "off"
356
- }
356
+ "files": ["*.ts", "*.vue"],
357
+ "rules": {
358
+ "no-undef": "off",
359
+ "no-unused-vars": "off",
360
+ "no-spaced-func": "off",
361
+ "@typescript-eslint/no-unused-vars": "error"
362
+ }
357
363
  }
358
364
  ]
359
365
  }
@@ -282,6 +282,59 @@ Style/SymbolArray:
282
282
  Layout/ExtraSpacing:
283
283
  Description: Do not use unnecessary spacing.
284
284
  Enabled: false
285
+ Layout/ClassStructure:
286
+ Enabled: true
287
+ Categories:
288
+ validation:
289
+ - validate
290
+ - validates
291
+ association:
292
+ - belongs_to
293
+ - has_one
294
+ - has_many
295
+ - has_and_belongs_to_many
296
+ attribute_macros:
297
+ - attribute
298
+ - attr_accessor
299
+ - attr_reader
300
+ - attr_writer
301
+ callbacks:
302
+ - before_validation
303
+ - after_validation
304
+ - before_save
305
+ - before_create
306
+ - after_create
307
+ - after_save
308
+ - after_commit
309
+ - after_create_commit
310
+ other_macros:
311
+ - devise
312
+ - acts_as_token_authenticatable
313
+ - accepts_nested_attributes_for
314
+ - humanize
315
+ - monetize
316
+ scope:
317
+ - scope
318
+ - pg_search_scope
319
+ ExpectedOrder:
320
+ - module_inclusion
321
+ - constants
322
+ - public_attribute_macros
323
+ - association
324
+ - validation
325
+ - enum
326
+ - aasm
327
+ - scope
328
+ - public_delegate
329
+ - other_macros
330
+ - class_methods
331
+ - initializer
332
+ - public_methods
333
+ - protected_attribute_macros
334
+ - protected_methods
335
+ - private_attribute_macros
336
+ - private_delegate
337
+ - private_methods
285
338
  Naming/AccessorMethodName:
286
339
  Description: Check the naming of accessor methods for get_/set_.
287
340
  Enabled: false
@@ -498,7 +551,15 @@ Lint/StructNewOverride:
498
551
  Enabled: true
499
552
  Rails/Delegate:
500
553
  Description: Prefer delegate method for delegations.
501
- Enabled: false
554
+ Enabled: true
555
+ Rails/I18nLocaleAssignment:
556
+ Enabled: true
557
+ Rails/WhereEquals:
558
+ Enabled: true
559
+ Rails/WhereNot:
560
+ Enabled: true
561
+ Rails/RedundantPresenceValidationOnBelongsTo:
562
+ Enabled: true
502
563
  Performance/RedundantBlockCall:
503
564
  Description: Use `yield` instead of `block.call`.
504
565
  Reference: https://github.com/JuanitoFatas/fast-ruby#proccall-vs-yield-code
@@ -22,20 +22,14 @@ readme:
22
22
  $ heroku local
23
23
 
24
24
  [Heroku Local]: https://devcenter.heroku.com/articles/heroku-local
25
- webpack:
25
+ vite:
26
26
  title: "Development"
27
27
  body: |
28
- For hot-reloading and fast webpacker compilation you need to run webpack's dev server along with the rails server:
28
+ For hot-reloading and fast compilation you need to run the vite dev server along with the rails server:
29
29
 
30
- $ ./bin/webpacker-dev-server
30
+ $ ./bin/vite dev
31
31
 
32
32
  Running the dev server will also solve problems with the cache not refreshing between changes and provide better error messages if something fails to compile.
33
-
34
- For even faster in-place component refreshing (with no page reloads), you can enable Hot Module Reloading in `config/webpacker.yml`
35
-
36
- development:
37
- dev_server:
38
- hmr: true
39
33
  ci:
40
34
  title: "Continuous Integrations"
41
35
  body: |
@@ -0,0 +1,2 @@
1
+ import $ from 'jquery'
2
+ window.jQuery = window.$ = $
@@ -0,0 +1,3 @@
1
+ const api = jest.fn();
2
+
3
+ export { api };
@@ -0,0 +1,63 @@
1
+ import axios, { type AxiosRequestTransformer, type AxiosResponseTransformer } from 'axios';
2
+ import { convertKeys, type objectToConvert } from '../utils/case-converter';
3
+ import { csrfToken } from '../utils/csrf-token';
4
+
5
+ const api = axios.create({
6
+ transformRequest: [
7
+ (data: objectToConvert) => convertKeys(data, 'decamelize'),
8
+ ...(axios.defaults.transformRequest as AxiosRequestTransformer[]),
9
+ ],
10
+ transformResponse: [
11
+ ...(axios.defaults.transformResponse as AxiosResponseTransformer[]),
12
+ (data: objectToConvert) => convertKeys(data, 'camelize'),
13
+ ],
14
+ headers: {
15
+ 'Content-Type': 'application/json',
16
+ 'Accept': 'application/json',
17
+ 'X-CSRF-Token': csrfToken(),
18
+ },
19
+ });
20
+
21
+ export { api };
22
+
23
+ /*
24
+ // Example to use the api object in the path ´app/javascript/api/users.ts´
25
+
26
+ import { api } from './index';
27
+
28
+ function index() {
29
+ const path = '/api/internal/users';
30
+
31
+ return api({
32
+ method: 'get',
33
+ url: path,
34
+ });
35
+ }
36
+
37
+ function create(data: Partial<User>) {
38
+ const path = '/api/internal/users';
39
+
40
+ return api({
41
+ method: 'post',
42
+ url: path,
43
+ data: {
44
+ user: data,
45
+ },
46
+ });
47
+ }
48
+
49
+ function update(data: Partial<User>) {
50
+ const path = `/api/internal/users/${data.id}`;
51
+
52
+ return api({
53
+ method: 'put',
54
+ url: path,
55
+ data: {
56
+ user: data,
57
+ },
58
+ });
59
+ }
60
+
61
+ export { index, create, update };
62
+
63
+ */
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
@@ -0,0 +1,7 @@
1
+ import '../active_admin/jquery'
2
+ import 'jquery-ui'
3
+ import 'jquery-ui/ui/widgets/mouse'
4
+ import '@activeadmin/activeadmin'
5
+ import "activeadmin_addons"
6
+ import "@fortawesome/fontawesome-free/css/all.css";
7
+ import 'arctic_admin'
@@ -0,0 +1,38 @@
1
+ @import 'activeadmin_addons/src/stylesheets/all';
2
+ @import 'arctic_admin/src/scss/main';
3
+
4
+ // Fix for sidebar when there are too many filters
5
+ #sidebar {
6
+ height: 100vh;
7
+ top: 0;
8
+ z-index: 10;
9
+ }
10
+
11
+ #sidebar::before {
12
+ top: 200px !important;
13
+ }
14
+
15
+ #filters_sidebar_section {
16
+ height: 100vh;
17
+ overflow: auto;
18
+ }
19
+
20
+ // Fix for invisible datepicker calendar
21
+ #ui-datepicker-div {
22
+ z-index: 11 !important;
23
+ }
24
+
25
+ // Fix for backwards date range input
26
+ #sidebar .sidebar_section .filter_date_range input:nth-child(2) {
27
+ float: none;
28
+ }
29
+
30
+ #sidebar .sidebar_section .filter_date_range {
31
+ display: flex;
32
+ flex-flow: row wrap;
33
+ justify-content: space-between
34
+ }
35
+
36
+ #sidebar .sidebar_section .filter_date_range label {
37
+ width: 100%;
38
+ }
@@ -0,0 +1,12 @@
1
+ import { createApp } from 'vue';
2
+ import App from '../components/app.vue';
3
+ import '../css/application.css';
4
+
5
+ document.addEventListener('DOMContentLoaded', () => {
6
+ const app = createApp({
7
+ components: { App },
8
+ });
9
+ app.mount('#vue-app');
10
+
11
+ return app;
12
+ });
@@ -1,3 +1,4 @@
1
+ /* eslint-disable import/no-default-export */
1
2
  declare module '*.vue' {
2
3
  import type { DefineComponent } from 'vue'
3
4
  const component: DefineComponent<{}, {}, any>
@@ -3,7 +3,7 @@
3
3
  /* eslint-disable max-statements */
4
4
  import { camelize, decamelize } from 'humps';
5
5
 
6
- type objectToConvert = File | FormData | Blob | Record<string, unknown> | Array<objectToConvert>;
6
+ export type objectToConvert = File | FormData | Blob | Record<string, unknown> | Array<objectToConvert>;
7
7
 
8
8
  function convertKeys(
9
9
  object: objectToConvert,
@@ -36,4 +36,4 @@ function convertKeys(
36
36
  return object;
37
37
  }
38
38
 
39
- export default convertKeys;
39
+ export { convertKeys };
@@ -0,0 +1,9 @@
1
+ // From: https://github.com/rails/rails/blob/main/actionview/app/javascript/rails-ujs/utils/csrf.js
2
+ function csrfToken() {
3
+ const meta = document.querySelector('meta[name=csrf-token]');
4
+ const token = meta && meta.getAttribute('content');
5
+
6
+ return token ?? false;
7
+ }
8
+
9
+ export { csrfToken };
@@ -11,7 +11,7 @@ gem install bundler --conservative
11
11
  bundle check || bundle install
12
12
 
13
13
  # Install javascript dependencies
14
- bin/yarn install
14
+ yarn install
15
15
 
16
16
  # Set up required services
17
17
  docker-compose up -d
@@ -18,7 +18,7 @@ chdir APP_ROOT do
18
18
  system! 'gem install bundler --conservative'
19
19
 
20
20
  puts '== Installing YARN stuff =='
21
- system! 'bin/yarn install'
21
+ system! 'yarn install'
22
22
 
23
23
  system('bundle check') || system!('bundle install')
24
24
  puts "\n== Updating database =="
@@ -1,15 +1,7 @@
1
1
  if Rails.env.production?
2
- Raven.configure do |config|
3
- config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
2
+ Sentry.init do |config|
4
3
  <% if get(:heroku) %>
5
- config.current_environment = Heroku.stage
4
+ config.environment = Heroku.stage
6
5
  <% end %>
7
6
  end
8
-
9
- # In case you want to group the events with different ids in the
10
- module RackTimeoutExtensions
11
- def raven_context
12
- { fingerprint: ["{{ default }}", env["REQUEST_PATH"].gsub(/\d/, '')] }
13
- end
14
- end
15
7
  end
@@ -0,0 +1,19 @@
1
+ module Dotenv
2
+ module Substitutions
3
+ module Command
4
+ class << self
5
+ INTERPOLATED_SHELL_COMMAND = /
6
+ (?<backslash>\\)? # is it escaped with a backslash?
7
+ COMMAND_EXPAND # literal $
8
+ (?<cmd> # collect command content for eval
9
+ \( # require opening paren
10
+ (?:[^()]|\g<cmd>)+ # allow any number of non-parens, or balanced
11
+ # parens (by nesting the <cmd> expression
12
+ # recursively)
13
+ \) # require closing paren
14
+ )
15
+ /x
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,5 +1,12 @@
1
1
  {
2
2
  "name": "<%= @app_name.camelcase %>",
3
+ "private": true,
4
+ "version": "0.0.1",
5
+ "scripts": {
6
+ "test": "vitest run",
7
+ "test:watch": "vitest",
8
+ "test:changes": "vitest --changed master"
9
+ },
3
10
  "engines": {
4
11
  "node": "<%= get(:node_version) %>"
5
12
  }
@@ -0,0 +1,14 @@
1
+ /* eslint-disable no-undef */
2
+ module.exports = {
3
+ theme: {
4
+ extend: {},
5
+ },
6
+ variants: {},
7
+ plugins: [],
8
+ content: [
9
+ './app/**/*.html',
10
+ './app/**/*.vue',
11
+ './app/**/*.js',
12
+ './app/**/*.erb',
13
+ ],
14
+ };
@@ -1,6 +1,7 @@
1
1
  require 'simplecov'
2
2
  require 'simplecov_text_formatter'
3
3
  require 'simplecov_linter_formatter'
4
+ require 'simplecov_json_formatter'
4
5
 
5
6
  SimpleCovLinterFormatter.setup do |config|
6
7
  config.scope = ENV.fetch(
@@ -50,7 +51,14 @@ SimpleCov.start 'rails' do
50
51
  add_filter 'lib/vue_component.rb'
51
52
 
52
53
  if ENV["CIRCLECI"]
53
- formatter(SimpleCov::Formatter::TextFormatter)
54
+ formatter(
55
+ SimpleCov::Formatter::MultiFormatter.new(
56
+ [
57
+ SimpleCov::Formatter::TextFormatter,
58
+ SimpleCov::Formatter::JSONFormatter
59
+ ]
60
+ )
61
+ )
54
62
  else
55
63
  formatter(
56
64
  SimpleCov::Formatter::MultiFormatter.new(
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "@vue/tsconfig/tsconfig.node.json",
3
+ "include": ["vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"],
4
+ "compilerOptions": {
5
+ "composite": true,
6
+ "types": ["node"]
7
+ }
8
+ }
@@ -1,32 +1,16 @@
1
1
  {
2
+ "extends": "@vue/tsconfig/tsconfig.web.json",
3
+ "include": ["env.d.ts", "app/**/*", "app/**/*.vue"],
2
4
  "compilerOptions": {
3
- "module": "ESNext",
4
- "moduleResolution": "Node",
5
- "resolveJsonModule": true,
6
- "useDefineForClassFields": true,
7
- "jsx": "preserve",
8
- "noImplicitThis": true,
9
- "strict": true,
10
- "isolatedModules": true,
11
- "preserveValueImports": true,
12
- "importsNotUsedAsValues": "error",
13
- "target": "esnext",
14
- "allowJs": true,
15
-
16
- // Recommended
17
- "esModuleInterop": true,
18
- "forceConsistentCasingInFileNames": true,
19
- // See <https://github.com/vuejs/vue-cli/pull/5688>
20
- "skipLibCheck": true,
21
- "baseUrl": "app/javascript/",
22
- "types": ["@types/jest", "@types/node"],
5
+ "baseUrl": ".",
6
+ "paths": {
7
+ "@/*": ["./app/frontend/*"]
8
+ }
23
9
  },
24
- "include": [
25
- "app/javascript/**/*.ts",
26
- "app/javascript/**/*.vue"
27
- ],
28
- "exclude": [
29
- "node_modules",
30
- "**/*.spec.ts"
10
+
11
+ "references": [
12
+ {
13
+ "path": "./tsconfig.config.json"
14
+ }
31
15
  ]
32
16
  }
@@ -0,0 +1,46 @@
1
+ import { fileURLToPath, URL } from 'node:url';
2
+ import { defineConfig } from 'vitest/config'
3
+ import RubyPlugin from 'vite-plugin-ruby';
4
+ import vue from '@vitejs/plugin-vue';
5
+
6
+ export default defineConfig({
7
+ plugins: [
8
+ RubyPlugin(),
9
+ vue()
10
+ ],
11
+ resolve: {
12
+ alias: {
13
+ vue: 'vue/dist/vue.esm-bundler.js',
14
+ '@': fileURLToPath(new URL('./app/frontend', import.meta.url)),
15
+ },
16
+ },
17
+ test: {
18
+ globals: true,
19
+ environment: 'jsdom',
20
+ coverage: {
21
+ provider: 'c8',
22
+ all: true,
23
+ include: ['app/frontend/**/*.{js,ts,vue}'],
24
+ exclude: [
25
+ /* default excludes */
26
+ 'coverage/**',
27
+ 'dist/**',
28
+ 'packages/*/test{,s}/**',
29
+ '**/*.d.ts',
30
+ 'cypress/**',
31
+ 'test{,s}/**',
32
+ 'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}',
33
+ '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}',
34
+ '**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}',
35
+ '**/__tests__/**',
36
+ '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
37
+ '**/.{eslint,mocha,prettier}rc.{js,cjs,yml}',
38
+ /* custom excludes */
39
+ 'app/frontend/**/*.spec.{js,ts,vue}',
40
+ 'app/frontend/**/*.mock.{js,ts,vue}',
41
+ 'app/frontend/active_admin/jquery.js',
42
+ 'app/frontend/entrypoints',
43
+ ]
44
+ }
45
+ },
46
+ })
@@ -172,10 +172,12 @@ module Potassium::CliOptions # rubocop:disable Metrics/ModuleLength
172
172
  default_test_value: false
173
173
  },
174
174
  {
175
- type: :flag,
176
- name: :front_end,
177
- desc: "Decides which front-end framework to use. Available: Vue, Angular 2, None",
178
- default_test_value: "None"
175
+ type: :switch,
176
+ name: :front_end_vite,
177
+ desc: "Whether to use Vite as frontend bundler",
178
+ negatable: true,
179
+ default_value: true,
180
+ default_test_value: true
179
181
  },
180
182
  {
181
183
  type: :switch,