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
105 changes: 105 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# GitHub Actions workflow for publishing create-tbk-app to npm
#
# SETUP INSTRUCTIONS:
# 1. Go to your repository Settings > Secrets and variables > Actions
# 2. Click "New repository secret"
# 3. Name: NPM_TOKEN
# 4. Value: Your npm access token (create at https://www.npmjs.com/settings/{username}/tokens)
# 5. Select "Automation" token type for CI/CD use
# 6. Save the secret
#
# For more info: https://docs.github.com/en/actions/security-guides/encrypted-secrets

name: Publish create-tbk-app to npm

on:
workflow_dispatch:
inputs:
version_type:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Setup pnpm
uses: pnpm/action-setup@v4

Check warning on line 46 in .github/workflows/publish-package.yml

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.github/workflows/publish-package.yml#L46

An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release.
with:
version: 9.9.0

- name: Configure Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Bump version in package.json
id: bump-version
working-directory: packages/create-tbk-app
run: |
# Get current version
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version: $CURRENT_VERSION"

# Bump version based on input
npm version ${{ inputs.version_type }} --no-git-tag-version

# Get new version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "New version: $NEW_VERSION"

# Set output for subsequent steps
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "tag=create-tbk-app-v$NEW_VERSION" >> $GITHUB_OUTPUT

- name: Commit version bump
run: |
git add packages/create-tbk-app/package.json
git commit -m "chore(create-tbk-app): bump version to ${{ steps.bump-version.outputs.version }}"
git push origin HEAD:${{ github.ref_name }}

- name: Build package
working-directory: packages/create-tbk-app
run: pnpm build

- name: Publish to npm
working-directory: packages/create-tbk-app
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
pnpm publish --access public
rm .npmrc

- name: Create git tag
run: |
git tag ${{ steps.bump-version.outputs.tag }}
git push origin ${{ steps.bump-version.outputs.tag }}

- name: Summary
run: |
echo "✅ Successfully published create-tbk-app@${{ steps.bump-version.outputs.version }} to npm"
echo "📦 Tagged as ${{ steps.bump-version.outputs.tag }}"

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,6 @@ Api.ts
#Ignore cursor AI rules
.cursor/rules/codacy.mdc

/docs
/docs

.codacy
32 changes: 23 additions & 9 deletions packages/create-tbk-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ CLI tool to scaffold TypeScript Backend Toolkit projects with customizable featu
## Quick Start

```bash
# Interactive mode (recommended)
# Guided prompts (recommended)
npx create-tbk-app my-backend-api

# With preset
npx create-tbk-app my-api --preset=standard
# Skip prompts and use defaults from flags
npx create-tbk-app my-api -y --preset=standard

# Custom configuration via flags
# Provide defaults and confirm step-by-step
npx create-tbk-app my-api --auth=jwt --cache=redis --email=resend
```

Expand Down Expand Up @@ -66,15 +66,22 @@ create-tbk-app [project-name] [options]
Options:
--preset <type> Preset configuration (minimal, standard, full, custom)
--auth <type> Authentication (none, jwt, jwt-sessions)
--session-driver <driver> Session storage driver (mongo, redis)
--cache <provider> Cache provider (none, memory, redis)
--storage <provider> Storage provider (none, local, s3, r2)
--email <provider> Email provider (none, resend, mailgun, smtp)
--queues Enable background jobs
--realtime Enable real-time features
--admin Include admin panel
--queues / --no-queues Toggle background jobs
--queue-dashboard Include queue monitoring dashboard (with queues)
--no-queue-dashboard Disable queue monitoring dashboard
--realtime / --no-realtime Toggle real-time features
--admin / --no-admin Toggle admin panel
--google-oauth Enable Google OAuth login (with auth)
--observability <level> Observability level (basic, full)
--pm <manager> Package manager (pnpm, npm, yarn)
--skip-git Skip git initialization
--skip-install Skip dependency installation
-y, --yes Skip prompts and accept defaults
--force Overwrite existing directory without prompting
-h, --help Display help
-V, --version Display version
```
Expand All @@ -93,6 +100,7 @@ You'll be prompted for:
3. Custom features (if preset is "custom")
4. Package manager preference
5. Git/install preferences
6. Final summary confirmation

### Non-Interactive Mode

Expand All @@ -102,7 +110,7 @@ You'll be prompted for:
npx create-tbk-app my-api --preset=minimal

# Standard with npm
npx create-tbk-app my-api --preset=standard --pm=npm
npx create-tbk-app my-api --preset=standard --pm=npm --skip-install --skip-git

# Full-featured
npx create-tbk-app my-api --preset=full
Expand All @@ -124,13 +132,19 @@ npx create-tbk-app my-api \
--storage=s3 \
--email=resend \
--realtime \
--admin
--admin \
--pm=pnpm \
--skip-install \
--skip-git
```

**Skip options:**
```bash
# Don't install dependencies or init git
npx create-tbk-app my-api --preset=standard --skip-install --skip-git

# Force overwrite and skip prompts
npx create-tbk-app my-api -y --preset=standard --pm=pnpm --force
```

## What Gets Generated
Expand Down
3 changes: 1 addition & 2 deletions packages/create-tbk-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,16 @@
},
"license": "MIT",
"dependencies": {
"@clack/prompts": "^0.7.0",
"chalk": "^5.3.0",
"commander": "^14.0.1",
"fs-extra": "^11.2.0",
"handlebars": "^4.7.8",
"inquirer": "^9.2.12",
"ora": "^8.0.1",
"validate-npm-package-name": "^5.0.0"
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^9.0.7",
"@types/node": "^18.11.18",
"@types/validate-npm-package-name": "^4.0.2",
"tsup": "^8.1.0",
Expand Down
Loading