node-runner 1.1.0 → 1.3.0

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: aaadb4234b05108dec2d60b995df86e7546d3e2c1a62022c796f5c62a552e83c
4
- data.tar.gz: ec76ab4ac759104ed00877d622e3fe4dedcebff0aa7c16108a60c9b26abd4d54
3
+ metadata.gz: c86125884fd2ac5babe8931308f928f3d0812c0d02a8f1c2d2383058a2e67a97
4
+ data.tar.gz: 66d565a69bae8e8044dbdc5b3675963280b04eeb3c1b99afbe32628c29410601
5
5
  SHA512:
6
- metadata.gz: 59c70fa43ebefeefa2fb8b3110e780a87d0d986bac41063714196ce4e9da1673113d8cf1ef1138fd45a02aba3128a8b2383933c5a66d82f3d7673d35059a40b9
7
- data.tar.gz: ddfec3af8f70482c3e8a7f539b7aa5e13c227a9dbeed00a427b2c3419a8c04ce7b1f5166a2fdfa512b11d939c47878d98b143bf93a3c372a755d3b008bb215d9
6
+ metadata.gz: 5e58a2e0bb020bce41b81668faa5d6a47fe9eeaaa73acda41ed6822983bd238eb3728cdcef61d913d526cafa2c263047b4610e3a2e3779d62ff994e6559d5986
7
+ data.tar.gz: 0c65d16e8e3a200ea929ade970169c14fa051f89418e8131b1dc57df7f7d8789960fca9ae89b294c1b4338ad9f4017f06a42b08c83c7505e845db2571c0ee580
data/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@
4
4
 
5
5
  ...
6
6
 
7
+ ## 1.3.0 / 2025-09-11
8
+
9
+ - Migrate repo to Codeberg
10
+ - Minimum Ruby version is now 3.1
11
+
12
+ ## 1.2.0 / 2024-04-05
13
+
14
+ - Add support for functions returning promises
15
+
7
16
  ## 1.1.0 / 2021-10-17
8
17
 
9
18
  - fix: windows support for extensions [#1](https://github.com/bridgetownrb/node-runner/pull/1) ([bglw](https://github.com/bglw))
data/README.md CHANGED
@@ -12,10 +12,10 @@ Run this command to add this plugin to your project's Gemfile:
12
12
  $ bundle add node-runner
13
13
  ```
14
14
 
15
- For [Bridgetown](https://www.bridgetownrb.com) websites (requires v0.15 or later), you can run an automation to install NodeRunner and set up a builder plugin for further customization.
15
+ For [Bridgetown](https://www.bridgetownrb.com) websites, you can run an automation to install NodeRunner and set up a builder plugin for further customization.
16
16
 
17
17
  ```shell
18
- bundle exec bridgetown apply https://github.com/bridgetownrb/node-runner
18
+ bin/bridgetown apply https://codeberg.org/jaredwhite/node-runner/raw/branch/main/bridgetown.automation.rb
19
19
  ```
20
20
 
21
21
  ## Usage
@@ -85,17 +85,17 @@ NodeRunner.new "…", executor: NodeRunner::Executor.new(command: "/path/to/cust
85
85
 
86
86
  A single run of a script is quite fast, nearly as fast as running a script directly with the
87
87
  `node` CLI…because that's essentially what is happening here. However, the performance characteristics using
88
- this in a high-traffic request/response cycle (say, from a Rails app) is unknown. Likely the best context to use
88
+ this in a high-traffic request/response cycle is unknown. Likely the best context to use
89
89
  Node Runner would be via a background job, or during a build process like when using a static site generator.
90
- (Like our parent project [Bridgetown](https://github.com/bridgetownrb/bridgetown)!)
90
+ (Like our parent project [Bridgetown](https://www.bridgetownrb.com)!)
91
91
 
92
92
  ## Testing
93
93
 
94
- * Run `bundle exec rake` to run the test suite.
94
+ * Run `bin/rake` to run the test suite.
95
95
 
96
96
  ## Contributing
97
97
 
98
- 1. Fork it (https://github.com/bridgetownrb/node-runner/fork)
98
+ 1. Fork it (https://codeberg.org/jaredwhite/node-runner/fork)
99
99
  2. Create your feature branch (`git checkout -b my-new-feature`)
100
100
  3. Commit your changes (`git commit -am 'Add some feature'`)
101
101
  4. Push to the branch (`git push origin my-new-feature`)
data/bin/rake ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rake' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rake", "rake")
@@ -5,7 +5,7 @@ create_builder builder_file do
5
5
  <<~RUBY
6
6
  require "node-runner"
7
7
 
8
- class NodeScriptBuilder < SiteBuilder
8
+ class Builders::NodeScriptBuilder < SiteBuilder
9
9
  def build
10
10
  # access output in Liquid with {{ site.data.node_script.hello }}
11
11
  add_data "node_script" do
data/lib/node_runner.js CHANGED
@@ -2,8 +2,10 @@
2
2
 
3
3
  try {
4
4
  const args = #{args}
5
- const output = JSON.stringify(['ok', #{func}(...args), []])
6
- process.stdout.write(output)
5
+ Promise.resolve(#{func}(...args)).then(result => {
6
+ const output = JSON.stringify(['ok', result, []])
7
+ process.stdout.write(output)
8
+ })
7
9
  } catch (err) {
8
10
  process.stdout.write(JSON.stringify(['err', '' + err, err.stack]))
9
11
  }
data/lib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  class NodeRunner
2
- VERSION = "1.1.0"
2
+ VERSION = "1.3.0"
3
3
  end
4
4
 
data/node-runner.gemspec CHANGED
@@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
8
8
  spec.author = "Bridgetown Team"
9
9
  spec.email = "maintainers@bridgetownrb.com"
10
10
  spec.summary = "A simple way to execute Javascript in a Ruby context via Node"
11
- spec.homepage = "https://github.com/bridgetownrb/node-runner"
11
+ spec.homepage = "https://codeberg.org/jaredwhite/node-runner"
12
12
  spec.license = "MIT"
13
13
 
14
- spec.required_ruby_version = ">= 2.5"
14
+ spec.required_ruby_version = ">= 3.1"
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|script|spec|features)/!) }
17
17
  spec.require_paths = ["lib"]
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: node-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-17 00:00:00.000000000 Z
11
+ date: 2025-09-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description:
13
+ description:
14
14
  email: maintainers@bridgetownrb.com
15
15
  executables: []
16
16
  extensions: []
@@ -22,16 +22,17 @@ files:
22
22
  - LICENSE.txt
23
23
  - README.md
24
24
  - Rakefile
25
+ - bin/rake
25
26
  - bridgetown.automation.rb
26
27
  - lib/node-runner.rb
27
28
  - lib/node_runner.js
28
29
  - lib/version.rb
29
30
  - node-runner.gemspec
30
- homepage: https://github.com/bridgetownrb/node-runner
31
+ homepage: https://codeberg.org/jaredwhite/node-runner
31
32
  licenses:
32
33
  - MIT
33
34
  metadata: {}
34
- post_install_message:
35
+ post_install_message:
35
36
  rdoc_options: []
36
37
  require_paths:
37
38
  - lib
@@ -39,15 +40,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
39
40
  requirements:
40
41
  - - ">="
41
42
  - !ruby/object:Gem::Version
42
- version: '2.5'
43
+ version: '3.1'
43
44
  required_rubygems_version: !ruby/object:Gem::Requirement
44
45
  requirements:
45
46
  - - ">="
46
47
  - !ruby/object:Gem::Version
47
48
  version: '0'
48
49
  requirements: []
49
- rubygems_version: 3.1.4
50
- signing_key:
50
+ rubygems_version: 3.5.16
51
+ signing_key:
51
52
  specification_version: 4
52
53
  summary: A simple way to execute Javascript in a Ruby context via Node
53
54
  test_files: []