From 4f603ebb3277b310f7e2944dc1334092faed2b63 Mon Sep 17 00:00:00 2001 From: nishu-murmu Date: Sat, 12 Sep 2026 21:10:08 +0530 Subject: [PATCH 1/8] fix: Initializing git repo on project creation --- packages/wxt/src/core/initialize.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/wxt/src/core/initialize.ts b/packages/wxt/src/core/initialize.ts index 8fdc3cfd6..0ad8de923 100644 --- a/packages/wxt/src/core/initialize.ts +++ b/packages/wxt/src/core/initialize.ts @@ -7,6 +7,7 @@ import path from 'node:path'; import { styleText } from 'node:util'; import { TextStyle } from '../utils/text-style'; import { createSpinner } from './utils/spinner'; +import { x as spawn } from 'tinyexec'; export async function initialize(options: { directory?: string; @@ -158,7 +159,7 @@ async function cloneProject({ const spinner = createSpinner('Downloading template').start(); try { // 1. Clone repo - await downloadTemplate(`gh:${REPO}/${template.path}`, { + const response = await downloadTemplate(`gh:${REPO}/${template.path}`, { dir: directory, force: true, }); @@ -171,6 +172,13 @@ async function cloneProject({ consola.warn('Failed to move _gitignore to .gitignore:', err), ); + // 3. Initializing Git + const dir = response.dir; + await spawn('git', ['init'], { + throwOnError: true, + nodeOptions: { cwd: dir }, + }); + spinner.success(); } catch (err) { spinner.error(); From d5302e42c9d20db8e747797c714e0e8827fd714b Mon Sep 17 00:00:00 2001 From: Gliches Date: Sun, 13 Sep 2026 00:49:50 +0530 Subject: [PATCH 2/8] added check for whether the project is already under git control. Co-authored-by: fkatsuhiro <113022468+fkatsuhiro@users.noreply.github.com> --- packages/wxt/src/core/initialize.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/wxt/src/core/initialize.ts b/packages/wxt/src/core/initialize.ts index 0ad8de923..61a19ee20 100644 --- a/packages/wxt/src/core/initialize.ts +++ b/packages/wxt/src/core/initialize.ts @@ -174,10 +174,19 @@ async function cloneProject({ // 3. Initializing Git const dir = response.dir; - await spawn('git', ['init'], { - throwOnError: true, - nodeOptions: { cwd: dir }, - }); + const { exitCode } = await spawn( + 'git', + ['rev-parse', '--is-inside-work-tree'], + { nodeOptions: { cwd: dir } }, + ); + if (exitCode === 0) { + consola.debug('Git has already been initialized.'); + } else { + await spawn('git', ['init'], { + throwOnError: true, + nodeOptions: { cwd: dir }, + }); + } spinner.success(); } catch (err) { From cf2e491091a63acfd3c0863f2e91a6d6948b81d6 Mon Sep 17 00:00:00 2001 From: nishu-murmu Date: Fri, 2 Oct 2026 10:50:47 +0530 Subject: [PATCH 3/8] chore: fix type check errors --- packages/is-background/src/getter.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/is-background/src/getter.ts b/packages/is-background/src/getter.ts index 700f98bce..5e9d5089e 100644 --- a/packages/is-background/src/getter.ts +++ b/packages/is-background/src/getter.ts @@ -26,7 +26,6 @@ export function getIsBackground(): boolean { // - ✅ Safari MV2 return ( typeof window !== 'undefined' && - typeof browser.extension?.getBackgroundPage === 'function' && - browser.extension.getBackgroundPage() === window + typeof browser.extension?.getBackgroundPage === 'function' ); } From bc009df39e002b87d142f6e451f66937dd2a7f8b Mon Sep 17 00:00:00 2001 From: nishu-murmu Date: Fri, 2 Oct 2026 10:58:36 +0530 Subject: [PATCH 4/8] chore: fix validation workflow and background context getter --- .github/workflows/validate.yml | 4 ++-- packages/is-background/src/getter.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index eca8b50ee..1648a741f 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -67,7 +67,7 @@ jobs: - name: Setup PNPM uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 with: - version: latest + version: 10.29.3 - name: Run Tests (Coverage) run: bun run test:coverage --reporter=default --reporter=hanging-process @@ -90,7 +90,7 @@ jobs: - name: Setup PNPM uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 with: - version: latest + version: 10.29.3 - name: Run Tests run: bun run test diff --git a/packages/is-background/src/getter.ts b/packages/is-background/src/getter.ts index 5e9d5089e..848024796 100644 --- a/packages/is-background/src/getter.ts +++ b/packages/is-background/src/getter.ts @@ -26,6 +26,7 @@ export function getIsBackground(): boolean { // - ✅ Safari MV2 return ( typeof window !== 'undefined' && - typeof browser.extension?.getBackgroundPage === 'function' + typeof browser.extension?.getBackgroundPage === 'function' && + browser.extension.getBackgroundPage() === (window as Window | null) ); } From 8501ab3294903e2649b756ac8215ff11eff4b73b Mon Sep 17 00:00:00 2001 From: nishu-murmu Date: Fri, 2 Oct 2026 11:05:50 +0530 Subject: [PATCH 5/8] chore: fixing the type check errors. --- .github/workflows/validate.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 1648a741f..d673f789a 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -20,6 +20,9 @@ jobs: - name: Setup uses: ./.github/actions/setup + - name: Build All Packages + run: bun run buildc all + - name: Basic Checks run: bun run check From 1a929cdad062ecaab6e75eda6555ec8622ed9755 Mon Sep 17 00:00:00 2001 From: nishu-murmu Date: Wed, 7 Oct 2026 13:14:55 +0530 Subject: [PATCH 6/8] feat: asking whether to initialize the git repo or not during project init. --- packages/wxt/src/cli/commands.ts | 2 ++ packages/wxt/src/initialize.ts | 36 +++++++++++++++++++------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/packages/wxt/src/cli/commands.ts b/packages/wxt/src/cli/commands.ts index 9b491b897..029edd5e1 100644 --- a/packages/wxt/src/cli/commands.ts +++ b/packages/wxt/src/cli/commands.ts @@ -149,6 +149,7 @@ cli .command('init [directory]', 'initialize a new project') .option('-t, --template