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
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Description

<!-- What does this PR do? -->

## Type of Change

- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Checklist

- [ ] Code follows existing style conventions
- [ ] Tests added/updated
- [ ] `npm run lint` passes
- [ ] `npm run build` passes
- [ ] `npm test` passes
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [20, 22]

steps:
- uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Typecheck
run: npm run typecheck

- name: Lint
run: npm run lint

- name: Format check
run: npm run format:check

- name: Build
run: npm run build

- name: Test
run: npm test
25 changes: 25 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Package

on:
push:
tags:
- 'v*'

permissions:
id-token: write # Required for OIDC
contents: read

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: actions/setup-node@v6
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm publish
31 changes: 20 additions & 11 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
# Exclude local dev and build files
node_modules/
dist/
.vscode/
.env
*.log
*.tsbuildinfo
.DS_Store

# Exclude test files (if any)
__tests__/
# Exclude test files
tests/
coverage/
*.test.ts
*.spec.ts
vitest.config.ts

# Exclude source (compiled to dist/)
src/

# Exclude config files
tsconfig.json
tsup.config.ts
eslint.config.js
.prettierrc
.prettierignore

# Exclude CI/CD and docs
.github/
.changeset/
docs/

# Exclude backup and editor-specific files
*.swp
*.swo
.idea/
*.bak

# Exclude CLI source if compiled version is used
src/
tsconfig.json
vite.config.ts
README-draft.md

# Include only the compiled CLI and templates
!cli.js
!extension-structure/
!dist/
!src/templates/
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist
node_modules
coverage
extension-structure
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2
}
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).

## [0.1.0] - 2026-03-27

### Added

- TypeScript source with tsup build pipeline
- Commander CLI with `--help`, `--version`, and `--verbose` flags
- Project name validation (npm-name compliant)
- `--force` flag to overwrite existing directories
- Graceful Ctrl+C handling with cleanup
- `ora` loading spinners for all long-running operations
- Error handling with user-friendly messages
- Generic Chrome extension starter templates:
- Popup with `chrome.storage` counter demo
- Options page with settings save/load
- Background service worker with `onInstalled` and `onMessage`
- Content script with background messaging example
- Typed `chrome.storage.sync` utility wrapper
- ESLint + Prettier configuration
- Vitest unit tests
- GitHub Actions CI/CD (build + test + publish)
- Changesets for version management
- Contributing guide

### Changed

- Migrated from raw JavaScript (`bin/cli.js`) to modular TypeScript (`src/`)
- CLI binary now points to compiled `dist/index.js`
- Minimum Node.js version bumped from 16 to 20
- Version bumped from 0.0.4 to 0.1.0

### Fixed

- Branding: replaced all "Extensify" references with "Vextro"

### Removed

- `bin/cli.js` (replaced by `src/` + `dist/`)
- `apiClient.ts` placeholder (replaced by `storage.ts`)
116 changes: 80 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,92 +1,136 @@
# create-vextro

[![CI](https://github.com/lasalasa/vextro/actions/workflows/ci.yml/badge.svg)](https://github.com/lasalasa/vextro/actions/workflows/ci.yml)
[![npm version](https://img.shields.io/npm/v/create-vextro?color=blue&style=flat-square)](https://www.npmjs.com/package/create-vextro)
[![npm downloads](https://img.shields.io/npm/dt/create-vextro?style=flat-square)](https://www.npmjs.com/package/create-vextro)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat-square)](https://github.com/lasalasa/vextro/blob/main/LICENSE)
[![GitHub stars](https://img.shields.io/github/stars/lasalasa/vextro?style=flat-square)](https://github.com/lasalasa/vextro/stargazers)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=flat-square)](https://github.com/lasalasa/vextro/pulls)

> Scaffold a modern Chrome extension powered by Vite + React + Tailwind in seconds.
> Scaffold modern browser extensions for Chrome, Edge, and Firefox β€” powered by Vite + React + Tailwind.

**Vextro** is a starter toolkit designed for building fast, modern Chrome extensions using:
**Vextro** is a CLI tool for building fast, modern browser extensions using:

- ⚑ [Vite](https://vitejs.dev/)
- βš›οΈ [React + TypeScript](https://reactjs.org/)
- 🎨 [Tailwind CSS](https://tailwindcss.com/)
- 🧩 [Manifest V3](https://developer.chrome.com/docs/extensions/mv3/intro/)
- πŸ”Œ [CRXJS Vite Plugin](https://crxjs.dev/)
- πŸ”Œ [CRXJS](https://crxjs.dev/) (Chrome/Edge) or [vite-plugin-web-extension](https://github.com/nicedoc/vite-plugin-web-extension) (Firefox)

---

## πŸš€ Getting Started
## 🌐 Browser Support

You can scaffold a new extension using one of the following commands:
| Browser | Status | Flag | Notes |
| ----------- | ------------------ | ----------- | ----------------------------------------------------------------- |
| **Chrome** | βœ… Fully supported | `--chrome` | Uses CRXJS Vite Plugin |
| **Edge** | βœ… Fully supported | `--chrome` | Chromium-based β€” same as Chrome, load from `edge://extensions` |
| **Firefox** | βœ… Fully supported | `--firefox` | Uses vite-plugin-web-extension + `chrome.*` namespace |
| **Safari** | πŸ“„ Documented | β€” | Convert Chrome output with `xcrun safari-web-extension-converter` |

### With **npm**
```bash
npm create vextro@latest
````
---

### With **Yarn**
## πŸš€ Quick Start

```bash
yarn create vextro
```
# Interactive (prompts for browser)
npx create-vextro create my-extension

### With **pnpm**
# Chrome / Edge (skip prompt)
npx create-vextro create my-extension --chrome

```bash
pnpm create vextro
# Firefox (skip prompt)
npx create-vextro create my-extension --firefox
```

### With **Bun**
Then:

```bash
bun create vextro
cd my-extension
npm run dev
```

Then follow the prompt to choose your project name:
### Loading your extension

**Chrome / Edge:**

1. Open `chrome://extensions` (or `edge://extensions`)
2. Enable **Developer mode**
3. Click **"Load unpacked"** β†’ select the `dist/` folder

**Firefox:**

1. Open `about:debugging#/runtime/this-firefox`
2. Click **"Load Temporary Add-on"**
3. Select any file in the `dist/` folder

**Safari (macOS only):**

1. Build a Chrome extension first using `--chrome`
2. Run `xcrun safari-web-extension-converter dist/` to create an Xcode project
3. Build and run from Xcode

---

## πŸ“‹ Commands

```bash
cd my-extension
npm install
npm run dev
create-vextro create <name> # Interactive (prompts for browser)
create-vextro create <name> --chrome # Chrome / Edge
create-vextro create <name> --firefox # Firefox
create-vextro create <name> --force # Overwrite existing directory
create-vextro --version # Show version
create-vextro --help # Show help
create-vextro --verbose # Enable verbose output
```

Finally, open Chrome and load your extension from the `dist/` folder via `chrome://extensions`.
---

## ✨ What You Get

Every generated project includes:

| Feature | Description |
| ------------------ | ------------------------------------------------------ |
| **Popup** | React popup with `chrome.storage` demo |
| **Options page** | Settings page with save/load via storage sync |
| **Background** | Service worker with `onInstalled` and message listener |
| **Content script** | Injected script with background messaging example |
| **Storage utils** | Typed wrapper around browser storage API |
| **Hot Reload** | Vite HMR for popup and options pages |
| **TypeScript** | Full type safety |
| **Tailwind CSS** | Utility-first styling pre-configured |

---

## πŸ“ Example Folder Structure
## πŸ“ Generated Project Structure

```
my-extension/
β”œβ”€β”€ public/ # Static assets (optional)
β”œβ”€β”€ public/
β”‚ β”œβ”€β”€ icon.png
β”‚ └── icons/ # Extension icons (16, 48, 128)
β”œβ”€β”€ src/
β”‚ β”œβ”€β”€ background/ # Background service worker
β”‚ β”œβ”€β”€ background/ # Background service worker / script
β”‚ β”œβ”€β”€ content/ # Content scripts
β”‚ β”œβ”€β”€ options/ # Options page (React + Tailwind)
β”‚ β”œβ”€β”€ popup/ # Popup UI (React + Tailwind)
β”‚ β”œβ”€β”€ manifest.ts # Typed manifest config
β”‚ β”œβ”€β”€ styles.css # Tailwind CSS entrypoint
β”‚ └── utils/ # Utility scripts
β”œβ”€β”€ vite.config.ts # Vite + CRX plugin config
β”‚ β”œβ”€β”€ utils/ # Storage utilities
β”‚ β”œβ”€β”€ manifest.ts/.json # Manifest config (format depends on browser)
β”‚ └── styles.css # Tailwind CSS entrypoint
β”œβ”€β”€ vite.config.ts # Vite + browser plugin config
β”œβ”€β”€ tsconfig.json
└── package.json
```

---

## 🌟 Features
## 🀝 Contributing

* ⚑ Instant startup with Vite
* πŸ”₯ Hot Module Reload (HMR) for popup and options
* 🧩 Multi-entry support with `@crxjs/vite-plugin`
* πŸ› οΈ Preconfigured React + TypeScript + Tailwind
* 🧱 Opinionated folder structure
See [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) for development setup and contribution guidelines.

---

## πŸ“„ License

MIT Β© [Lasantha Lakmal](https://github.com/lasalasa)
MIT Β© [Lasantha Lakmal](https://github.com/lasalasa)
Loading
Loading