From f29a2a1e2bbffab7b6260674a4d4f5f57390758b Mon Sep 17 00:00:00 2001 From: michalsikora Date: Mon, 23 Mar 2026 17:39:28 +0100 Subject: [PATCH] Prepare distrubuyion and build workflow --- .github/workflows/ci.yml | 51 ++++++++++++++++++++++++ .github/workflows/release.yml | 36 +++++++++++++++++ .gitlab-ci.yml | 51 ------------------------ packages/cli/package.json | 9 ++++- packages/cli/src/commands/claude.test.ts | 4 +- packages/cli/src/commands/create.ts | 2 +- packages/core/package.json | 7 +++- packages/core/src/TmuxControlClient.ts | 8 ++-- packages/web/package.json | 9 ++++- 9 files changed, 114 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .gitlab-ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..83ab2d4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run lint + - run: npm run format:check + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run test:coverage + - uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage + path: coverage/ + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + - run: npm ci + - run: npm run build + - uses: actions/upload-artifact@v4 + with: + name: dist + path: packages/*/dist/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5f84fa4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,36 @@ +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + registry-url: https://registry.npmjs.org + + - run: npm ci + - run: npm run lint + - run: npm run format:check + - run: npm run test + - run: npm run build + + - name: Publish to npm + run: npm publish --workspaces --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 509a574..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,51 +0,0 @@ -stages: - - lint - - test - - build - -default: - image: node:20-alpine - -cache: - key: ${CI_COMMIT_REF_SLUG} - paths: - - node_modules/ - - packages/*/node_modules/ - -install: - stage: .pre - script: - - npm ci - artifacts: - paths: - - node_modules/ - - packages/*/node_modules/ - -lint: - stage: lint - needs: [install] - script: - - npm run lint - - npm run format:check - -test: - stage: test - needs: [install] - script: - - npm run test - coverage: '/All files[^|]*\|[^|]*\s+([\d\.]+)/' - artifacts: - when: always - reports: - coverage_report: - coverage_format: cobertura - path: coverage/cobertura-coverage.xml - -build: - stage: build - needs: [install] - script: - - npm run build - artifacts: - paths: - - packages/*/dist/ diff --git a/packages/cli/package.json b/packages/cli/package.json index fda1719..17c3807 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,19 +1,24 @@ { "name": "@clux/cli", "version": "0.1.0", - "private": true, "license": "MIT", "main": "dist/index.js", "bin": { "clux": "dist/index.js" }, + "files": ["dist"], + "repository": { + "type": "git", + "url": "https://github.com/michalsikora/clux.git", + "directory": "packages/cli" + }, "scripts": { "build": "tsc", "watch": "tsc --watch", "start": "node dist/index.js" }, "dependencies": { - "@clux/core": "*", + "@clux/core": "0.1.0", "commander": "^13.0.0", "chalk": "^4.1.2", "cli-table3": "^0.6.5", diff --git a/packages/cli/src/commands/claude.test.ts b/packages/cli/src/commands/claude.test.ts index 407d0c9..54caf11 100644 --- a/packages/cli/src/commands/claude.test.ts +++ b/packages/cli/src/commands/claude.test.ts @@ -33,7 +33,9 @@ describe('buildSessionName', () => { }); it('generates name from path when no name provided', () => { - expect(buildSessionName(undefined, '/home/user/projects/clux')).toBe('claude_h-u-projects-clux'); + expect(buildSessionName(undefined, '/home/user/projects/clux')).toBe( + 'claude_h-u-projects-clux', + ); }); it('generates name for short paths', () => { diff --git a/packages/cli/src/commands/create.ts b/packages/cli/src/commands/create.ts index 343e2cc..eeb1934 100644 --- a/packages/cli/src/commands/create.ts +++ b/packages/cli/src/commands/create.ts @@ -10,7 +10,7 @@ export function registerCreateCommand(program: Command, manager: TmuxSessionMana .description('Create a new tmux session') .option('-p, --path ', 'Project working directory', process.cwd()) .option('-c, --command ', 'Command to run in main pane (e.g. "claude")') -.option('-l, --layout ', 'Pane layout', 'tiled') + .option('-l, --layout ', 'Pane layout', 'tiled') .option('-d, --description ', 'Session description') .option('-t, --tags ', 'Comma-separated tags') .action(async (name: string, opts) => { diff --git a/packages/core/package.json b/packages/core/package.json index 954b5d4..46e1504 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,10 +1,15 @@ { "name": "@clux/core", "version": "0.1.0", - "private": true, "license": "MIT", "main": "dist/index.js", "types": "dist/index.d.ts", + "files": ["dist"], + "repository": { + "type": "git", + "url": "https://github.com/michalsikora/clux.git", + "directory": "packages/core" + }, "scripts": { "build": "tsc", "watch": "tsc --watch" diff --git a/packages/core/src/TmuxControlClient.ts b/packages/core/src/TmuxControlClient.ts index ecc16bd..46c8ea1 100644 --- a/packages/core/src/TmuxControlClient.ts +++ b/packages/core/src/TmuxControlClient.ts @@ -51,11 +51,9 @@ export class TmuxControlClient extends EventEmitter { await this.refreshPaneMap(); return new Promise((resolve, reject) => { - this.proc = spawn( - 'tmux', - ['-C', 'attach-session', '-t', this.sessionName, '-r'], - { stdio: ['pipe', 'pipe', 'pipe'] }, - ); + this.proc = spawn('tmux', ['-C', 'attach-session', '-t', this.sessionName, '-r'], { + stdio: ['pipe', 'pipe', 'pipe'], + }); let settled = false; diff --git a/packages/web/package.json b/packages/web/package.json index 6d7dd28..8ea8629 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,16 +1,21 @@ { "name": "@clux/web", "version": "0.1.0", - "private": true, "license": "MIT", "main": "dist/server.js", + "files": ["dist"], + "repository": { + "type": "git", + "url": "https://github.com/michalsikora/clux.git", + "directory": "packages/web" + }, "scripts": { "build": "tsc", "dev": "node dist/server.js", "watch": "tsc --watch" }, "dependencies": { - "@clux/core": "*", + "@clux/core": "0.1.0", "express": "^4.21.0", "ws": "^8.18.0" },