Skip to content

Commit b578665

Browse files
authored
update
1 parent 14c6351 commit b578665

2 files changed

Lines changed: 12 additions & 13 deletions

File tree

_plugins/node.rb

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
33

44
module Node
55
class << self
6-
attr_reader :runtime, :package_manager
6+
attr_reader :runtime
77

88
def init
9-
_, _, status = Open3.capture3("bun", "-v")
10-
if status.success?
11-
@runtime = "bun"
12-
@package_manager = "bun"
13-
return
9+
begin
10+
stdout, _, status = Open3.capture3("bun", "-v")
11+
if status.success?
12+
@runtime = "bun"
13+
Jekyll.logger.info "Node:", "[init] #{@runtime} #{stdout}"
14+
return
15+
end
16+
rescue
1417
end
1518

16-
_, stderr, status = Open3.capture3("node", "-v")
19+
stdout, stderr, status = Open3.capture3("node", "-v")
1720
raise stderr unless status.success?
18-
1921
@runtime = "node"
20-
@package_manager = "npm"
22+
Jekyll.logger.info "Node:", "[init] #{@runtime} #{stdout}"
2123
end
2224

2325
def call(name, param)

_plugins/scripts/webp.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
/// <reference types="node" />
2-
/// <reference types="bun" />
3-
41
import fs from "fs";
52
import path from "path";
63
import sharp from "sharp";
74

85
async function webp({ source, destination }) {
9-
if (Bun && Bun.Image) {
6+
if (global.Bun && Bun.Image) {
107
await Bun.file(source).image().webp().write(destination);
118
} else {
129
await sharp(source).toFile(destination);

0 commit comments

Comments
 (0)