diff --git a/.changeset/kind-fans-jump.md b/.changeset/kind-fans-jump.md new file mode 100644 index 0000000..b096db1 --- /dev/null +++ b/.changeset/kind-fans-jump.md @@ -0,0 +1,7 @@ +--- +"create-db": patch +"create-pg": patch +"create-postgres": patch +--- + +docs: add READMEs for each repo diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23f0515..9944ae3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/create-db/README.md b/create-db/README.md index 699ba80..979b8ba 100644 --- a/create-db/README.md +++ b/create-db/README.md @@ -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 @@ -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: diff --git a/create-pg/.gitignore b/create-pg/.gitignore index 9a9c9bc..941d536 100644 --- a/create-pg/.gitignore +++ b/create-pg/.gitignore @@ -1,4 +1,3 @@ .env node_modules -package-lock.json -README.md \ No newline at end of file +package-lock.json \ No newline at end of file diff --git a/create-pg/README.md b/create-pg/README.md new file mode 100644 index 0000000..92b271e --- /dev/null +++ b/create-pg/README.md @@ -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 +``` diff --git a/create-postgres/.gitignore b/create-postgres/.gitignore index 9a9c9bc..941d536 100644 --- a/create-postgres/.gitignore +++ b/create-postgres/.gitignore @@ -1,4 +1,3 @@ .env node_modules -package-lock.json -README.md \ No newline at end of file +package-lock.json \ No newline at end of file diff --git a/create-postgres/README.md b/create-postgres/README.md new file mode 100644 index 0000000..1af3369 --- /dev/null +++ b/create-postgres/README.md @@ -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 +```