Skip to content

Commit

Permalink
Update Rails 7.1, Node 18, stylelint-config 1.1 and fix deprecated usage
Browse files Browse the repository at this point in the history
  • Loading branch information
malparty committed Dec 14, 2023
1 parent 76b3477 commit 3dc8632
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_generated_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ env:
DOCKER_REGISTRY_USERNAME: ${{ github.repository_owner }}
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
RUBY_VERSION: 3.2.2
NODE_VERSION: 16
RAILS_VERSION: 7.0.6
NODE_VERSION: 18
RAILS_VERSION: 7.1.2

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_production_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ env:
DOCKER_IMAGE: ${{ github.repository }}
DOCKER_REGISTRY_HOST: ${{ secrets.DOCKER_REGISTRY_HOST }}
RUBY_VERSION: 3.2.2
NODE_VERSION: 16
RAILS_VERSION: 7.0.6
NODE_VERSION: 18
RAILS_VERSION: 7.1.2

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .template/addons/github/.github/workflows/test.yml.tt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
DOCKER_REGISTRY_TOKEN: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
DOCKER_IMAGE: ${{ github.repository }}
<%- if WEB_VARIANT -%>
NODE_VERSION: 16
NODE_VERSION: 18
<%- end -%>

# Set the default docker-compose file
Expand Down
1 change: 0 additions & 1 deletion .template/variants/web/.stylelintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"@nimblehq/stylelint-config-nimble"
],
"rules": {
"no-eol-whitespace": true,
"max-nesting-depth": 3,
"scss/at-extend-no-missing-placeholder": null,
"order/properties-alphabetical-order": null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
@use 'sass:list';

@function em($values, $base-font-size: 16px) {
$list: ();

@each $value in $values {
@if ($value == 0 or $value == auto) {
$list: append($list, $value);
$list: list.append($list, $value);
} @else {
$em-value: calc($value / $base-font-size) + em;
$list: append($list, $em-value);
$list: list.append($list, $em-value);
}
}

Expand All @@ -18,10 +20,10 @@

@each $value in $values {
@if ($value == 0 or $value == auto) {
$list: append($list, $value);
$list: list.append($list, $value);
} @else {
$rem-value: calc($value / $base-font-size) + rem;
$list: append($list, $rem-value);
$list: list.append($list, $rem-value);
}
}

Expand Down
2 changes: 1 addition & 1 deletion .template/variants/web/package.json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
run 'yarn add --dev eslint'
run 'yarn add --dev stylelint'
run 'yarn add --dev @nimblehq/[email protected]'
run 'yarn add --dev @nimblehq/stylelint-config-nimble@1.0.2'
run 'yarn add --dev @nimblehq/stylelint-config-nimble@1.1.0'

# Setup scripts
run 'npm pkg set scripts.eslint="eslint . --color"'
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
nodejs 16.20.1
nodejs >= 18
ruby 3.2.2
2 changes: 1 addition & 1 deletion Gemfile.tt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'
ruby '<%= RUBY_VERSION %>'

# Backend
gem 'rails', '7.0.6' # Latest stable
gem 'rails', '7.1.2' # Latest stable
gem 'pg' # Use Postgresql as database
gem 'puma' # Use Puma as the app server
gem 'mini_magick' # A ruby wrapper for ImageMagick or GraphicsMagick command line
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ with building complex applications over the years.
### Requirements

- Install ruby and set your local ruby version to `3.2.2`
- Install rails `7.0.6`
- Install node `16.20.1` (For creating web application)
- Install rails `7.1.2`
- Install node `18.19.0` (For creating web application)

> 📝 If running on Apple M1, to build docker image, please make sure to set platform to AMD64 by `export DOCKER_DEFAULT_PLATFORM=linux/amd64`
Expand Down
40 changes: 24 additions & 16 deletions template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
}.freeze

if WEB_VARIANT
NODE_VERSION = '16.20.1'
NODE_SOURCE_VERSION = '16' # Used in Dockerfile https://github.com/nodesource/distributions
NODE_VERSION = '18.19.0'
NODE_SOURCE_VERSION = '18' # Used in Dockerfile https://github.com/nodesource/distributions
end

def apply_template!(template_root)
Expand Down Expand Up @@ -80,20 +80,27 @@ def apply_template!(template_root)
end

def ask_for_optional_addons
@install_github_action = true if yes?(install_addon_prompt('Github Action and Wiki'))
@install_openapi = true if API_VARIANT || yes?(install_addon_prompt('OpenAPI'))
@install_mock_server = true if @install_openapi && yes?(install_addon_prompt('Mock Server'))
@install_semaphore = true if yes?(install_addon_prompt('SemaphoreCI'))
@install_nginx = true if yes?(install_addon_prompt('Nginx'))
@install_phrase = true if yes?(install_addon_prompt('Phrase'))
@install_devise = true if yes?(install_addon_prompt('Devise'))

return unless WEB_VARIANT

@install_bootstrap = true if yes?(install_addon_prompt('Bootstrap'))
@install_slim = true if yes?(install_addon_prompt('Slim Template Engine'))
@install_hotwire = true if yes?(install_addon_prompt('Hotwire'))
@install_svgeez = true if yes?(install_addon_prompt('Svgeez'))
ask_for_all_variant_addons

ask_for_web_variant_addons if WEB_VARIANT
end

def ask_for_all_variant_addons
@install_github_action = yes?(install_addon_prompt('Github Action and Wiki'))
@install_openapi = API_VARIANT || yes?(install_addon_prompt('OpenAPI'))
@install_mock_server = @install_openapi && yes?(install_addon_prompt('Mock Server'))
@install_semaphore = yes?(install_addon_prompt('SemaphoreCI'))
@install_nginx = yes?(install_addon_prompt('Nginx'))
@install_phrase = yes?(install_addon_prompt('Phrase'))
@install_crud = WEB_VARIANT && yes?(install_addon_prompt('Crud (includes Devise, Bootstrap and Slim)'))
@install_devise = @install_crud || yes?(install_addon_prompt('Devise'))
end

def ask_for_web_variant_addons
@install_bootstrap = @install_crud || yes?(install_addon_prompt('Bootstrap'))
@install_slim = @install_crud || yes?(install_addon_prompt('Slim Template Engine'))
@install_hotwire = yes?(install_addon_prompt('Hotwire'))
@install_svgeez = yes?(install_addon_prompt('Svgeez'))
end

def apply_optional_addons
Expand All @@ -103,6 +110,7 @@ def apply_optional_addons
apply '.template/addons/nginx/template.rb' if @install_nginx
apply '.template/addons/phrase/template.rb' if @install_phrase
apply '.template/addons/devise/template.rb' if @install_devise
apply '.template/addons/crud/template.rb' if @install_crud
end

# Set Thor::Actions source path for looking up the files
Expand Down

0 comments on commit 3dc8632

Please sign in to comment.