Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
lint:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun run check
22 changes: 22 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Publish

on:
push:
tags:
- "v*"

jobs:
publish:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- run: bun install
- run: bun run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
{
"name": "macctl",
"version": "0.1.0",
"description": "macOS CLI for controlling system settings (volume, screen, etc.) via AppleScript",
"module": "src/index.ts",
"type": "module",
"bin": {
"macctl": "./src/index.ts"
"macctl": "./dist/index.js"
},
"files": [
"dist"
],
"scripts": {
"dev": "bun run src/index.ts",
"build": "bun build ./src/index.ts --target bun --outdir ./dist",
"start": "bun run ./dist/index.js",
"lint": "biome lint src package.json tsconfig.json",
"format": "biome format --write src package.json tsconfig.json",
"check": "biome check src package.json tsconfig.json",
"check:fix": "biome check --write src package.json tsconfig.json"
"check:fix": "biome check --write src package.json tsconfig.json",
"prepublishOnly": "bun run build"
},
"private": true,
"license": "MIT",
"devDependencies": {
"@biomejs/biome": "^2.4.8",
"@types/bun": "latest"
Expand Down
3 changes: 2 additions & 1 deletion src/commands/volume.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
setMute,
setVolume,
toggleMute,
type VolumeState,
} from "../lib/volume";

function ensurePercent(value: number, field = "value"): number {
Expand Down Expand Up @@ -93,7 +94,7 @@ export function createVolumeCommand() {
.description("Mute controls")
.argument("<state>", "on | off | toggle")
.action((state: string) => {
let result;
let result: VolumeState;

if (state === "on") {
result = setMute(true);
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bun

import { Command } from "commander";
import { createVolumeCommand } from "./commands/volume";
import { createScreenCommand } from "./commands/screen";
import { createVolumeCommand } from "./commands/volume";

const program = new Command();

Expand Down
Loading