#npm-package #package #release #generator #nodejs

bin+lib rustwrap

一个帮助包装二进制发布以方便分发的工具

6 个稳定版本

1.0.5 2023年3月7日
1.0.4 2022年12月15日
1.0.0 2022年12月12日

#15 in #npm-package

39 每月下载次数

Apache-2.0

36KB
898


Rustwrap

Rustwrap 是一个帮助包装二进制发布以方便分发的工具。目前支持

  • npm - npm install -g your-tool 将使你的二进制 your-tool 通过 CLI 可用。 rustwrap 创建必要的二进制包和带有 Node.js 模块的根包,该模块将运行委托给平台特定的 bin。
  • Homebrew - 创建一个配方并将其保存或发布到你的 tap。

下载

对于 macOS

brew tap rusty-ferris-club/tap && brew install rustwrap

通过 cargo

cargo install rustwrap

cargo-binstall 安装二进制文件(节省编译时间)

cargo binstall rustwrap

否则,从 发布 中获取一个版本并运行 rustwrap --help

入门

构建单个 rustwrap.yaml,并描述每个平台上的发布内容及其获取方式,以及你的供应商块。

当需要替换实际版本时,请使用 __VERSION__

targets:
  - platform: win32
    arch: x64
    url_template: https://github.com/rusty-ferris-club/recon/releases/download/v__VERSION__/recon-x86_64-windows.zip
  - platform: linux
    arch: x64
    url_template: https://github.com/rusty-ferris-club/recon/releases/download/v__VERSION__/recon-x86_64-linux.tar.xz
  - platform: darwin
    arch: x64
    url_template: https://github.com/rusty-ferris-club/recon/releases/download/v__VERSION__/recon-x86_64-macos.tar.xz
  - platform: darwin
    arch: x64
    url_template: https://github.com/rusty-ferris-club/recon/releases/download/v__VERSION__/recon-aarch64-macos.tar.xz

# provider: npm
# both recon-root.json and recon-sub.json paths are relative to working folder
npm:
  publish: false # dont publish to npm, just generate the packages on disk
  org: "@recontools"
  name: recon
  root: 
    name: recon-tool
    manifest: rustwrap/fixtures/config/recon-root.json
    readme: rustwrap/fixtures/config/README.md
  sub: 
    manifest: rustwrap/fixtures/config/recon-sub.json
    readme: rustwrap/fixtures/config/README.md

# provider: homebrew
brew:
  name: recon
  publish: true # push an update commit to the tap repo
  tap: jondot/homebrew-tap
  recipe_fname: recon.rb
  recipe_template: |
    class Recon < Formula
      desc "recon"
      homepage "http://www.example.com"
      version "__VERSION__"
      url "__URL__"
      sha256 "__SHA__"

      def install
        bin.install "recon"
      end
    end

在当前工作目录中,使用你的 rustwrap.yaml 和相关文件,运行

$ rustwrap --tag 0.6.0

--tag 值替换 __VERSION__ 值。

关于

此工具部分灵感来源于为在 npm 上发布 Rome 而构建的 Rome 工具链和基础设施

我给它添加了一些通用功能(独立下载发布版本)和调整,并扩展了 Homebrew 提供商,这是我一直需要的东西。

  • 它可以用于任何语言生成的自包含二进制文件,而不仅仅是 Rust
  • 接受更多提供商的 PR

贡献

我们接受 PR。请随意 提交 PR

对所有 贡献者 - 你们让这一切成为可能,谢谢!

许可

版权所有 (c) 2022 @jondot。有关详细信息,请参阅 LICENSE


lib.rs:

Rustwrap 是一个帮助包装二进制发布以方便分发的工具。目前支持

  • npm - npm install -g your-tool 将使你的二进制 your-tool 通过 CLI 可用。 rustwrap 创建必要的二进制包和带有 Node.js 模块的根包,该模块将运行委托给平台特定的 bin。
  • Homebrew - 创建一个配方并将其保存或发布到你的 tap。

依赖关系

~20–34MB
~542K SLoC