Skip to content

Commit

Permalink
Fix issue with detecting if file is binary. Fix build issue for Linx
Browse files Browse the repository at this point in the history
  • Loading branch information
TamimiGitHub committed Oct 1, 2024
1 parent 449a9da commit df6332c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 42 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,16 @@ jobs:
zip -qq -r stm-linux-v${{ steps.package-version.outputs.current-version}}.zip . -i stm-linux
zip -qq -r stm-alpine-v${{ steps.package-version.outputs.current-version}}.zip . -i stm-alpine
zip -qq -r stm-win-v${{ steps.package-version.outputs.current-version}}.zip . -i stm-win.exe
rm stm-macos stm-linux stm-alpine stm-win.exe
cd ..
- name: Publish artifacts to github
uses: softprops/action-gh-release@v1
with:
files: release/*
files: |
release/stm-macos-v${{ steps.package-version.outputs.current-version}}.zip
release/stm-linux-v${{ steps.package-version.outputs.current-version}}.zip
release/stm-alpine-v${{ steps.package-version.outputs.current-version}}.zip
release/stm-win-v${{ steps.package-version.outputs.current-version}}.zip
- name: Update Homebrew
run: ./scripts/update_homebrew.sh ${{ steps.package-version.outputs.current-version}}
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solace-community/stm",
"version": "0.0.56",
"version": "0.0.57",
"description": "Solace Try-Me Command Line Tool",
"repository": {
"type": "git",
Expand Down Expand Up @@ -44,7 +44,6 @@
"express": "^4.18.2",
"form-data": "^4.0.0",
"hexdump-nodejs": "^0.1.0",
"istextorbinary": "^9.5.0",
"http": "^0.0.1-security",
"json-schema-library": "^10.0.0-rc1",
"node-localstorage": "^3.0.5",
Expand Down
15 changes: 12 additions & 3 deletions src/lib/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ import { getDefaultMessage, delay } from '../utils/defaults';
import { displayHelpExamplesForPublish } from '../utils/examples';
import { fileExists, saveOrUpdateCommandSettings } from '../utils/config';
import { StdinRead } from '../utils/stdinread'
const { isText, isBinary, getEncoding } = require('istextorbinary')

const isBinaryFile = (filePath: string): boolean => {
const fileBuffer = fs.readFileSync(filePath);
for (let i = 0; i < 24; i++) {
if (fileBuffer[i] === 0) {
return true;
}
}
return false;
};

const publish = async (
options: MessageClientOptions,
Expand Down Expand Up @@ -50,13 +59,13 @@ const publish = async (
}

try {
const binary = isBinary(file);
if (binary) {
if (isBinaryFile(file)) {
message = fs.readFileSync(file, 'binary');
payloadType = 'bytes';
} else {
message = fs.readFileSync(file, 'utf8');
}

} catch (error: any) {
Logger.logDetailedError('read file failed', error.toString())
if (error.cause?.message) Logger.logDetailedError(``, `${error.cause?.message}`)
Expand Down
35 changes: 0 additions & 35 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,6 @@ base64-js@^1.3.1:
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==

binaryextensions@^6.11.0:
version "6.11.0"
resolved "https://registry.npmjs.org/binaryextensions/-/binaryextensions-6.11.0.tgz"
integrity sha512-sXnYK/Ij80TO3lcqZVV2YgfKN5QjUWIRk/XSm2J/4bd/lPko3lvk0O4ZppH6m+6hB2/GTu+ptNwVFe1xh+QLQw==
dependencies:
editions "^6.21.0"

bl@^4.0.3:
version "4.1.0"
resolved "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz"
Expand Down Expand Up @@ -965,13 +958,6 @@ ebnf@^1.9.1:
resolved "https://registry.npmjs.org/ebnf/-/ebnf-1.9.1.tgz"
integrity sha512-uW2UKSsuty9ANJ3YByIQE4ANkD8nqUPO7r6Fwcc1ADKPe9FRdcPpMl3VEput4JSvKBJ4J86npIC2MLP0pYkCuw==

editions@^6.21.0:
version "6.21.0"
resolved "https://registry.npmjs.org/editions/-/editions-6.21.0.tgz"
integrity sha512-ofkXJtn7z0urokN62DI3SBo/5xAtF0rR7tn+S/bSYV79Ka8pTajIIl+fFQ1q88DQEImymmo97M4azY3WX/nUdg==
dependencies:
version-range "^4.13.0"

ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz"
Expand Down Expand Up @@ -1676,15 +1662,6 @@ isarray@~1.0.0:
resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==

istextorbinary@^9.5.0:
version "9.5.0"
resolved "https://registry.npmjs.org/istextorbinary/-/istextorbinary-9.5.0.tgz"
integrity sha512-5mbUj3SiZXCuRf9fT3ibzbSSEWiy63gFfksmGfdOzujPjW3k+z8WvIBxcJHBoQNlaZaiyB25deviif2+osLmLw==
dependencies:
binaryextensions "^6.11.0"
editions "^6.21.0"
textextensions "^6.11.0"

js-yaml@^4.1.0:
version "4.1.0"
resolved "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz"
Expand Down Expand Up @@ -2614,13 +2591,6 @@ tar-stream@^2.1.4:
inherits "^2.0.3"
readable-stream "^3.1.1"

textextensions@^6.11.0:
version "6.11.0"
resolved "https://registry.npmjs.org/textextensions/-/textextensions-6.11.0.tgz"
integrity sha512-tXJwSr9355kFJI3lbCkPpUH5cP8/M0GGy2xLO34aZCjMXBaK3SoPnZwr/oWmo1FdCnELcs4npdCIOFtq9W3ruQ==
dependencies:
editions "^6.21.0"

to-fast-properties@^2.0.0:
version "2.0.0"
resolved "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz"
Expand Down Expand Up @@ -2816,11 +2786,6 @@ vary@~1.1.2:
resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz"
integrity sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==

version-range@^4.13.0:
version "4.14.0"
resolved "https://registry.npmjs.org/version-range/-/version-range-4.14.0.tgz"
integrity sha512-gjb0ARm9qlcBAonU4zPwkl9ecKkas+tC2CGwFfptTCWWIVTWY1YUbT2zZKsOAF1jR/tNxxyLwwG0cb42XlYcTg==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
Expand Down

0 comments on commit df6332c

Please sign in to comment.