From 6703fe0b33b22d31de1fd43be07f348b9f3cba98 Mon Sep 17 00:00:00 2001 From: gaureshpai Date: Sun, 21 Jun 2026 19:54:27 +0530 Subject: [PATCH 1/3] fix: improve text rendering in prompts and enhance ANSI stripping --- src/lib/prompts.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/prompts.js b/src/lib/prompts.js index 1f10082..09286e4 100644 --- a/src/lib/prompts.js +++ b/src/lib/prompts.js @@ -17,9 +17,15 @@ const ask = (query) => { return new Promise((resolve) => getRl().question(query, resolve)); }; +const stripAnsi = (str) => { + const ansiEscape = String.fromCharCode(27); + return str.replace(new RegExp(`${ansiEscape}\\[[0-9;]*m`, "g"), ""); +}; + const getRenderedRowCount = (text, columns = process.stdout.columns ?? 80) => { const safeColumns = Math.max(columns || 80, 1); - return Math.max(1, Math.ceil(text.length / safeColumns)); + const visibleLength = stripAnsi(text).length; + return Math.max(1, Math.ceil(visibleLength / safeColumns)); }; const resolveConfirmInput = (input, defaultValue) => { @@ -228,7 +234,8 @@ const processQuestion = async (question) => { readline.clearLine(stdout, 0); readline.cursorTo(stdout, 0); - process.stdout.write(`${prefix} ${indexLabel}${label}${explanation}\n`); + const line = `${prefix} ${indexLabel}${label}${explanation}`; + process.stdout.write(`${line}\n`); }); }; From 9f4851b2d9cc2863e0b22be58220922c516e6f1a Mon Sep 17 00:00:00 2001 From: gaureshpai Date: Sun, 21 Jun 2026 20:29:07 +0530 Subject: [PATCH 2/3] fix: streamline ANSI stripping logic in stripAnsi function --- src/lib/prompts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/prompts.js b/src/lib/prompts.js index 09286e4..b017c4c 100644 --- a/src/lib/prompts.js +++ b/src/lib/prompts.js @@ -17,9 +17,10 @@ const ask = (query) => { return new Promise((resolve) => getRl().question(query, resolve)); }; +// biome-ignore lint/suspicious/noControlCharactersInRegex: ESC char is required to match ANSI escape codes +const ansiRegex = /\u001b\[[0-9;?]*[ -/]*[@-~]/g; const stripAnsi = (str) => { - const ansiEscape = String.fromCharCode(27); - return str.replace(new RegExp(`${ansiEscape}\\[[0-9;]*m`, "g"), ""); + return str.replace(ansiRegex, ""); }; const getRenderedRowCount = (text, columns = process.stdout.columns ?? 80) => { From e514bab5a45494e9b76cfbe43d5192e49417aefa Mon Sep 17 00:00:00 2001 From: gaureshpai Date: Sun, 21 Jun 2026 20:45:18 +0530 Subject: [PATCH 3/3] fix: update CI/CD workflows and package manager version to pnpm@10.28.2 --- .github/workflows/ci.yml | 104 ++++++++++++++-------------------- .github/workflows/publish.yml | 6 +- package.json | 1 + 3 files changed, 45 insertions(+), 66 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 423724a..8596e20 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,63 +1,41 @@ -name: CI/CD Pipeline - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - build-and-test: - name: Node ${{ matrix.node-version }} - ${{ matrix.package-manager }} - runs-on: ubuntu-latest - permissions: - contents: read - - strategy: - matrix: - node-version: [20.x, 22.x] - package-manager: [npm, pnpm, yarn] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: Enable Corepack - run: corepack enable - - - name: Install dependencies - run: ${{ matrix.package-manager }} install - - - name: Build package - run: ${{ matrix.package-manager }} run build - - - name: Smoke test built artifact - run: | - mkdir -p test-logs - node dist/create-next-quick.js --version > test-logs/smoke-test.txt 2>&1 - if [ $? -ne 0 ]; then cat test-logs/smoke-test.txt; exit 1; fi - cat test-logs/smoke-test.txt - - - name: Run tests and save logs - run: | - mkdir -p test-logs - ${{ matrix.package-manager }} test > test-logs/log.txt 2>&1 - - - name: Verify test success - run: grep "Tests passed successfully" test-logs/log.txt - - - name: Print test logs - run: cat test-logs/log.txt - - - name: Upload test logs - uses: actions/upload-artifact@v4 - if: always() - with: - name: test-logs-${{ matrix.node-version }}-${{ matrix.package-manager }} - path: test-logs/log.txt - retention-days: 5 +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build-and-test: + name: Build & Test + runs-on: ubuntu-latest + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: 10.28.2 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build package + run: pnpm build + + - name: Smoke test + run: node dist/create-next-quick.js --version + + - name: Run tests + run: pnpm test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0b368ee..0dc9261 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,14 +24,14 @@ jobs: contents: write steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 with: fetch-depth: 0 - name: Install pnpm - uses: pnpm/action-setup@v3 + uses: pnpm/action-setup@v6 with: - version: 9 + version: 10.28.2 - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/package.json b/package.json index 6c2dce2..a3816b3 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "javascript", "frontend" ], + "packageManager": "pnpm@10.28.2", "author": "gaureshpai", "license": "MIT", "repository": {