From 0d59e30e7088620060bc021dc6ba2e8a5650a2ae Mon Sep 17 00:00:00 2001 From: Daniel Tschinder <231804+danez@users.noreply.github.com> Date: Thu, 23 Jun 2022 20:14:21 +0200 Subject: [PATCH] feat: Rename package to binary-info and fix release (#15) Release-As: 1.0.0 --- .github/workflows/release-please.yml | 6 +++--- Cargo.toml | 6 +++--- README.md | 24 ++++++++++-------------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index ead8edc..b243ed0 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -17,7 +17,7 @@ jobs: with: token: ${{ steps.get-token.outputs.token }} release-type: node - package-name: "@netlify/@netlify/zip-it-and-ship-it" + package-name: "@netlify/binary-info" - uses: actions/checkout@v3 if: ${{ steps.release.outputs.release_created }} - run: @@ -28,9 +28,9 @@ jobs: node-version: "*" registry-url: "https://registry.npmjs.org" if: ${{ steps.release.outputs.release_created }} - - run: wasm-pack build --target nodejs --release + - run: wasm-pack build --target nodejs --release --scope=netlify if: ${{ steps.release.outputs.release_created }} - - run: wasm-pack publish + - run: wasm-pack publish --access public if: ${{ steps.release.outputs.release_created }} env: NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/Cargo.toml b/Cargo.toml index f9443f5..6ace8f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "elf-cam" +name = "binary-info" version = "0.1.1" authors = ["David Calavera "] edition = "2018" -repository = "https://github.com/netlify/elf-cam" +repository = "https://github.com/netlify/binary-info" license = "Apache 2" -description = "elf-cam is a WebAssembly(WASM) module to extract very specific information from binary files built for Linux, also known as ELF files." +description = "binary-info is a WebAssembly(WASM) module to extract very specific information from binary files." [lib] crate-type = ["cdylib", "rlib"] diff --git a/README.md b/README.md index ac0c494..f0f4935 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,23 @@ ## Introduction -elf-cam is a WebAssembly(WASM) module to extract very specific information from binary files built for Linux, also known as ELF files. +@netlify/binary-info is a WebAssembly(WASM) module to extract very specific +information from binary files. -It's used by other Netlify projects to detect Go and Rust binaries built for Netlify Functions. +It's used by other Netlify projects to detect Go and Rust binaries built for +Netlify Functions and its architecture and platform . ## Usage ```js import { readFile } = require("fs"); -import * as elf from "elf-cam"; +import { detect, Runtime }from "@netlify/binary-info"; const buffer = await readFile(path); try { - const runtime = elf.detect(buffer); - switch (runtime) { - case elf.Runtime.Go: console.log("Go binary file"); break; - case elf.Runtime.Rust: console.log("Rust binary file"); break; + const info = elf.detect(buffer); + switch (info.runtime) { + case Runtime.Go: console.log("Go binary file"); break; + case Runtime.Rust: console.log("Rust binary file"); break; default: console.log("Unknown binary file"); } } catch (error) { @@ -28,11 +30,5 @@ try { ### 🛠️ Build with `wasm-pack build` ``` -wasm-pack build --target nodejs --release -``` - -### 🎁 Publish to NPM with `wasm-pack publish` - -``` -wasm-pack publish +wasm-pack build --target nodejs --release --scope=netlify ```