Skip to content

Commit

Permalink
feat: Ship pre-built binaries and improve caching
Browse files Browse the repository at this point in the history
This commit introduces pre-built binaries for different platforms and architectures, improving the installation experience.

- Removes `.env` file as it's not needed
- Updates `package.json`
  • Loading branch information
suenot committed Jan 31, 2025
1 parent 242edf9 commit 83b82ed
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 12 deletions.
5 changes: 0 additions & 5 deletions .env

This file was deleted.

8 changes: 8 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ jobs:
toolchain: stable
target: x86_64-unknown-linux-gnu
override: true
- name: Cache dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: linux-x86_64-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
uses: actions-rs/cargo@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "aicommit"
version = "0.1.83"
version = "0.1.84"
edition = "2021"
authors = ["Eugen Soloviov <[email protected]>"]
description = "A CLI tool that generates concise and descriptive git commit messages using LLMs"
Expand Down
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ const path = require('path');
const os = require('os');
const fs = require('fs');

const { platform, arch } = process;
const { chmodSync, renameSync, existsSync } = require('fs');
const { join } = require('path');

const binaryName = `aicommit-${platform}-${arch}`;
const binDir = join(__dirname, 'bin');

if (existsSync(join(binDir, binaryName))) {
renameSync(join(binDir, binaryName), join(binDir, 'aicommit'));
chmodSync(join(binDir, 'aicommit'), '755');
} else {
console.warn(`Binary for ${binaryName} not found, using JS fallback`);
}

// Get the binary name based on the platform and architecture
function getBinaryName() {
const platform = os.platform();
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Eugen Soloviov",
"bin": {
"aicommit": "./index.js"
"aicommit": "./bin/aicommit"
},
"bugs": {
"url": "https://github.com/suenot/aicommit/issues"
Expand All @@ -13,7 +13,8 @@
},
"files": [
"index.js",
"bin/*"
"bin/*",
"scripts/*"
],
"homepage": "https://github.com/suenot/aicommit#readme",
"keywords": [
Expand All @@ -33,8 +34,7 @@
"url": "git+https://github.com/suenot/aicommit.git"
},
"scripts": {
"postinstall": "node -e \"process.exit(0)\"",
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.1.83"
"version": "0.1.84"
}
6 changes: 6 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ chmod +x aicommit
sudo mv aicommit /usr/local/bin/
```

#### Linux
```bash
curl -L https://github.com/suenot/aicommit/releases/latest/download/aicommit-linux-x86_64 -o ~/.local/bin/aicommit
chmod +x ~/.local/bin/aicommit
```

#### Windows:
1. Download the ZIP file for your architecture
2. Extract the executable
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.83
0.1.84

0 comments on commit 83b82ed

Please sign in to comment.