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
7 changes: 7 additions & 0 deletions .changeset/kind-fans-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"create-db": patch
"create-pg": patch
"create-postgres": patch
---

docs: add READMEs for each repo
36 changes: 22 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,42 +36,50 @@ jobs:
- name: ❌ Disable pnpm git-checks
run: pnpm config set git-checks false

- name: 📄 Copy README to child CLIs
run: |
for pkg in create-pg create-postgres; do
cp create-db/README.md "$pkg/README.md"
done

- name: 🔑 Configure npm auth
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.CREATE_DB_TOKEN_NPM }}" > ~/.npmrc

# Always publish the packages, regardless of changesets
# Publish each CLI package using the version in package.json
- name: 🚀 Publish Each CLI Package
run: |
export CREATE_DB_WORKER_URL="${{ secrets.CREATE_DB_WORKER_URL }}"
export CLAIM_DB_WORKER_URL="${{ secrets.CLAIM_DB_WORKER_URL }}"

echo "Using CREATE_DB_WORKER_URL=$CREATE_DB_WORKER_URL"
echo "Using CLAIM_DB_WORKER_URL=$CLAIM_DB_WORKER_URL"
echo "Using CREATE_DB_WORKER_URL=${CREATE_DB_WORKER_URL}"
echo "Using CLAIM_DB_WORKER_URL=${CLAIM_DB_WORKER_URL}"

for pkg in $WORKSPACES; do
echo "Publishing $pkg to npm..."
cd "$pkg"
npm version patch --no-git-tag-version
pnpm publish --access public || echo "Publish failed for $pkg"
# pnpm publish --access public || echo "Publish failed for $pkg"
# First try to publish
if ! pnpm publish --access public; then
echo "Publish failed, trying to bump version and retry..."
npm version patch --no-git-tag-version
pnpm publish --access public || echo "Publish failed again for $pkg"
fi
cd - >/dev/null
done
env:
NODE_AUTH_TOKEN: ${{ secrets.CREATE_DB_TOKEN_NPM }}
CREATE_DB_WORKER_URL: ${{ secrets.CREATE_DB_WORKER_URL }}
CLAIM_DB_WORKER_URL: ${{ secrets.CLAIM_DB_WORKER_URL }}

- name: 🧹 Cleanup npm auth
run: rm -f ~/.npmrc

# Create a default changeset if none exist
- name: 📝 Ensure Changeset Exists
run: |
if [ -z "$(ls -A .changeset 2>/dev/null)" ]; then
echo "No changeset found. Creating a default one..."
pnpm changeset add --empty --message "chore(release): auto-generated changeset"
fi

# Finally, create a PR for version bump + changelogs
- name: 📝 Prepare Changesets PR
id: changesets
uses: changesets/action@v1
with:
version: pnpm changeset version
commit: "chore(release): version packages"
title: "chore(release): version packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions create-db/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create DB CLI

CLI tool for creating temporary Prisma Postgres databases.
CLI tool for provisioning a temporary Prisma Postgres databases.

## Usage

Expand Down Expand Up @@ -30,8 +30,8 @@ CREATE_DB_WORKER_URL="http://127.0.0.1:8787"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"

# PROD
# CREATE_DB_WORKER_URL="https://create-db-worker.raycast-0ef.workers.dev"
# CLAIM_DB_WORKER_URL="https://claim-db-worker.raycast-0ef.workers.dev"
# CLAIM_DB_WORKER_URL="https://create-db.prisma.io"
# CREATE_DB_WORKER_URL="https://create-db-temp.prisma.io"
```

If running both workers locally, use a different port for one and update the URL:
Expand Down
3 changes: 1 addition & 2 deletions create-pg/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.env
node_modules
package-lock.json
README.md
package-lock.json
50 changes: 50 additions & 0 deletions create-pg/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Create DB CLI

CLI tool for provisioning a temporary Prisma Postgres databases.

## Usage

```bash
npx create-pg # Default region (us-east-1)
npx create-pg --region eu-west-1 # Custom region
npx create-pg --i # Interactive region selection
```

## Key Files

- **Main Logic:** [`index.js`](index.js) - Argument parsing, API requests, and output
- **Configuration:** [`package.json`](package.json) - CLI entry point and dependencies
- **Environment:** `.env` - Worker endpoints configuration

## Development

```bash
npm install
```

Create `.env` for local development:

```env
# LOCAL
CREATE_DB_WORKER_URL="http://127.0.0.1:8787"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"

# PROD
# CLAIM_DB_WORKER_URL="https://create-db.prisma.io"
# CREATE_DB_WORKER_URL="https://create-db-temp.prisma.io"
```

If running both workers locally, use a different port for one and update the URL:

```env
CREATE_DB_WORKER_URL="http://127.0.0.1:9999"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"
```

## Test Locally

```bash
npx create-pg
npx create-pg --region eu-west-1
npx create-pg --i
```
3 changes: 1 addition & 2 deletions create-postgres/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.env
node_modules
package-lock.json
README.md
package-lock.json
50 changes: 50 additions & 0 deletions create-postgres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Create DB CLI

CLI tool for provisioning a temporary Prisma Postgres databases.

## Usage

```bash
npx create-postgres # Default region (us-east-1)
npx create-postgres --region eu-west-1 # Custom region
npx create-postgres --i # Interactive region selection
```

## Key Files

- **Main Logic:** [`index.js`](index.js) - Argument parsing, API requests, and output
- **Configuration:** [`package.json`](package.json) - CLI entry point and dependencies
- **Environment:** `.env` - Worker endpoints configuration

## Development

```bash
npm install
```

Create `.env` for local development:

```env
# LOCAL
CREATE_DB_WORKER_URL="http://127.0.0.1:8787"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"

# PROD
# CLAIM_DB_WORKER_URL="https://create-db.prisma.io"
# CREATE_DB_WORKER_URL="https://create-db-temp.prisma.io"
```

If running both workers locally, use a different port for one and update the URL:

```env
CREATE_DB_WORKER_URL="http://127.0.0.1:9999"
CLAIM_DB_WORKER_URL="http://127.0.0.1:8787"
```

## Test Locally

```bash
npx create-postgres
npx create-postgres --region eu-west-1
npx create-postgres --i
```