bundlebun 0.2.3.1.3.7-x86_64-darwin → 0.3.0.1.3.8-x86_64-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0750c2946bd17c7633f6af114aac2e87f92ced3e10610cdf99f8e6268150618e
4
- data.tar.gz: eb9174e050b5d9ab7bf17a01e7578b8cf49067c25c003f8328cc42b2528bf3b7
3
+ metadata.gz: 8a5e0f382b3b2fd17494c46ffc439a12040fef6e0bba2531458afd1daa51ded9
4
+ data.tar.gz: 88d26780ff8251c043011b0ef89ad2780cf9a8d3362a48cb71e2f29a631daee7
5
5
  SHA512:
6
- metadata.gz: bcd887384fd5b7079d0514ad633e3262e7c3b70539b30f6a21c8c22dcb92d5e315d629c45ba5f822b6127e8b5a2735b5c9c6c20ad37514a3c64118af2fedba20
7
- data.tar.gz: eb2258b12fa4b2808b60fa1194515045500626759d9493d8ee7712ee6876b7731fbade6a5edb809a1d0eedf7630877db3eaad018d9c4deab7c19733701463994
6
+ metadata.gz: e5f92371ad7fc1cfc2ee618e9ada3b6c67e29debc926bdc9036376660d9a47d92ea54708a05bb57ab427cd6f40405f9cc77a43a5db01f1bee4c7f85a6d1863a2
7
+ data.tar.gz: cb324b45a7eaece117e58e6e0843fcd8814d88f50a6369b7a34087cbfced2018ddb60a06b27142f5982fdb1fb047965f4d632fc17e18d048ce9b0ba5196fb01b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [0.3.0] - 2026-01-29
2
+
3
+ - New `rake bun:install:package` task: automatically migrates `package.json` scripts to use `bin/bun`. Replaces calls to `bun`, `bunx`, `npx`, `npm run`, `yarn run`, `pnpm run`, and `pnpm exec` with their `bin/bun` equivalents. Asks for confirmation.
4
+ - New `rake bun:install:procfile` task: automatically migrates `Procfile` and `Procfile.*` files to use `bin/bun`. Same as above.
5
+ - Both tasks are automatically invoked by `rake bun:install` when the relevant files are detected.
6
+
1
7
  ## [0.2.3] - 2025-12-17
2
8
 
3
9
  - Update dependencies
data/README.md CHANGED
@@ -71,8 +71,8 @@ bundle install
71
71
  bundle add bundlebun
72
72
  ```
73
73
 
74
- If you're seeing a message like `Could not find gems matching 'bundlebun' valid for all resolution platforms
75
- (aarch64-linux, aarch64-linux-gnu <...> )`, [check this article](https://github.com/yaroslav/bundlebun/wiki/Could-not-find-gems-matching-'bundlebun'-valid-for-all-resolution-platforms).
74
+ _If you're seeing a message like `Could not find gems matching 'bundlebun' valid for all resolution platforms
75
+ (aarch64-linux, aarch64-linux-gnu <...> )`, [check this article](https://github.com/yaroslav/bundlebun/wiki/Could-not-find-gems-matching-'bundlebun'-valid-for-all-resolution-platforms)._
76
76
 
77
77
  Next, run:
78
78
 
@@ -82,7 +82,9 @@ rake bun:install
82
82
 
83
83
  The task will install a binstub (`bin/bun`) that you can use to run Bun commands; try running `bin/bun` or `bin/bun --version`.
84
84
 
85
- You should use `bin/bun` in your scripts, including your local runners like `Procfile.dev` or `Procfile`, and `package.json`—if you had a call to `node` or `bun` in the `scripts` section there.
85
+ If `package.json` is present, the installer will offer to migrate your scripts to use `bin/bun` (e.g., `bun` `bin/bun`, `npx` `bin/bun x`). You can also run `rake bun:install:package` manually later.
86
+
87
+ Similarly, if `Procfile` or `Procfile.*` files are present, the installer will offer to migrate those as well. Run `rake bun:install:procfile` manually if needed.
86
88
 
87
89
  _Windows tip:_ If you're on Windows, the `bin\bun.cmd` file will be created. If you've joined an existing project where only the Unix-like binstub exists at that location, just run `rake bun:install` again.
88
90
 
Binary file
@@ -8,5 +8,5 @@ module Bundlebun
8
8
  # a Bun runtime with version `1.1.38`.
9
9
  #
10
10
  # This constant always points to the "own" version of the gem.
11
- VERSION = '0.2.3'
11
+ VERSION = '0.3.0'
12
12
  end
@@ -26,6 +26,16 @@ namespace :bun do
26
26
  puts "vite-ruby detected.\n\n"
27
27
  Rake::Task['bun:install:vite'].invoke
28
28
  end
29
+
30
+ if File.exist?('package.json')
31
+ puts "package.json detected.\n\n"
32
+ Rake::Task['bun:install:package'].invoke
33
+ end
34
+
35
+ if Dir.glob('Procfile*').any?
36
+ puts "Procfile detected.\n\n"
37
+ Rake::Task['bun:install:procfile'].invoke
38
+ end
29
39
  end
30
40
 
31
41
  desc 'Install bundlebun: create `bin/bun` binstub'
@@ -170,4 +180,126 @@ namespace :bun do
170
180
 
171
181
  MESSAGE
172
182
  end
183
+
184
+ desc 'Migrate package.json scripts to use bin/bun'
185
+ task 'install:package' do
186
+ package_json_path = 'package.json'
187
+
188
+ unless File.exist?(package_json_path)
189
+ puts "No package.json found in the current directory."
190
+ next
191
+ end
192
+
193
+ begin
194
+ package = JSON.parse(File.read(package_json_path))
195
+ rescue JSON::ParserError
196
+ puts "Failed to parse package.json."
197
+ next
198
+ end
199
+
200
+ scripts = package['scripts']
201
+ if scripts.nil? || scripts.empty?
202
+ puts "No scripts found in package.json."
203
+ next
204
+ end
205
+
206
+ # Order in alternation matters: more specific patterns first
207
+ pattern = /\b(bunx|npx|pnpm exec|yarn exec|npm run|yarn run|pnpm run|bun)\b/
208
+ binstub = Bundlebun::Runner.binstub_path
209
+ replacements = {
210
+ 'bunx' => "#{binstub} x",
211
+ 'npx' => "#{binstub} x",
212
+ 'pnpm exec' => "#{binstub} x",
213
+ 'yarn exec' => "#{binstub} x",
214
+ 'npm run' => "#{binstub} run",
215
+ 'yarn run' => "#{binstub} run",
216
+ 'pnpm run' => "#{binstub} run",
217
+ 'bun' => binstub
218
+ }
219
+
220
+ changes = []
221
+ scripts.each do |name, value|
222
+ next unless value.is_a?(String)
223
+ next if value.include?(Bundlebun::Runner::BINSTUB_PATH)
224
+
225
+ new_value = value.gsub(pattern) { |match| replacements[match] }
226
+ changes << {name: name, old: value, new: new_value} if new_value != value
227
+ end
228
+
229
+ if changes.empty?
230
+ puts "All scripts in package.json already use bin/bun. No changes needed."
231
+ next
232
+ end
233
+
234
+ puts "The following changes will be made to package.json scripts:\n\n"
235
+ changes.each do |change|
236
+ puts " #{change[:name]}:"
237
+ puts " - #{change[:old]}"
238
+ puts " + #{change[:new]}"
239
+ puts
240
+ end
241
+
242
+ print "Apply these changes? [Y/n] "
243
+ answer = $stdin.gets&.strip&.downcase
244
+
245
+ if answer.empty? || answer == 'y' || answer == 'yes'
246
+ changes.each do |change|
247
+ package['scripts'][change[:name]] = change[:new]
248
+ end
249
+
250
+ File.write(package_json_path, JSON.pretty_generate(package) + "\n")
251
+ puts "\nUpdated package.json successfully."
252
+ else
253
+ puts "\nNo changes made."
254
+ end
255
+ end
256
+
257
+ desc 'Migrate Procfile commands to use bin/bun'
258
+ task 'install:procfile' do
259
+ procfiles = Dir.glob('Procfile*')
260
+
261
+ if procfiles.empty?
262
+ puts "No Procfile found in the current directory."
263
+ next
264
+ end
265
+
266
+ pattern = /\b(bunx|npx|pnpm exec|yarn exec|npm run|yarn run|pnpm run|bun)\b/
267
+ binstub = Bundlebun::Runner.binstub_path
268
+ replacements = {
269
+ 'bunx' => "#{binstub} x",
270
+ 'npx' => "#{binstub} x",
271
+ 'pnpm exec' => "#{binstub} x",
272
+ 'yarn exec' => "#{binstub} x",
273
+ 'npm run' => "#{binstub} run",
274
+ 'yarn run' => "#{binstub} run",
275
+ 'pnpm run' => "#{binstub} run",
276
+ 'bun' => binstub
277
+ }
278
+
279
+ procfiles.each do |procfile|
280
+ content = File.read(procfile)
281
+ next if content.include?(Bundlebun::Runner::BINSTUB_PATH)
282
+
283
+ new_content = content.gsub(pattern) { |match| replacements[match] }
284
+ next if new_content == content
285
+
286
+ puts "Changes for #{procfile}:\n\n"
287
+ content.lines.zip(new_content.lines).each do |old_line, new_line|
288
+ if old_line != new_line
289
+ puts " - #{old_line}"
290
+ puts " + #{new_line}"
291
+ end
292
+ end
293
+
294
+ print "Apply these changes? [Y/n] "
295
+ answer = $stdin.gets&.strip&.downcase
296
+
297
+ if answer.empty? || answer == 'y' || answer == 'yes'
298
+ File.write(procfile, new_content)
299
+ puts "Updated #{procfile} successfully.\n\n"
300
+ else
301
+ puts "No changes made to #{procfile}.\n\n"
302
+ end
303
+ end
304
+ end
173
305
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bundlebun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3.1.3.7
4
+ version: 0.3.0.1.3.8
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - Yaroslav Markin