Skip to content

Commit e5c7172

Browse files
committed
Big change: move to pnpm
1 parent 9e4c034 commit e5c7172

13 files changed

Lines changed: 2180 additions & 1666 deletions

File tree

.github/workflows/ci.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,18 @@ jobs:
3535
ruby-version: .ruby-version
3636
bundler-cache: true
3737

38+
- name: Install pnpm
39+
uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
40+
with:
41+
version: 11
42+
43+
- uses: actions/setup-node@v6
44+
with:
45+
node-version-file: .node-version
46+
cache: 'pnpm'
47+
3848
- name: Scan for security vulnerabilities in JavaScript dependencies
39-
run: bin/yarn audit
49+
run: bin/pnpm audit
4050

4151
lint_rb:
4252
runs-on: ubuntu-latest
@@ -95,17 +105,17 @@ jobs:
95105
ruby-version: .ruby-version
96106
bundler-cache: true
97107

98-
- uses: actions/setup-node@v6
108+
- name: Install pnpm
109+
uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5
99110
with:
100-
node-version-file: .node-version
111+
version: 11
101112

102-
- uses: actions/cache@v5
113+
- uses: actions/setup-node@v6
103114
with:
104-
path: '**/node_modules'
105-
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
115+
node-version-file: .node-version
116+
cache: 'pnpm'
106117

107-
- name: Install NPM modules
108-
run: bin/yarn install
118+
- run: pnpm install --frozen-lockfile
109119

110120
- name: Build App
111121
run: bin/rails db:setup

Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ RUN apt-get update -qq && \
3030
rm -rf /var/lib/apt/lists /var/cache/apt/archives
3131

3232
# Install JavaScript dependencies
33-
ARG NODE_VERSION=24.11.0
34-
ARG YARN_VERSION=1.22.22
33+
ARG NODE_VERSION=24.16.0
34+
ARG PNPM_VERSION=11.4.0
3535
ENV PATH=/usr/local/node/bin:$PATH
3636
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
3737
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" --verbose /usr/local/node && \
38-
npm install -g yarn@$YARN_VERSION && \
38+
npm install -g pnpm@$PNPM_VERSION && \
3939
rm -rf /tmp/node-build-master
4040

4141
# Install application gems
@@ -46,8 +46,8 @@ RUN bundle install && \
4646
bundle exec bootsnap precompile -j 1 --gemfile
4747

4848
# Install node modules
49-
COPY package.json yarn.lock ./
50-
RUN yarn install --immutable
49+
COPY package.json pnpm*.yaml ./
50+
RUN pnpm install --frozen-lockfile
5151

5252
# Copy application code
5353
COPY . .

Procfile.dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
web: env RUBY_DEBUG_OPEN=true bin/rails server
22
worker: sleep 2 && env QUEUE=* bin/rails resque:work
3-
js: yarn build --watch
4-
css: yarn watch:css
3+
js: pnpm build --watch
4+
css: pnpm watch:css

bin/pnpm

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env ruby
2+
APP_ROOT = File.expand_path('..', __dir__)
3+
Dir.chdir(APP_ROOT) do
4+
pnpm = ENV.fetch('PATH', '').split(File::PATH_SEPARATOR)
5+
.reject { |dir| File.expand_path(dir) == __dir__ }
6+
.product(%w[pnpm pnpm.cmd pnpm.ps1])
7+
.map { |dir, file| File.expand_path(file, dir) }
8+
.find { |file| File.executable?(file) }
9+
10+
if pnpm
11+
exec pnpm, *ARGV
12+
else
13+
$stderr.puts 'pnpm executable was not detected in the system.'
14+
$stderr.puts 'Install pnpm via https://pnpm.io/installation'
15+
exit 1
16+
end
17+
end
18+

bin/setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ FileUtils.chdir APP_ROOT do
1818
system('bundle check') || system!('bundle install')
1919

2020
# Install JavaScript dependencies
21-
system! 'bin/yarn'
21+
system! 'bin/pnpm'
2222

2323
# puts "\n== Copying sample files =="
2424
# unless File.exist?('config/database.yml')

bin/update

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ chdir APP_ROOT do
1717
system! 'gem install bundler --conservative'
1818
system('bundle check') || system!('bundle install')
1919

20-
# Install JavaScript dependencies if using Yarn
21-
# system('bin/yarn')
20+
# Install JavaScript dependencies if using pnpm
21+
# system('bin/pnpm')
2222

2323
puts "\n== Updating database =="
2424
system! 'bin/rails db:migrate'

bin/yarn

Lines changed: 0 additions & 18 deletions
This file was deleted.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
"browserslist": [
3131
"defaults"
3232
],
33-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e",
33+
"packageManager": "pnpm@11.4.0+sha512.f0febc7e37552ab485494a914241b338e0b3580b93d54ce31f00933015880863129038a1b4ae4e414a0ee63ac35bf21197e990172c4a68256450b5636310968f",
3434
"scripts": {
3535
"build": "esbuild app/javascript/*.* --bundle --sourcemap --outdir=app/assets/builds --public-path=/assets",
3636
"build:css:compile": "sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules",
3737
"build:css:prefix": "postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css",
38-
"build:css": "yarn build:css:compile && yarn build:css:prefix",
39-
"watch:css": "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec \"yarn build:css\""
38+
"build:css": "pnpm build:css:compile && pnpm build:css:prefix",
39+
"watch:css": "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec \"pnpm build:css\""
4040
}
4141
}

0 commit comments

Comments
 (0)