From 2e4dba9e7362021a0d480f3ece9b55d22b7a1eda Mon Sep 17 00:00:00 2001 From: praboth-mbp Date: Sat, 3 Jan 2026 23:44:20 +0530 Subject: [PATCH 1/6] Add test workflow for GPR publishing fix --- .github/workflows/test-gh-publish.yml | 46 +++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/test-gh-publish.yml diff --git a/.github/workflows/test-gh-publish.yml b/.github/workflows/test-gh-publish.yml new file mode 100644 index 0000000..1088a6d --- /dev/null +++ b/.github/workflows/test-gh-publish.yml @@ -0,0 +1,46 @@ +name: Test GitHub Packages Publish + +on: + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + test-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + registry-url: "https://registry.npmjs.org" + + - name: Install dependencies + run: npm ci + + - name: Build package + run: npm run build + + - name: Publish to GitHub Packages (Test) + run: | + # Configure npm to use GitHub Packages registry with explicit auth + # Using project-level .npmrc to override any defaults + echo "@PrabothCharith:registry=https://npm.pkg.github.com" > .npmrc + echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc + + # Temporarily change the package name to the scoped version for GPR + npm pkg set name="@PrabothCharith/nxt-gen-cli" + + # Set a unique test version to avoid conflicts + # Using 0.0.0-test-[timestamp] + npm version 0.0.0-test-$(date +%s) --no-git-tag-version + + # Publish using the GITHUB_TOKEN + npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9ba300e23be660f0edf1b88dac5a081b3c9350be Mon Sep 17 00:00:00 2001 From: praboth-mbp Date: Sat, 3 Jan 2026 23:45:30 +0530 Subject: [PATCH 2/6] Update workflow to test GPR publish fix --- .github/workflows/auto-publish.yml | 74 +++++++----------------------- 1 file changed, 16 insertions(+), 58 deletions(-) diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml index 41ac634..fcfce72 100644 --- a/.github/workflows/auto-publish.yml +++ b/.github/workflows/auto-publish.yml @@ -1,30 +1,23 @@ name: Auto Publish on Main on: + workflow_dispatch: push: branches: - - main # Trigger on every successful merge to main + - development # Temporarily trigger on dev push for testing if needed permissions: + contents: read + packages: write id-token: write - contents: write # Required for pushing tags and creating releases - packages: write # Required for publishing to GitHub Packages jobs: - publish: + test-publish: runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v4 - - name: Get version from package.json - id: version - run: | - VERSION=$(node -p "require('./package.json').version") - echo "package_version=$VERSION" >> $GITHUB_OUTPUT - echo "📦 Publishing version $VERSION" - - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -37,55 +30,20 @@ jobs: - name: Build package run: npm run build - - name: Run Smoke Check - run: npm run test:smoke - - - name: Publish to npm - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Publish to GitHub Packages + - name: Publish to GitHub Packages (Test) run: | - # Configure npm to use GitHub Packages registry + # Configure npm to use GitHub Packages registry with explicit auth + # Using project-level .npmrc to override any defaults echo "@PrabothCharith:registry=https://npm.pkg.github.com" > .npmrc + echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc + # Temporarily change the package name to the scoped version for GPR npm pkg set name="@PrabothCharith/nxt-gen-cli" - # Publish using the GH_TOKEN + + # Set a unique test version to avoid conflicts + npm version 0.0.0-test-$(date +%s) --no-git-tag-version + + # Publish using the GITHUB_TOKEN npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} - - - name: Create Git Tag - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git tag -a "v${{ steps.version.outputs.package_version }}" -m "Release v${{ steps.version.outputs.package_version }}" || true - git push origin "v${{ steps.version.outputs.package_version }}" || true - - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 - with: - tag_name: v${{ steps.version.outputs.package_version }} - name: Release ${{ steps.version.outputs.package_version }} - body: | - ## Release v${{ steps.version.outputs.package_version }} - - ### Install - ```bash - npx nxt-gen-cli@${{ steps.version.outputs.package_version }} - ``` - - Or install globally: - ```bash - npm install -g nxt-gen-cli@${{ steps.version.outputs.package_version }} - ``` - - ### GitHub Packages - ```bash - npm install @PrabothCharith/nxt-gen-cli@${{ steps.version.outputs.package_version }} - ``` - draft: false - prerelease: false - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6943490fbc1898bef06e7eea287d40d1ee3695ba Mon Sep 17 00:00:00 2001 From: praboth-mbp Date: Sat, 3 Jan 2026 23:46:54 +0530 Subject: [PATCH 3/6] Fix GitHub Packages publishing authentication --- .github/workflows/auto-publish.yml | 73 ++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 15 deletions(-) diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml index fcfce72..b578553 100644 --- a/.github/workflows/auto-publish.yml +++ b/.github/workflows/auto-publish.yml @@ -1,23 +1,30 @@ name: Auto Publish on Main on: - workflow_dispatch: push: branches: - - development # Temporarily trigger on dev push for testing if needed + - main # Trigger on every successful merge to main permissions: - contents: read - packages: write id-token: write + contents: write # Required for pushing tags and creating releases + packages: write # Required for publishing to GitHub Packages jobs: - test-publish: + publish: runs-on: ubuntu-latest + steps: - name: Checkout repository uses: actions/checkout@v4 + - name: Get version from package.json + id: version + run: | + VERSION=$(node -p "require('./package.json').version") + echo "package_version=$VERSION" >> $GITHUB_OUTPUT + echo "📦 Publishing version $VERSION" + - name: Setup Node.js uses: actions/setup-node@v4 with: @@ -30,20 +37,56 @@ jobs: - name: Build package run: npm run build - - name: Publish to GitHub Packages (Test) + - name: Run Smoke Check + run: npm run test:smoke + + - name: Publish to npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish to GitHub Packages run: | - # Configure npm to use GitHub Packages registry with explicit auth - # Using project-level .npmrc to override any defaults + # Configure npm to use GitHub Packages registry echo "@PrabothCharith:registry=https://npm.pkg.github.com" > .npmrc echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc - # Temporarily change the package name to the scoped version for GPR npm pkg set name="@PrabothCharith/nxt-gen-cli" - - # Set a unique test version to avoid conflicts - npm version 0.0.0-test-$(date +%s) --no-git-tag-version - - # Publish using the GITHUB_TOKEN + # Publish using the GH_TOKEN npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }} + + - name: Create Git Tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "v${{ steps.version.outputs.package_version }}" -m "Release v${{ steps.version.outputs.package_version }}" || true + git push origin "v${{ steps.version.outputs.package_version }}" || true + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: v${{ steps.version.outputs.package_version }} + name: Release ${{ steps.version.outputs.package_version }} + body: | + ## Release v${{ steps.version.outputs.package_version }} + + ### Install + ```bash + npx nxt-gen-cli@${{ steps.version.outputs.package_version }} + ``` + + Or install globally: + ```bash + npm install -g nxt-gen-cli@${{ steps.version.outputs.package_version }} + ``` + + ### GitHub Packages + ```bash + npm install @PrabothCharith/nxt-gen-cli@${{ steps.version.outputs.package_version }} + ``` + draft: false + prerelease: false + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} From c72766682c4338dd13a306ccc666ce8f4c9d6536 Mon Sep 17 00:00:00 2001 From: praboth-mbp Date: Sat, 3 Jan 2026 23:54:21 +0530 Subject: [PATCH 4/6] ci: remove test GitHub Packages publish workflow --- .github/workflows/test-gh-publish.yml | 46 --------------------------- 1 file changed, 46 deletions(-) delete mode 100644 .github/workflows/test-gh-publish.yml diff --git a/.github/workflows/test-gh-publish.yml b/.github/workflows/test-gh-publish.yml deleted file mode 100644 index 1088a6d..0000000 --- a/.github/workflows/test-gh-publish.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Test GitHub Packages Publish - -on: - workflow_dispatch: - -permissions: - contents: read - packages: write - -jobs: - test-publish: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: "20" - registry-url: "https://registry.npmjs.org" - - - name: Install dependencies - run: npm ci - - - name: Build package - run: npm run build - - - name: Publish to GitHub Packages (Test) - run: | - # Configure npm to use GitHub Packages registry with explicit auth - # Using project-level .npmrc to override any defaults - echo "@PrabothCharith:registry=https://npm.pkg.github.com" > .npmrc - echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" >> .npmrc - - # Temporarily change the package name to the scoped version for GPR - npm pkg set name="@PrabothCharith/nxt-gen-cli" - - # Set a unique test version to avoid conflicts - # Using 0.0.0-test-[timestamp] - npm version 0.0.0-test-$(date +%s) --no-git-tag-version - - # Publish using the GITHUB_TOKEN - npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 39065d0f68fc7644d9c830e7247f9aeac717dc38 Mon Sep 17 00:00:00 2001 From: praboth-mbp Date: Sun, 4 Jan 2026 00:01:38 +0530 Subject: [PATCH 5/6] feat: Add troubleshooting tips for common installation errors to the scaffold process. --- src/scaffold.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/scaffold.ts b/src/scaffold.ts index e6c5bdf..eecd3a8 100644 --- a/src/scaffold.ts +++ b/src/scaffold.ts @@ -244,6 +244,13 @@ export const scaffoldProject = async ( } catch (error) { spinner.fail("Installation failed"); console.log(chalk.red("\nError:"), error); + + console.log(chalk.yellow("\nTroubleshooting Tips:")); + console.log(chalk.white(" • If you see 'EACCES' or permission errors, try running:")); + console.log(chalk.cyan(" sudo chown -R $(whoami) ~/.npm")); + console.log(chalk.white(" • If you see 'EEXIST' or cache errors, try:")); + console.log(chalk.cyan(" npm cache clean --force")); + console.log(chalk.yellow("\nYou can install dependencies manually:")); console.log(chalk.cyan(` cd ${projectName}`)); console.log(chalk.cyan(` ${pm} install`)); From 70da204cdb10a18db4b5e33ecfa41e2a6aad2cdc Mon Sep 17 00:00:00 2001 From: praboth-mbp Date: Sun, 4 Jan 2026 00:12:14 +0530 Subject: [PATCH 6/6] feat: Add Tailwind v4 support for HeroUI by configuring `globals.css` and creating `hero.ts` during scaffolding. --- package.json | 2 +- src/lib/ast.ts | 30 ++++++++++++++++++++++++++++++ src/scaffold.ts | 33 ++++++++++++++------------------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 107cc12..58566e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nxt-gen-cli", - "version": "2.1.0", + "version": "2.1.2", "description": "The ultimate Next.js scaffold CLI generator. Customize your stack with Prisma, React Query, Shadcn, HeroUI, and more in seconds.", "main": "dist/index.js", "type": "module", diff --git a/src/lib/ast.ts b/src/lib/ast.ts index f5142cd..f502c75 100644 --- a/src/lib/ast.ts +++ b/src/lib/ast.ts @@ -176,3 +176,33 @@ export async function configureTailwindForHeroUI(projectPath: string) { await sourceFile.save(); } + +export async function configureGlobalCssForHeroUI(projectPath: string) { + const cssPath = path.join(projectPath, "src/app/globals.css"); + if (!fs.existsSync(cssPath)) return; + + let content = await fs.readFile(cssPath, "utf-8"); + + // Check if it's already configured to avoid duplication + if (content.includes("@plugin './hero.ts';")) return; + + // Replace default tailwind import with v4 setup + // We assume standard create-next-app output which usually starts with directives + // Or just prepend/replace the top part. + + const v4Setup = `@import "tailwindcss"; +@plugin './hero.ts'; +@source '../../node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}'; +@custom-variant dark (&:is(.dark *)); + +`; + + if (content.includes('@import "tailwindcss";')) { + content = content.replace('@import "tailwindcss";', v4Setup); + } else { + // Fallback: Prepend if no standard import found (though unlikely in fresh v4 app) + content = v4Setup + content; + } + + await fs.writeFile(cssPath, content); +} diff --git a/src/scaffold.ts b/src/scaffold.ts index eecd3a8..a599265 100644 --- a/src/scaffold.ts +++ b/src/scaffold.ts @@ -55,7 +55,11 @@ import { getDlxCommand, PackageManager, } from "./lib/pm.js"; -import { addProviderToLayout, configureTailwindForHeroUI } from "./lib/ast.js"; +import { + addProviderToLayout, + configureTailwindForHeroUI, + configureGlobalCssForHeroUI, +} from "./lib/ast.js"; import { DependencyCollector } from "./lib/deps.js"; import prompts from "prompts"; @@ -608,26 +612,17 @@ export function cn(...inputs: ClassValue[]) { const configExists = await fs.pathExists(tailwindConfigPath); if (!configExists) { - // Create a fresh config compatible with HeroUI + // Assuming Tailwind v4 if config is missing + // 1. Create hero.ts await fs.writeFile( - tailwindConfigPath, - ` -import type { Config } from "tailwindcss"; -import {heroui} from '@heroui/react'; - -const config: Config = { - content: [ - "./src/**/*.{js,ts,jsx,tsx,mdx}", - "./node_modules/@heroui/theme/dist/**/*.{js,ts,jsx,tsx}" - ], - theme: { - extend: {}, - }, - plugins: [heroui()], -}; -export default config; -` + path.join(projectPath, "hero.ts"), + `import { heroui } from "@heroui/react"; + +export default heroui();` ); + + // 2. Configure globals.css for v4 + await configureGlobalCssForHeroUI(projectPath); } else { await configureTailwindForHeroUI(projectPath); }