diff --git a/template.rb b/template.rb index 8108998f..8844a655 100644 --- a/template.rb +++ b/template.rb @@ -112,7 +112,6 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met apply "variants/backend-base/bin/template.rb" apply "variants/backend-base/config/template.rb" apply "variants/backend-base/doc/template.rb" - apply "variants/backend-base/lib/template.rb" apply "variants/backend-base/public/template.rb" apply "variants/backend-base/spec/template.rb" @@ -122,6 +121,10 @@ def apply_template! # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Met after_bundle do require_package_json_gem + apply "variants/backend-base/lib/template.rb" + + template "variants/backend-base/bin/setup.tt", "bin/setup", force: true + # Remove the `test/` directory because we always use RSpec which creates # its own `spec/` directory remove_dir "test" diff --git a/variants/backend-base/bin/setup b/variants/backend-base/bin/setup.tt similarity index 95% rename from variants/backend-base/bin/setup rename to variants/backend-base/bin/setup.tt index 566bfdf9..673aff49 100755 --- a/variants/backend-base/bin/setup +++ b/variants/backend-base/bin/setup.tt @@ -5,7 +5,7 @@ def setup! test "ruby -v" => ruby_version run "gem install bundler --no-document --conservative" run "bundle install" - run "yarn install" if File.exist?("yarn.lock") + run "<%= package_json.manager.native_install_command %>" if File.exist?("package.json") run "bundle exec overcommit --install" copy "example.env" copy "config/secrets.example.yml" diff --git a/variants/backend-base/lib/tasks/assets.rake b/variants/backend-base/lib/tasks/assets.rake.tt similarity index 65% rename from variants/backend-base/lib/tasks/assets.rake rename to variants/backend-base/lib/tasks/assets.rake.tt index cccebfef..684c525c 100644 --- a/variants/backend-base/lib/tasks/assets.rake +++ b/variants/backend-base/lib/tasks/assets.rake.tt @@ -1,7 +1,7 @@ namespace :assets do desc "Ensures that dependencies required to compile assets are installed" task install_dependencies: :environment do - raise if File.exist?("yarn.lock") && !(system "yarn install --frozen-lockfile") + raise if File.exist?("package.json") && !(system "<%= package_json.manager.native_install_command(frozen: true) %>") end end diff --git a/variants/backend-base/lib/template.rb b/variants/backend-base/lib/template.rb index 6c68cef1..e8266478 100644 --- a/variants/backend-base/lib/template.rb +++ b/variants/backend-base/lib/template.rb @@ -1,4 +1,5 @@ copy_file "variants/backend-base/lib/tasks/coverage.rake", "lib/tasks/coverage.rake" -copy_file "variants/backend-base/lib/tasks/assets.rake", "lib/tasks/assets.rake" copy_file "variants/backend-base/lib/tasks/app.rake", "lib/tasks/app.rake" copy_file "variants/backend-base/lib/tasks/dev.rake", "lib/tasks/dev.rake" + +template "variants/backend-base/lib/tasks/assets.rake.tt", "lib/tasks/assets.rake", force: true diff --git a/variants/frontend-base/template.rb b/variants/frontend-base/template.rb index 938450f6..1a952ed9 100644 --- a/variants/frontend-base/template.rb +++ b/variants/frontend-base/template.rb @@ -13,7 +13,9 @@ remove_dir "app/assets/stylesheets" remove_dir "app/assets/images" -# this will create a package.json for us +# shakapacker will create a more complete package.json +remove_file "package.json" + run "rails shakapacker:install" # this is added by shakapacker:install, but we've already got one (with some extra tags) diff --git a/variants/github_actions_ci/workflows/ci.yml.tt b/variants/github_actions_ci/workflows/ci.yml.tt index 4bbfabda..7ec9c7ff 100644 --- a/variants/github_actions_ci/workflows/ci.yml.tt +++ b/variants/github_actions_ci/workflows/ci.yml.tt @@ -47,12 +47,12 @@ jobs: with: node-version-file: ".node-version" cache: "yarn" - - run: yarn install --frozen-lockfile + - run: <%- package_json.manager.native_install_command(frozen: true) -%> <%- if TEMPLATE_CONFIG.use_typescript? -%> - - run: yarn run typecheck + - run: <%- package_json.manager.native_run_command("install") -%> <%- end -%> - - run: yarn run js-lint - - run: yarn run format-check + - run: <%- package_json.manager.native_run_command("js-lint") -%> + - run: <%- package_json.manager.native_run_command("format-check") -%> ruby_based_checks: runs-on: ubuntu-latest timeout-minutes: 20 @@ -105,7 +105,7 @@ jobs: with: node-version-file: ".node-version" cache: "yarn" - - run: yarn install --frozen-lockfile + - run: <%- package_json.manager.native_install_command(frozen: true) -%> - run: bundle exec rspec spec --format progress - name: Archive spec outputs uses: actions/upload-artifact@v3