Skip to content

Commit c0b6a8a

Browse files
committed
feat: Initialize OpenNext.js CLI project with essential configurations and utilities
- Added ESLint configuration for TypeScript support. - Created .gitignore to exclude build outputs and dependencies. - Introduced Prettier configuration for code formatting. - Established CHANGELOG.md and cliff.toml for version tracking. - Added CONTRIBUTING.md to guide contributors. - Included MIT License for project licensing. - Set up package.json with project metadata and scripts. - Implemented pnpm workspace configuration for monorepo structure. - Developed README.md with project overview and usage instructions. - Configured TypeScript settings in tsconfig.json. - Integrated Turbo for build optimization. - Created core CLI functionality with commands for project initialization and configuration. - Implemented Cloudflare-specific prompts and configuration generation. - Added utility functions for logging, backup, and package management. - Established validation schemas using Zod for user inputs. - Included project detection logic to identify existing Next.js projects. This commit lays the foundation for the OpenNext.js CLI, enabling users to easily set up and configure OpenNext.js projects for Cloudflare Workers.
0 parents  commit c0b6a8a

39 files changed

Lines changed: 9718 additions & 0 deletions

.eslintrc.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"root": true,
3+
"parser": "@typescript-eslint/parser",
4+
"parserOptions": {
5+
"ecmaVersion": 2022,
6+
"sourceType": "module",
7+
"project": "./tsconfig.json"
8+
},
9+
"plugins": ["@typescript-eslint"],
10+
"extends": [
11+
"eslint:recommended",
12+
"plugin:@typescript-eslint/recommended",
13+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
14+
],
15+
"rules": {
16+
"@typescript-eslint/no-unused-vars": [
17+
"error",
18+
{
19+
"argsIgnorePattern": "^_",
20+
"varsIgnorePattern": "^_"
21+
}
22+
],
23+
"@typescript-eslint/explicit-function-return-type": "warn",
24+
"@typescript-eslint/no-explicit-any": "error"
25+
},
26+
"ignorePatterns": ["node_modules", "dist", ".turbo", "*.config.js", "*.config.mjs"]
27+
}

.github/FUNDING.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# These are supported funding model platforms
2+
3+
github: JSONbored # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4+
# patreon: # Replace with a single Patreon username
5+
# open_collective: # Replace with a single Open Collective username
6+
# ko_fi: # Replace with a single Ko-fi username
7+
# tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8+
# community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9+
# liberapay: # Replace with a single Liberapay username
10+
# issuehunt: # Replace with a single IssueHunt username
11+
# otechie: # Replace with a single Otechie username
12+
# lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13+
# polar: # Replace with a single Polar username
14+
# buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
15+
# thanks_dev: # Replace with a single thanks.dev username
16+
# custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/ci.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
lint-and-type-check:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: pnpm/action-setup@v4
15+
with:
16+
version: 8
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
cache: 'pnpm'
21+
- name: Install dependencies
22+
run: pnpm install --frozen-lockfile
23+
- name: Lint
24+
run: pnpm lint
25+
- name: Type check
26+
run: pnpm type-check
27+
- name: Format check
28+
run: pnpm format:check
29+
30+
build:
31+
runs-on: ubuntu-latest
32+
needs: lint-and-type-check
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: pnpm/action-setup@v4
36+
with:
37+
version: 8
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: '20'
41+
cache: 'pnpm'
42+
- name: Install dependencies
43+
run: pnpm install --frozen-lockfile
44+
- name: Build
45+
run: pnpm build

.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Dependencies
2+
node_modules
3+
4+
# Build outputs
5+
dist
6+
dist-ssr
7+
.next
8+
.open-next
9+
out
10+
11+
# Logs
12+
logs
13+
*.log
14+
npm-debug.log*
15+
yarn-debug.log*
16+
yarn-error.log*
17+
pnpm-debug.log*
18+
lerna-debug.log*
19+
20+
# Editor directories and files
21+
.vscode/*
22+
!.vscode/extensions.json
23+
.idea
24+
*.suo
25+
*.ntvs*
26+
*.njsproj
27+
*.sln
28+
*.sw?
29+
30+
# OS files
31+
.DS_Store
32+
33+
# Environment files
34+
.env*
35+
!.env.example
36+
37+
# Cache files
38+
.eslintcache
39+
*.tsbuildinfo
40+
.parcel-cache/
41+
.turbo/
42+
.temp/
43+
.build-cache/
44+
45+
# Backup files
46+
*.orig
47+
*.bak
48+
*.backup
49+
backups/
50+
51+
# System files
52+
Thumbs.db
53+
54+
# Wrangler (Cloudflare Workers CLI)
55+
.wrangler/
56+
.dev.vars
57+
58+
# Test coverage
59+
coverage/
60+
.nyc_output/
61+
62+
# TypeScript
63+
*.tsbuildinfo

.prettierrc.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"arrowParens": "always",
9+
"endOfLine": "lf"
10+
}

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
<!-- generated by git-cliff -->

CONTRIBUTING.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Contributing to OpenNext.js CLI
2+
3+
Thank you for your interest in contributing to OpenNext.js CLI! This document provides guidelines and instructions for contributing.
4+
5+
## Getting Started
6+
7+
1. Fork the repository
8+
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/opennextjs-cli.git`
9+
3. Create a branch: `git checkout -b feature/your-feature-name`
10+
4. Install dependencies: `pnpm install`
11+
5. Make your changes
12+
6. Test your changes: `pnpm test`
13+
7. Commit your changes: `git commit -m "Add feature: your feature"`
14+
8. Push to your fork: `git push origin feature/your-feature-name`
15+
9. Open a Pull Request
16+
17+
## Development Setup
18+
19+
```bash
20+
# Install dependencies
21+
pnpm install
22+
23+
# Run linting
24+
pnpm lint
25+
26+
# Run type checking
27+
pnpm type-check
28+
29+
# Build the project
30+
pnpm build
31+
```
32+
33+
## Code Style
34+
35+
- We use Prettier for code formatting
36+
- We use ESLint for linting
37+
- We use TypeScript with strict mode
38+
- All code must have JSDoc comments
39+
- All user inputs must be validated with Zod schemas
40+
41+
## Commit Messages
42+
43+
We follow [Conventional Commits](https://www.conventionalcommits.org/):
44+
45+
- `feat:` New feature
46+
- `fix:` Bug fix
47+
- `docs:` Documentation changes
48+
- `style:` Code style changes (formatting, etc.)
49+
- `refactor:` Code refactoring
50+
- `test:` Adding or updating tests
51+
- `chore:` Maintenance tasks
52+
53+
## Pull Request Process
54+
55+
1. Ensure all tests pass
56+
2. Update documentation if needed
57+
3. Add JSDoc comments for new functions
58+
4. Ensure code follows our style guidelines
59+
5. Request review from maintainers
60+
61+
## Questions?
62+
63+
Feel free to open an issue or discussion if you have questions!

LICENSE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
MIT License
2+
3+
Copyright (c) 2026 JSONbored
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
---
24+
25+
This project uses OpenNext.js, which is licensed under the MIT License.
26+
See: https://github.com/opennextjs/opennextjs-cloudflare

README.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# OpenNext.js CLI
2+
3+
> Interactive CLI/TUI tool for setting up and configuring OpenNext.js projects for Cloudflare Workers
4+
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
7+
## Overview
8+
9+
`opennextjs-cli` is an interactive command-line tool that guides you through setting up and configuring OpenNext.js for Cloudflare Workers deployments. Similar to `create-next-app` or `next-forge`, it automates the setup process with step-by-step prompts, making it easy to get started with OpenNext.js Cloudflare.
10+
11+
## Features
12+
13+
- 🚀 **Interactive Setup Wizard** - Step-by-step prompts for configuration
14+
- ⚙️ **Automatic Configuration** - Generates `open-next.config.ts`, `wrangler.toml`, and more
15+
- 🔧 **Smart Defaults** - Best practices built-in
16+
- 📦 **Dependency Management** - Automatically installs required packages
17+
- 🛡️ **Type-Safe** - Full TypeScript support with Zod validation
18+
- 🎯 **Next.js Version Support** - Official support for Next.js 15.x, experimental for 16.x
19+
20+
## Quick Start
21+
22+
```bash
23+
# Install globally
24+
npm install -g opennextjs-cli
25+
26+
# Initialize a new project
27+
opennextjs-cli init my-project
28+
29+
# Add OpenNext to existing project
30+
opennextjs-cli add
31+
```
32+
33+
## Installation
34+
35+
```bash
36+
npm install -g opennextjs-cli
37+
# or
38+
pnpm add -g opennextjs-cli
39+
# or
40+
yarn global add opennextjs-cli
41+
```
42+
43+
## Usage
44+
45+
### Initialize New Project
46+
47+
```bash
48+
opennextjs-cli init <project-name>
49+
```
50+
51+
This will:
52+
- Create a new Next.js project
53+
- Configure OpenNext.js for Cloudflare
54+
- Set up all necessary configuration files
55+
- Install dependencies
56+
57+
### Add to Existing Project
58+
59+
```bash
60+
cd your-existing-project
61+
opennextjs-cli add
62+
```
63+
64+
This will:
65+
- Detect your existing Next.js project
66+
- Add OpenNext.js configuration
67+
- Update your `package.json` with necessary scripts
68+
- Install required dependencies
69+
70+
## Configuration Options
71+
72+
The CLI guides you through:
73+
74+
- **Caching Strategy**: Static Assets, R2, R2 + Durable Objects
75+
- **Database Integration**: Hyperdrive, D1, or none
76+
- **Observability**: Logs, traces, and sampling rates
77+
- **Environments**: Development and production configurations
78+
- **Next.js Version**: 15.x (official) or 16.x (experimental)
79+
80+
## Credits
81+
82+
This tool is built for and powered by [OpenNext.js](https://opennext.js.org/),
83+
an amazing project that makes deploying Next.js to various platforms possible.
84+
85+
- **OpenNext.js Cloudflare**: https://github.com/opennextjs/opennextjs-cloudflare
86+
- **Official Documentation**: https://opennext.js.org/cloudflare
87+
- **Package**: `@opennextjs/cloudflare` on npm
88+
89+
> **Note:** This is an unofficial community tool. It is not affiliated with or endorsed by the OpenNext.js team.
90+
91+
## License
92+
93+
MIT License - see [LICENSE](LICENSE) file for details.
94+
95+
## Contributing
96+
97+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
98+
99+
## Support
100+
101+
- 📖 [Documentation](https://opennextjs-cli.dev) (coming soon)
102+
- 🐛 [Report Issues](https://github.com/JSONbored/opennextjs-cli/issues)
103+
- 💬 [Discussions](https://github.com/JSONbored/opennextjs-cli/discussions)

0 commit comments

Comments
 (0)