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
8 changes: 4 additions & 4 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
cache-to: |
type=gha,mode=max
type=registry,ref=${{ env.DOCKER_NAMESPACE }}/peerbot-gateway:buildcache,mode=max
platforms: linux/amd64
platforms: linux/amd64,linux/arm64

- name: Extract metadata for Worker
id: meta-worker
Expand All @@ -106,7 +106,7 @@ jobs:
cache-to: |
type=gha,mode=max
type=registry,ref=${{ env.DOCKER_NAMESPACE }}/peerbot-worker:buildcache,mode=max
platforms: linux/amd64
platforms: linux/amd64,linux/arm64

- name: Extract metadata for Worker Base
id: meta-worker-base
Expand All @@ -117,7 +117,7 @@ jobs:
type=sha,prefix={{branch}}-
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ steps.tag.outputs.tag }}
type=raw,value=${{ steps.tag.outputs.version }},enable=${{ steps.tag.outputs.version != '' && (github.event_name == 'release' || github.event_name == 'repository_dispatch') }}
type=raw,value=${{ steps.tag.outputs.version }},enable=${{ steps.tag.outputs.version != ''' }}

- name: Build and push Worker Base (for CLI)
uses: docker/build-push-action@v5
Expand All @@ -132,7 +132,7 @@ jobs:
cache-to: |
type=gha,mode=max
type=registry,ref=${{ env.DOCKER_NAMESPACE }}/peerbot-worker-base:buildcache,mode=max
platforms: linux/amd64
platforms: linux/amd64,linux/arm64

- name: Trigger deployment
if: success() && github.ref == 'refs/heads/main'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ permissions:
jobs:
release-please:
runs-on: ubuntu-latest
environment: production
steps:
- uses: googleapis/release-please-action@v4
id: release
Expand Down Expand Up @@ -51,7 +52,7 @@ jobs:
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm whoami

- name: Publish @peerbot/cli to NPM
- name: Publish create-peerbot to NPM
if: ${{ steps.release.outputs.release_created }}
working-directory: packages/cli
run: npm publish --access public
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

```bash
# Create a new bot (interactive setup)
npx peerbot init my-slack-bot
npm create peerbot my-slack-bot

# Start the bot
cd my-slack-bot
Expand Down Expand Up @@ -105,7 +105,7 @@ make dev
## Published Packages

**NPM:**
- [`@peerbot/cli`](https://www.npmjs.com/package/@peerbot/cli) - Deployment CLI
- [`create-peerbot`](https://www.npmjs.com/package/create-peerbot) - Deployment CLI
- [`@peerbot/worker`](https://www.npmjs.com/package/@peerbot/worker) - Worker runtime

**Docker Hub:**
Expand Down
2 changes: 1 addition & 1 deletion examples/my-peerbot/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# my-peerbot

Peerbot instance created with `@peerbot/cli` v0.1.0
Peerbot instance created with `create-peerbot` v0.1.0

## Quick Start

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@peerbot/cli",
"name": "create-peerbot",
"version": "1.0.6",
"workspaces": [
"packages/cli",
Expand Down
24 changes: 16 additions & 8 deletions packages/cli/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @peerbot/cli
# create-peerbot

CLI tool for initializing Peerbot projects with Docker Compose.

Expand All @@ -7,11 +7,19 @@ CLI tool for initializing Peerbot projects with Docker Compose.
### Standalone

```bash
npm install -g @peerbot/cli
npm install -g create-peerbot

mkdir my-peerbot
cd my-peerbot
peerbot init
npm create peerbot my-peerbot
docker compose up -d
```

### npx/npm create (Recommended)

```bash
npm create peerbot my-peerbot
cd my-peerbot
docker compose up -d
```

Expand Down Expand Up @@ -83,7 +91,7 @@ See [Worker Package Documentation](../worker/docs/custom-base-image.md) for deta

## Commands

### `peerbot init`
### `create-peerbot`

Initialize a new Peerbot project in the current directory.

Expand All @@ -103,7 +111,7 @@ Initialize a new Peerbot project in the current directory.

## Usage

After running `peerbot init`:
After running `npm create peerbot`:

```bash
# Start services
Expand Down Expand Up @@ -166,7 +174,7 @@ CMD ["peerbot-worker"]
# 1. Create project
mkdir my-bot
cd my-bot
peerbot init
npm create peerbot

# 2. Choose worker mode during init
# - Base image (recommended)
Expand Down Expand Up @@ -228,7 +236,7 @@ docker pull buremba/peerbot-worker:0.1.0
**NPM Registry:**
```bash
# CLI tool
npm install -g @peerbot/cli@0.1.0
npm install -g create-peerbot@0.1.0

# Worker runtime (for custom base images)
npm install -g @peerbot/worker@0.1.0
Expand All @@ -241,7 +249,7 @@ User creates project
mkdir my-bot && cd my-bot
peerbot init
npm create peerbot
Choose: Base image or Package?
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@peerbot/cli",
"name": "create-peerbot",
"version": "0.1.0",
"description": "CLI for deploying and managing Peerbot across multiple platforms",
"type": "module",
"main": "dist/index.js",
"bin": {
"peerbot": "./bin/peerbot.js"
"create-peerbot": "./bin/create-peerbot.js"
},
Comment on lines 1 to 9

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Provide an actual CLI executable for the published package

The package metadata still advertises a binary at ./bin/create-peerbot.js, but the repository no longer contains a bin directory or that file. After publishing, npx create-peerbot will fail with a "file not found" error because Node cannot locate the executable. Point the bin entry at a real built file (e.g. dist/index.js) or reintroduce the missing script before publishing.

Useful? React with 👍 / 👎.

"scripts": {
"build": "tsc && node -e \"const fs=require('node:fs');const src='src/templates';const dest='dist/templates';if(fs.existsSync(src)){fs.rmSync(dest,{recursive:true,force:true});fs.cpSync(src,dest,{recursive:true});}\"",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/init.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { join } from "node:path";
import { readFile, access, writeFile, mkdir } from "node:fs/promises";
import { constants } from "node:fs";
import { randomBytes } from "node:crypto";
import { constants } from "node:fs";
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import chalk from "chalk";
import inquirer from "inquirer";
import ora from "ora";
Expand Down
Loading