forked from stephenou/fruitionsite
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Summary
Publish Worknot as an NPM package with CLI tools for easier setup, configuration, and deployment.
Current Behavior
Users must:
- Visit the web UI
- Fill in the form
- Copy the generated script
- Manually create a Cloudflare Worker
- Paste the script
This process is manual and error-prone.
Proposed Solution
NPM Package Structure
worknot/
├── src/
│ ├── index.ts # Main export
│ ├── proxy.ts # Core proxy logic
│ ├── types.ts # TypeScript definitions
│ ├── cli/
│ │ ├── init.ts # npx worknot init
│ │ └── generate.ts # npx worknot generate
│ ├── handlers/ # Request handlers
│ └── rewriters/ # HTML rewriters
├── templates/
│ ├── config.js # Config template
│ ├── head.css # Custom CSS template
│ ├── body.js # Custom JS template
│ └── header.html # Custom header template
└── package.json
CLI Commands
# Initialize a new Worknot project
npx worknot init
# Generate optimized files from config
npx worknot generate
# Deploy to Cloudflare Workers
npx worknot deployUsage as Library
import { initializeWorknot } from 'worknot';
import { SITE_CONFIG } from './worknot/config';
const proxy = initializeWorknot(SITE_CONFIG);
export default {
async fetch(request: Request): Promise<Response> {
return proxy(request);
},
};Benefits
- Faster setup (5 minutes vs 15+ minutes)
- Version control for configuration
- TypeScript support with full type safety
- Easier updates via npm
- CI/CD integration
- Local development support
Reference
Nooxy provides full NPM package with CLI: https://www.npmjs.com/package/nooxy