Skip to content

Commit eaa91ee

Browse files
author
Template Bot
committed
Apply template update: switch from yarn to pnpm (conflicts)
Source: mockdeep/Rails-Template#1331 This cherry-pick had conflicts that need manual resolution. Search for <<<<<<< in the changed files.
1 parent a5f77a8 commit eaa91ee

10 files changed

Lines changed: 5183 additions & 0 deletions

File tree

.circleci/config.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,30 @@ jobs:
2929
install-chrome: false
3030
install-chromedriver: false
3131

32+
<<<<<<< HEAD
3233
# - node/install:
3334
# node-version: 16.13.1
3435
# install-yarn: true
3536

3637
- run:
3738
name: Which bundler?
3839
command: bundle -v
40+
=======
41+
- node/install:
42+
node-version: 22.22.0
43+
44+
- node/install-packages:
45+
pkg-manager: pnpm
46+
47+
- browser-tools/install_firefox
48+
49+
- run:
50+
name: Which versions?
51+
command: |
52+
bundle -v
53+
node --version
54+
pnpm --version
55+
>>>>>>> e21d1af (switch from yarn to pnpm (#1331))
3956

4057
# https://circleci.com/docs/2.0/caching/
4158
- restore_cache:
@@ -77,13 +94,39 @@ jobs:
7794
name: Database setup
7895
command: bundle exec rake db:create db:schema:load --trace
7996

97+
<<<<<<< HEAD
8098
# - run:
8199
# name: Brakeman
82100
# command: bundle exec brakeman
83101

84102
# - run:
85103
# name: Stylelint
86104
# command: yarn stylelint
105+
=======
106+
- run:
107+
name: Typescript
108+
command: pnpm tscheck
109+
110+
- run:
111+
name: Find Unused ESLint Rules
112+
command: pnpm eslint_find_unused_rules
113+
114+
- run:
115+
name: ESLint
116+
command: pnpm eslint
117+
118+
- run:
119+
name: Vitest
120+
command: pnpm vitest run --coverage
121+
122+
- run:
123+
name: Brakeman
124+
command: bundle exec brakeman
125+
126+
- run:
127+
name: Stylelint
128+
command: pnpm stylelint
129+
>>>>>>> e21d1af (switch from yarn to pnpm (#1331))
87130

88131
- run:
89132
name: Rubocop

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@
2626

2727
spec/examples.txt
2828

29+
<<<<<<< HEAD
2930
# Ignore local .env files
3031
*.local
3132
.env
33+
=======
34+
/public/packs
35+
/public/packs-test
36+
/node_modules
37+
/app/assets/builds/*
38+
!/app/assets/builds/.keep
39+
tsconfig.tsbuildinfo
40+
.eslintcache
41+
42+
# Ignore local environment variable files.
43+
.env.*.local
44+
>>>>>>> e21d1af (switch from yarn to pnpm (#1331))

.tool-versions

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
ruby 4.0.1
2+
<<<<<<< HEAD
23
bundler 2.6.2
34
postgres 14.6
5+
=======
6+
nodejs 22.22.0
7+
postgres 16.8
8+
pnpm 10.5.2
9+
>>>>>>> e21d1af (switch from yarn to pnpm (#1331))

Procfile.dev

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
web: PORT=3000 bundle exec puma -C config/puma.rb
2+
js: pnpm build --watch

bin/update

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "fileutils"
5+
include FileUtils
6+
7+
# path to your application root.
8+
APP_ROOT = File.expand_path("..", __dir__)
9+
10+
def system!(*args)
11+
system(*args) || abort("\n== Command #{args} failed ==")
12+
end
13+
14+
chdir APP_ROOT do
15+
# This script is a way to update your development environment automatically.
16+
# Add necessary update steps to this file.
17+
18+
puts "== Installing dependencies =="
19+
system!("gem install bundler --conservative")
20+
system("bundle check") || system!("bundle install")
21+
22+
# Install JavaScript dependencies
23+
# system('pnpm install')
24+
25+
puts "\n== Updating database =="
26+
system!("bin/rails db:migrate")
27+
28+
puts "\n== Removing old logs and tempfiles =="
29+
system!("bin/rails log:clear tmp:clear")
30+
31+
puts "\n== Restarting application server =="
32+
system!("bin/rails restart")
33+
end

exe/eslint_autogen

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "active_support/all"
5+
6+
TODO_FILE_PATH = "./.eslint_todo.ts"
7+
HEADING = <<~COMMENTS.freeze
8+
// This configuration was generated by `exe/eslint_autogen`
9+
// on #{Time.now.utc}.
10+
// The point is for the user to remove these configuration records
11+
// one by one as the offenses are removed from the code base.
12+
COMMENTS
13+
14+
File.write(TODO_FILE_PATH, "export default []")
15+
json = `pnpm eslint --format json`
16+
results = JSON.parse(json)
17+
18+
by_rule =
19+
results.each_with_object({}) do |result, hash|
20+
result.fetch("messages").each do |message|
21+
rule_id = message.fetch("ruleId")
22+
next if rule_id.nil?
23+
24+
hash[rule_id] ||= []
25+
hash[rule_id] << result.fetch("filePath")
26+
end
27+
end
28+
29+
output = StringIO.new
30+
output.puts(HEADING)
31+
output.puts
32+
output.puts("export default [")
33+
34+
by_rule.sort.each do |rule, file_paths|
35+
output.puts(" // Offense count: #{file_paths.length}")
36+
output.puts(" {")
37+
output.puts(" files: [")
38+
39+
file_paths.uniq.sort.each do |file_path|
40+
relative_path = file_path.sub("#{Dir.pwd}/", "")
41+
output.puts(" \"#{relative_path}\",")
42+
end
43+
44+
output.puts(" ],")
45+
output.puts(" rules: {")
46+
output.puts(" \"#{rule}\": \"off\",")
47+
output.puts(" },")
48+
output.puts(" },")
49+
end
50+
51+
output.puts("];")
52+
53+
File.write(TODO_FILE_PATH, output.string)

exe/stylelint_autogen

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require "active_support/all"
5+
require "stringio"
6+
7+
TODO_FILE_PATH = "./.stylelint_todo.yml"
8+
HEADING = <<~COMMENTS.freeze
9+
# This configuration was generated by `exe/stylelint_autogen`
10+
# on #{Time.now.utc}.
11+
# The point is for the user to remove these configuration records
12+
# one by one as the offenses are removed from the code base.
13+
COMMENTS
14+
15+
File.write(TODO_FILE_PATH, "{}")
16+
json = `pnpm stylelint --quiet-deprecation-warnings --formatter json 2>&1`
17+
results = JSON.parse(json)
18+
19+
by_rule =
20+
results.each_with_object({}) do |result, hash|
21+
result.fetch("warnings").each do |warning|
22+
hash[warning.fetch("rule")] ||= []
23+
hash[warning.fetch("rule")] << result.fetch("source")
24+
end
25+
end
26+
27+
output = StringIO.new
28+
output.puts(HEADING)
29+
output.puts
30+
output.puts("overrides:")
31+
32+
by_rule.sort.each do |rule, file_paths|
33+
output.puts
34+
output.puts(" # Offense count: #{file_paths.length}")
35+
output.puts(" - rules: { '#{rule}': null }")
36+
output.puts(" files:")
37+
38+
file_paths.uniq.sort.each do |file_path|
39+
output.puts(" - #{file_path.sub("#{Dir.pwd}/", "")}")
40+
end
41+
end
42+
43+
File.write(TODO_FILE_PATH, output.string)

package.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"name": "YourAppNameHere",
3+
"private": true,
4+
"engines": {
5+
"node": "22.22.0"
6+
},
7+
"packageManager": "pnpm@10.5.2",
8+
"version": "0.1.0",
9+
"dependencies": {
10+
"@hotwired/stimulus": "^3.2.2",
11+
"@hotwired/turbo": "^8.0.21",
12+
"@hotwired/turbo-rails": "^8.0.21",
13+
"@rails/actioncable": "^8.1.100",
14+
"@rails/activestorage": "^8.1.200"
15+
},
16+
"devDependencies": {
17+
"@eslint/eslintrc": "^3.3.3",
18+
"@eslint/js": "^9.39.2",
19+
"@stylistic/eslint-plugin": "^5.7.0",
20+
"@types/hotwired__turbo": "^8.0.5",
21+
"@types/node": "^25.0.3",
22+
"@types/rails__actioncable": "^8.0.3",
23+
"@typescript-eslint/eslint-plugin": "^8.50.0",
24+
"@typescript-eslint/parser": "^8.50.0",
25+
"@vitest/coverage-v8": "^4.0.18",
26+
"esbuild": "^0.27.1",
27+
"eslint": "^9.39.2",
28+
"eslint-find-rules": "^5.0.0",
29+
"eslint-import-resolver-typescript": "^4.4.4",
30+
"eslint-plugin-import": "^2.32.0",
31+
"eslint-plugin-sort-keys-fix": "^1.1.2",
32+
"eslint-plugin-vitest": "^0.5.4",
33+
"globals": "^17.0.0",
34+
"jiti": "^2.6.1",
35+
"jsdom": "^28.0.0",
36+
"stylelint": "^16.26.1",
37+
"stylelint-config-property-sort-order-smacss": "^11.0.0",
38+
"stylelint-config-standard": "^40.0.0",
39+
"stylelint-selector-bem-pattern": "^4.0.1",
40+
"typescript": "^5.9.3",
41+
"typescript-eslint": "^8.54.0",
42+
"vitest": "^4.0.18"
43+
},
44+
"scripts": {
45+
"build": "esbuild app/javascript/*.* --bundle --sourcemap --format=iife --outdir=app/assets/builds --public-path=/assets",
46+
"eslint": "eslint ./ --cache --max-warnings=0",
47+
"eslint_find_unused_rules": "eslint-find-rules --unused --flatConfig --no-core eslint.config.mts",
48+
"pretest": "pnpm tscheck && pnpm eslint",
49+
"stylelint": "./node_modules/stylelint/bin/stylelint.mjs 'app/assets/stylesheets/**/*'",
50+
"test": "pnpm vitest run --coverage",
51+
"tscheck": "tsc --noEmit"
52+
}
53+
}

0 commit comments

Comments
 (0)