@tamyla/clodo-framework 3.0.15 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +219 -153
- package/README.md +133 -1
- package/bin/clodo-service.js +1 -1
- package/bin/security/security-cli.js +0 -0
- package/bin/service-management/create-service.js +0 -0
- package/bin/service-management/init-service.js +2 -1
- package/dist/service-management/GenerationEngine.js +298 -3025
- package/dist/service-management/InputCollector.js +14 -0
- package/dist/service-management/ServiceCreator.js +19 -3
- package/dist/service-management/generators/BaseGenerator.js +233 -0
- package/dist/service-management/generators/GeneratorRegistry.js +254 -0
- package/dist/service-management/generators/cicd/CiWorkflowGenerator.js +87 -0
- package/dist/service-management/generators/cicd/DeployWorkflowGenerator.js +106 -0
- package/dist/service-management/generators/code/ServiceHandlersGenerator.js +235 -0
- package/dist/service-management/generators/code/ServiceMiddlewareGenerator.js +116 -0
- package/dist/service-management/generators/code/ServiceUtilsGenerator.js +246 -0
- package/dist/service-management/generators/code/WorkerIndexGenerator.js +143 -0
- package/dist/service-management/generators/config/DevelopmentEnvGenerator.js +101 -0
- package/dist/service-management/generators/config/DomainsConfigGenerator.js +175 -0
- package/dist/service-management/generators/config/EnvExampleGenerator.js +178 -0
- package/dist/service-management/generators/config/ProductionEnvGenerator.js +97 -0
- package/dist/service-management/generators/config/StagingEnvGenerator.js +97 -0
- package/dist/service-management/generators/config/WranglerTomlGenerator.js +238 -0
- package/dist/service-management/generators/core/PackageJsonGenerator.js +243 -0
- package/dist/service-management/generators/core/SiteConfigGenerator.js +115 -0
- package/dist/service-management/generators/documentation/ApiDocsGenerator.js +331 -0
- package/dist/service-management/generators/documentation/ConfigurationDocsGenerator.js +294 -0
- package/dist/service-management/generators/documentation/DeploymentDocsGenerator.js +244 -0
- package/dist/service-management/generators/documentation/ReadmeGenerator.js +196 -0
- package/dist/service-management/generators/schemas/ServiceSchemaGenerator.js +190 -0
- package/dist/service-management/generators/scripts/DeployScriptGenerator.js +123 -0
- package/dist/service-management/generators/scripts/HealthCheckScriptGenerator.js +101 -0
- package/dist/service-management/generators/scripts/SetupScriptGenerator.js +88 -0
- package/dist/service-management/generators/service-types/StaticSiteGenerator.js +342 -0
- package/dist/service-management/generators/testing/EslintConfigGenerator.js +85 -0
- package/dist/service-management/generators/testing/IntegrationTestsGenerator.js +237 -0
- package/dist/service-management/generators/testing/JestConfigGenerator.js +72 -0
- package/dist/service-management/generators/testing/UnitTestsGenerator.js +277 -0
- package/dist/service-management/generators/tooling/DockerComposeGenerator.js +71 -0
- package/dist/service-management/generators/tooling/GitignoreGenerator.js +143 -0
- package/dist/service-management/generators/utils/FileWriter.js +179 -0
- package/dist/service-management/generators/utils/PathResolver.js +157 -0
- package/dist/service-management/generators/utils/ServiceManifestGenerator.js +111 -0
- package/dist/service-management/generators/utils/TemplateEngine.js +185 -0
- package/dist/service-management/generators/utils/index.js +18 -0
- package/dist/service-management/routing/DomainRouteMapper.js +311 -0
- package/dist/service-management/routing/RouteGenerator.js +266 -0
- package/dist/service-management/routing/WranglerRoutesBuilder.js +273 -0
- package/dist/service-management/routing/index.js +14 -0
- package/dist/service-management/services/DirectoryStructureService.js +56 -0
- package/dist/service-management/services/GenerationCoordinator.js +208 -0
- package/dist/service-management/services/GeneratorRegistry.js +174 -0
- package/dist/services/GenericDataService.js +14 -1
- package/dist/utils/config/unified-config-manager.js +128 -12
- package/dist/utils/framework-config.js +74 -2
- package/dist/worker/integration.js +4 -1
- package/package.json +6 -1
- package/templates/generic/clodo-service-manifest.json +25 -0
- package/templates/static-site/.env.example +61 -0
- package/templates/static-site/README.md +176 -0
- package/templates/static-site/clodo-service-manifest.json +66 -0
- package/templates/static-site/package.json +28 -0
- package/templates/static-site/public/404.html +87 -0
- package/templates/static-site/public/app.js +100 -0
- package/templates/static-site/public/index.html +48 -0
- package/templates/static-site/public/styles.css +123 -0
- package/templates/static-site/scripts/deploy.ps1 +121 -0
- package/templates/static-site/scripts/setup.ps1 +179 -0
- package/templates/static-site/src/config/domains.js +35 -0
- package/templates/static-site/src/worker/index.js +153 -0
- package/templates/static-site/wrangler.toml +43 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamyla/clodo-framework",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Reusable framework for Clodo-style software architecture on Cloudflare Workers + D1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -77,6 +77,11 @@
|
|
|
77
77
|
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
|
|
78
78
|
"test:watch": "jest --watch",
|
|
79
79
|
"test:coverage": "jest --coverage",
|
|
80
|
+
"test:cli-integration": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --config test/cli-integration/jest.config.js",
|
|
81
|
+
"test:cli-create": "cross-env NODE_OPTIONS=--experimental-vm-modules jest test/cli-integration/clodo-create-service.test.js",
|
|
82
|
+
"test:cli-init": "cross-env NODE_OPTIONS=--experimental-vm-modules jest test/cli-integration/clodo-init-service.test.js",
|
|
83
|
+
"test:cli-security": "cross-env NODE_OPTIONS=--experimental-vm-modules jest test/cli-integration/clodo-security.test.js",
|
|
84
|
+
"test:cli-e2e": "cross-env NODE_OPTIONS=--experimental-vm-modules jest test/cli-integration/e2e-workflows.test.js",
|
|
80
85
|
"lint": "eslint --config ./eslint.config.js src",
|
|
81
86
|
"lint:fix": "eslint --config ./eslint.config.js src --fix",
|
|
82
87
|
"type-check": "tsc --noEmit",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"serviceName": "{{SERVICE_NAME}}",
|
|
4
|
+
"serviceType": "{{SERVICE_TYPE}}",
|
|
5
|
+
"framework": "@tamyla/clodo-framework",
|
|
6
|
+
"created": "{{CURRENT_DATE}}",
|
|
7
|
+
"description": "A Clodo Framework {{SERVICE_TYPE}} service",
|
|
8
|
+
"features": {
|
|
9
|
+
"authentication": false,
|
|
10
|
+
"database": false,
|
|
11
|
+
"cache": false,
|
|
12
|
+
"storage": false
|
|
13
|
+
},
|
|
14
|
+
"cloudflare": {
|
|
15
|
+
"workers": true,
|
|
16
|
+
"d1": false,
|
|
17
|
+
"r2": false,
|
|
18
|
+
"kv": false,
|
|
19
|
+
"durable-objects": false
|
|
20
|
+
},
|
|
21
|
+
"configuration": {
|
|
22
|
+
"domains": [],
|
|
23
|
+
"environment": "development"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Deployment Configuration for {{SERVICE_NAME}}
|
|
2
|
+
# Generated by Clodo Framework
|
|
3
|
+
# Copy this file to create your environment-specific .env files
|
|
4
|
+
|
|
5
|
+
# ============================================
|
|
6
|
+
# Core Customer Identity
|
|
7
|
+
# ============================================
|
|
8
|
+
CUSTOMER_ID={{SERVICE_NAME}}
|
|
9
|
+
CUSTOMER_NAME={{SERVICE_NAME}}
|
|
10
|
+
ENVIRONMENT=development
|
|
11
|
+
|
|
12
|
+
# ============================================
|
|
13
|
+
# Cloudflare Configuration
|
|
14
|
+
# ============================================
|
|
15
|
+
CLOUDFLARE_ACCOUNT_ID=your_account_id_here
|
|
16
|
+
CLOUDFLARE_ZONE_ID=your_zone_id_here
|
|
17
|
+
CLOUDFLARE_API_TOKEN=your_api_token_here
|
|
18
|
+
|
|
19
|
+
# ============================================
|
|
20
|
+
# Service Configuration
|
|
21
|
+
# ============================================
|
|
22
|
+
SERVICE_NAME={{SERVICE_NAME}}
|
|
23
|
+
SERVICE_TYPE=static-site
|
|
24
|
+
DISPLAY_NAME={{SERVICE_DISPLAY_NAME}}
|
|
25
|
+
DESCRIPTION=A static site service powered by Clodo Framework
|
|
26
|
+
|
|
27
|
+
# ============================================
|
|
28
|
+
# Domain Configuration
|
|
29
|
+
# ============================================
|
|
30
|
+
DOMAIN={{DOMAIN_NAME}}
|
|
31
|
+
CUSTOMER_DOMAIN={{DOMAIN_NAME}}
|
|
32
|
+
DEPLOYMENT_URL=https://{{DOMAIN_NAME}}
|
|
33
|
+
API_DOMAIN=https://{{DOMAIN_NAME}}
|
|
34
|
+
|
|
35
|
+
# ============================================
|
|
36
|
+
# Static-Site Configuration
|
|
37
|
+
# ============================================
|
|
38
|
+
PUBLIC_DIR=public
|
|
39
|
+
INDEX_FILE=index.html
|
|
40
|
+
ERROR_FILE=404.html
|
|
41
|
+
CACHE_CONTROL=public, max-age=31536000, immutable
|
|
42
|
+
SPA_FALLBACK=true
|
|
43
|
+
CLEAN_URLS=true
|
|
44
|
+
COMPRESS_TEXT=true
|
|
45
|
+
CORS_ENABLED=true
|
|
46
|
+
|
|
47
|
+
# ============================================
|
|
48
|
+
# Additional Configuration
|
|
49
|
+
# ============================================
|
|
50
|
+
HEALTH_CHECK_PATH=/health
|
|
51
|
+
API_BASE_PATH=/
|
|
52
|
+
LOG_LEVEL=info
|
|
53
|
+
NODE_COMPATIBILITY=v18
|
|
54
|
+
|
|
55
|
+
# ============================================
|
|
56
|
+
# Custom Environment Variables
|
|
57
|
+
# ============================================
|
|
58
|
+
# Add your custom environment variables here
|
|
59
|
+
# CUSTOM_VAR=value
|
|
60
|
+
# API_ENDPOINT=https://api.example.com
|
|
61
|
+
# DATABASE_URL=your_database_url
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# {{SERVICE_DISPLAY_NAME}}
|
|
2
|
+
|
|
3
|
+
A static site service powered by **Clodo Framework** and Cloudflare Workers Sites.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- **⚡ Fast Static File Serving** - Powered by Cloudflare's global CDN
|
|
8
|
+
- **🔒 HTTPS by Default** - Automatic SSL certificate management
|
|
9
|
+
- **📱 Mobile Responsive** - Ready for all devices
|
|
10
|
+
- **🤖 SEO Optimized** - Proper meta tags and structured data
|
|
11
|
+
- **🎨 Modern Design** - Clean, professional appearance
|
|
12
|
+
- **🔧 Developer Friendly** - Easy to customize and extend
|
|
13
|
+
|
|
14
|
+
## 🛠️ Technology Stack
|
|
15
|
+
|
|
16
|
+
- **Framework**: Clodo Framework
|
|
17
|
+
- **Hosting**: Cloudflare Workers Sites
|
|
18
|
+
- **CDN**: Cloudflare Global Network
|
|
19
|
+
- **Language**: JavaScript (ES Modules)
|
|
20
|
+
- **Styling**: CSS3 with modern features
|
|
21
|
+
|
|
22
|
+
## 📁 Project Structure
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
{{SERVICE_NAME}}/
|
|
26
|
+
├── public/ # Static files served by Workers Sites
|
|
27
|
+
│ ├── index.html # Home page
|
|
28
|
+
│ ├── styles.css # Main stylesheet
|
|
29
|
+
│ ├── app.js # Client-side JavaScript
|
|
30
|
+
│ └── 404.html # Error page
|
|
31
|
+
├── src/
|
|
32
|
+
│ ├── worker/
|
|
33
|
+
│ │ └── index.js # Cloudflare Worker (handles routing, CORS, etc.)
|
|
34
|
+
│ └── config/
|
|
35
|
+
│ └── domains.js # Domain and routing configuration
|
|
36
|
+
├── package.json # Dependencies and scripts
|
|
37
|
+
├── wrangler.toml # Cloudflare Workers configuration
|
|
38
|
+
└── clodo-service-manifest.json # Service metadata
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 🚀 Getting Started
|
|
42
|
+
|
|
43
|
+
### Prerequisites
|
|
44
|
+
|
|
45
|
+
- Node.js 18+
|
|
46
|
+
- Cloudflare account with Wrangler CLI
|
|
47
|
+
- Domain configured in Cloudflare
|
|
48
|
+
|
|
49
|
+
### Development
|
|
50
|
+
|
|
51
|
+
1. **Install dependencies:**
|
|
52
|
+
```bash
|
|
53
|
+
npm install
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
2. **Start development server:**
|
|
57
|
+
```bash
|
|
58
|
+
npm run dev
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
3. **Open your browser:**
|
|
62
|
+
- Local: `http://localhost:8787`
|
|
63
|
+
- Preview: The URL shown in your terminal
|
|
64
|
+
|
|
65
|
+
### Deployment
|
|
66
|
+
|
|
67
|
+
1. **Configure your environment:**
|
|
68
|
+
```bash
|
|
69
|
+
cp .env.example .env
|
|
70
|
+
# Edit .env with your Cloudflare credentials
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. **Deploy to production:**
|
|
74
|
+
```bash
|
|
75
|
+
npm run deploy
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 🔧 Customization
|
|
79
|
+
|
|
80
|
+
### Static Files
|
|
81
|
+
|
|
82
|
+
Add your static files to the `public/` directory:
|
|
83
|
+
- HTML pages
|
|
84
|
+
- CSS stylesheets
|
|
85
|
+
- JavaScript files
|
|
86
|
+
- Images, fonts, and other assets
|
|
87
|
+
|
|
88
|
+
### Styling
|
|
89
|
+
|
|
90
|
+
Edit `public/styles.css` to customize the appearance. The design uses:
|
|
91
|
+
- CSS Grid and Flexbox for layouts
|
|
92
|
+
- Modern CSS features (variables, animations)
|
|
93
|
+
- Mobile-first responsive design
|
|
94
|
+
|
|
95
|
+
### Functionality
|
|
96
|
+
|
|
97
|
+
Modify `public/app.js` to add interactive features:
|
|
98
|
+
- Form handling
|
|
99
|
+
- Dynamic content loading
|
|
100
|
+
- Client-side routing
|
|
101
|
+
- API integrations
|
|
102
|
+
|
|
103
|
+
### Worker Logic
|
|
104
|
+
|
|
105
|
+
Edit `src/worker/index.js` for server-side features:
|
|
106
|
+
- Custom routing logic
|
|
107
|
+
- Authentication middleware
|
|
108
|
+
- API proxying
|
|
109
|
+
- Response transformation
|
|
110
|
+
|
|
111
|
+
## 📊 Service Endpoints
|
|
112
|
+
|
|
113
|
+
- **`/`** - Home page
|
|
114
|
+
- **`/health`** - Health check (JSON)
|
|
115
|
+
- **`/info`** - Service information (JSON)
|
|
116
|
+
- **`/*`** - Static file serving
|
|
117
|
+
|
|
118
|
+
## 🌐 Domain Configuration
|
|
119
|
+
|
|
120
|
+
This service is configured for:
|
|
121
|
+
- **Primary Domain**: `{{DOMAIN_NAME}}`
|
|
122
|
+
- **Environment**: `{{ENVIRONMENT}}`
|
|
123
|
+
|
|
124
|
+
## 📈 Performance
|
|
125
|
+
|
|
126
|
+
- **Global CDN** - Files served from 200+ data centers
|
|
127
|
+
- **HTTP/2** - Automatic protocol optimization
|
|
128
|
+
- **Compression** - Gzip compression for text files
|
|
129
|
+
- **Caching** - Optimized cache headers
|
|
130
|
+
- **Minification** - Automatic asset optimization
|
|
131
|
+
|
|
132
|
+
## 🔒 Security
|
|
133
|
+
|
|
134
|
+
- **HTTPS Only** - Automatic SSL/TLS
|
|
135
|
+
- **CORS Support** - Configurable cross-origin policies
|
|
136
|
+
- **Security Headers** - Automatic security headers
|
|
137
|
+
- **DDoS Protection** - Cloudflare's edge protection
|
|
138
|
+
|
|
139
|
+
## 🐛 Troubleshooting
|
|
140
|
+
|
|
141
|
+
### Common Issues
|
|
142
|
+
|
|
143
|
+
1. **"No such file or directory"**
|
|
144
|
+
- Ensure all files are in the `public/` directory
|
|
145
|
+
- Check file permissions
|
|
146
|
+
|
|
147
|
+
2. **"Deployment failed"**
|
|
148
|
+
- Verify Cloudflare credentials in `.env`
|
|
149
|
+
- Check account limits and permissions
|
|
150
|
+
|
|
151
|
+
3. **"CORS errors"**
|
|
152
|
+
- Configure CORS settings in `wrangler.toml`
|
|
153
|
+
- Check origin allowlist
|
|
154
|
+
|
|
155
|
+
### Debug Mode
|
|
156
|
+
|
|
157
|
+
Enable debug logging:
|
|
158
|
+
```bash
|
|
159
|
+
LOG_LEVEL=debug npm run dev
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## 📚 Learn More
|
|
163
|
+
|
|
164
|
+
- [Clodo Framework Documentation](https://clodo.dev/docs)
|
|
165
|
+
- [Cloudflare Workers Sites](https://developers.cloudflare.com/pages/platform/direct-upload/)
|
|
166
|
+
- [Wrangler CLI](https://developers.cloudflare.com/workers/wrangler/)
|
|
167
|
+
|
|
168
|
+
## 📄 License
|
|
169
|
+
|
|
170
|
+
Generated by Clodo Framework - MIT License
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
**Generated on**: {{CURRENT_DATE}}
|
|
175
|
+
**Service Type**: static-site
|
|
176
|
+
**Framework Version**: {{FRAMEWORK_VERSION}}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{SERVICE_NAME}}",
|
|
3
|
+
"displayName": "{{SERVICE_DISPLAY_NAME}}",
|
|
4
|
+
"type": "static-site",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"framework": "Clodo Framework",
|
|
7
|
+
"generated": "{{CURRENT_DATE}}",
|
|
8
|
+
|
|
9
|
+
"description": "A static site service that serves files from the public directory using Cloudflare Workers Sites",
|
|
10
|
+
|
|
11
|
+
"features": [
|
|
12
|
+
"static-file-serving",
|
|
13
|
+
"workers-sites-integration",
|
|
14
|
+
"mime-type-detection",
|
|
15
|
+
"cache-optimization",
|
|
16
|
+
"cors-support",
|
|
17
|
+
"compression",
|
|
18
|
+
"spa-fallback",
|
|
19
|
+
"health-checks"
|
|
20
|
+
],
|
|
21
|
+
|
|
22
|
+
"configuration": {
|
|
23
|
+
"publicDir": "public",
|
|
24
|
+
"indexFile": "index.html",
|
|
25
|
+
"errorFile": "404.html",
|
|
26
|
+
"spaFallback": true,
|
|
27
|
+
"cleanUrls": true,
|
|
28
|
+
"compression": true,
|
|
29
|
+
"cors": true
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
"endpoints": {
|
|
33
|
+
"health": "/health",
|
|
34
|
+
"info": "/info",
|
|
35
|
+
"static": "/*"
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
"deployment": {
|
|
39
|
+
"platform": "cloudflare-workers",
|
|
40
|
+
"sites": true,
|
|
41
|
+
"routes": [
|
|
42
|
+
"{{DOMAIN_NAME}}/*"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
"dependencies": [
|
|
47
|
+
"@tamyla/clodo-framework",
|
|
48
|
+
"wrangler"
|
|
49
|
+
],
|
|
50
|
+
|
|
51
|
+
"scripts": {
|
|
52
|
+
"dev": "wrangler dev",
|
|
53
|
+
"deploy": "wrangler deploy",
|
|
54
|
+
"test": "jest",
|
|
55
|
+
"lint": "eslint src/",
|
|
56
|
+
"format": "prettier --write src/"
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
"files": {
|
|
60
|
+
"worker": "src/worker/index.js",
|
|
61
|
+
"domains": "src/config/domains.js",
|
|
62
|
+
"static": "public/",
|
|
63
|
+
"package": "package.json",
|
|
64
|
+
"wrangler": "wrangler.toml"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{SERVICE_NAME}}",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A Clodo Framework static-site service",
|
|
5
|
+
"main": "src/worker/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "jest",
|
|
9
|
+
"dev": "wrangler dev",
|
|
10
|
+
"deploy": "powershell .\\scripts\\deploy.ps1",
|
|
11
|
+
"setup": "powershell .\\scripts\\setup.ps1",
|
|
12
|
+
"lint": "eslint src/",
|
|
13
|
+
"format": "prettier --write src/",
|
|
14
|
+
"build": "echo 'Static site - no build step required'"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@tamyla/clodo-framework": "^1.0.0",
|
|
18
|
+
"wrangler": "^3.0.0"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/jest": "^29.5.0",
|
|
22
|
+
"eslint": "^8.54.0",
|
|
23
|
+
"jest": "^29.7.0",
|
|
24
|
+
"prettier": "^3.1.0"
|
|
25
|
+
},
|
|
26
|
+
"author": "Generated by Clodo Framework",
|
|
27
|
+
"license": "MIT"
|
|
28
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Page Not Found - {{SERVICE_DISPLAY_NAME}}</title>
|
|
7
|
+
<link rel="stylesheet" href="/styles.css">
|
|
8
|
+
<style>
|
|
9
|
+
.error-page {
|
|
10
|
+
text-align: center;
|
|
11
|
+
padding: 4rem 2rem;
|
|
12
|
+
min-height: 60vh;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
align-items: center;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.error-code {
|
|
20
|
+
font-size: 6rem;
|
|
21
|
+
font-weight: bold;
|
|
22
|
+
color: #667eea;
|
|
23
|
+
margin-bottom: 1rem;
|
|
24
|
+
opacity: 0.8;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.error-message {
|
|
28
|
+
font-size: 1.5rem;
|
|
29
|
+
margin-bottom: 2rem;
|
|
30
|
+
color: #666;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.error-actions {
|
|
34
|
+
display: flex;
|
|
35
|
+
gap: 1rem;
|
|
36
|
+
flex-wrap: wrap;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.error-actions a {
|
|
41
|
+
display: inline-block;
|
|
42
|
+
padding: 0.75rem 1.5rem;
|
|
43
|
+
background: #667eea;
|
|
44
|
+
color: white;
|
|
45
|
+
text-decoration: none;
|
|
46
|
+
border-radius: 4px;
|
|
47
|
+
transition: background-color 0.3s;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.error-actions a:hover {
|
|
51
|
+
background: #5a67d8;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.error-actions a.secondary {
|
|
55
|
+
background: #e2e8f0;
|
|
56
|
+
color: #4a5568;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.error-actions a.secondary:hover {
|
|
60
|
+
background: #cbd5e0;
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
63
|
+
</head>
|
|
64
|
+
<body>
|
|
65
|
+
<div class="error-page">
|
|
66
|
+
<div class="error-code">404</div>
|
|
67
|
+
<h1 class="error-message">Page Not Found</h1>
|
|
68
|
+
<p>The page you're looking for doesn't exist on {{SERVICE_DISPLAY_NAME}}.</p>
|
|
69
|
+
|
|
70
|
+
<div class="error-actions">
|
|
71
|
+
<a href="/">Go Home</a>
|
|
72
|
+
<a href="javascript:history.back()" class="secondary">Go Back</a>
|
|
73
|
+
<a href="/contact" class="secondary">Contact Us</a>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<script>
|
|
78
|
+
// Log 404 errors for analytics
|
|
79
|
+
console.log('404 Error:', {
|
|
80
|
+
url: window.location.href,
|
|
81
|
+
referrer: document.referrer,
|
|
82
|
+
userAgent: navigator.userAgent,
|
|
83
|
+
timestamp: new Date().toISOString()
|
|
84
|
+
});
|
|
85
|
+
</script>
|
|
86
|
+
</body>
|
|
87
|
+
</html>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// App JavaScript for {{SERVICE_DISPLAY_NAME}}
|
|
2
|
+
// Generated by Clodo Framework
|
|
3
|
+
|
|
4
|
+
document.addEventListener('DOMContentLoaded', function() {
|
|
5
|
+
// Update environment info
|
|
6
|
+
fetch('/info')
|
|
7
|
+
.then(response => response.json())
|
|
8
|
+
.then(data => {
|
|
9
|
+
const envElement = document.getElementById('environment');
|
|
10
|
+
if (envElement) {
|
|
11
|
+
envElement.textContent = data.environment;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Add some dynamic content based on service info
|
|
15
|
+
console.log('Service Info:', data);
|
|
16
|
+
})
|
|
17
|
+
.catch(error => {
|
|
18
|
+
console.error('Failed to load service info:', error);
|
|
19
|
+
const envElement = document.getElementById('environment');
|
|
20
|
+
if (envElement) {
|
|
21
|
+
envElement.textContent = 'unknown';
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Add click tracking to navigation
|
|
26
|
+
const navLinks = document.querySelectorAll('nav a');
|
|
27
|
+
navLinks.forEach(link => {
|
|
28
|
+
link.addEventListener('click', function(e) {
|
|
29
|
+
console.log('Navigation:', this.textContent, this.href);
|
|
30
|
+
|
|
31
|
+
// For SPA-like behavior, you could prevent default and handle routing here
|
|
32
|
+
// e.preventDefault();
|
|
33
|
+
// handleRoute(this.href);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// Add some interactive features
|
|
38
|
+
const hero = document.getElementById('hero');
|
|
39
|
+
if (hero) {
|
|
40
|
+
hero.addEventListener('click', function() {
|
|
41
|
+
this.style.transform = 'scale(1.02)';
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
this.style.transform = 'scale(1)';
|
|
44
|
+
}, 150);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Service worker registration (if you add one later)
|
|
49
|
+
if ('serviceWorker' in navigator) {
|
|
50
|
+
// navigator.serviceWorker.register('/sw.js')
|
|
51
|
+
// .then(registration => console.log('SW registered'))
|
|
52
|
+
// .catch(error => console.log('SW registration failed'));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Utility functions
|
|
57
|
+
function handleRoute(url) {
|
|
58
|
+
// Implement client-side routing if needed
|
|
59
|
+
console.log('Routing to:', url);
|
|
60
|
+
// You could load content dynamically here
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function showNotification(message, type = 'info') {
|
|
64
|
+
// Simple notification system
|
|
65
|
+
const notification = document.createElement('div');
|
|
66
|
+
notification.textContent = message;
|
|
67
|
+
notification.style.cssText = `
|
|
68
|
+
position: fixed;
|
|
69
|
+
top: 20px;
|
|
70
|
+
right: 20px;
|
|
71
|
+
padding: 1rem;
|
|
72
|
+
background: ${type === 'error' ? '#ff6b6b' : '#51cf66'};
|
|
73
|
+
color: white;
|
|
74
|
+
border-radius: 4px;
|
|
75
|
+
z-index: 1000;
|
|
76
|
+
animation: slideIn 0.3s ease-out;
|
|
77
|
+
`;
|
|
78
|
+
|
|
79
|
+
document.body.appendChild(notification);
|
|
80
|
+
|
|
81
|
+
setTimeout(() => {
|
|
82
|
+
notification.style.animation = 'slideOut 0.3s ease-out';
|
|
83
|
+
setTimeout(() => notification.remove(), 300);
|
|
84
|
+
}, 3000);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Add some CSS animations
|
|
88
|
+
const style = document.createElement('style');
|
|
89
|
+
style.textContent = `
|
|
90
|
+
@keyframes slideIn {
|
|
91
|
+
from { transform: translateX(100%); opacity: 0; }
|
|
92
|
+
to { transform: translateX(0); opacity: 1; }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@keyframes slideOut {
|
|
96
|
+
from { transform: translateX(0); opacity: 1; }
|
|
97
|
+
to { transform: translateX(100%); opacity: 0; }
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
document.head.appendChild(style);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>{{SERVICE_DISPLAY_NAME}}</title>
|
|
7
|
+
<meta name="description" content="A static site powered by Clodo Framework">
|
|
8
|
+
<link rel="stylesheet" href="/styles.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<header>
|
|
12
|
+
<h1>Welcome to {{SERVICE_DISPLAY_NAME}}</h1>
|
|
13
|
+
<nav>
|
|
14
|
+
<a href="/">Home</a>
|
|
15
|
+
<a href="/about">About</a>
|
|
16
|
+
<a href="/contact">Contact</a>
|
|
17
|
+
</nav>
|
|
18
|
+
</header>
|
|
19
|
+
|
|
20
|
+
<main>
|
|
21
|
+
<section id="hero">
|
|
22
|
+
<h2>Your Static Site is Live!</h2>
|
|
23
|
+
<p>This site is powered by <strong>Clodo Framework</strong> and served via Cloudflare Workers Sites.</p>
|
|
24
|
+
<p>Service: {{SERVICE_NAME}}<br>
|
|
25
|
+
Environment: <span id="environment">loading...</span><br>
|
|
26
|
+
Domain: {{DOMAIN_NAME}}</p>
|
|
27
|
+
</section>
|
|
28
|
+
|
|
29
|
+
<section id="features">
|
|
30
|
+
<h3>Features</h3>
|
|
31
|
+
<ul>
|
|
32
|
+
<li>⚡ Fast static file serving</li>
|
|
33
|
+
<li>🌐 Global CDN distribution</li>
|
|
34
|
+
<li>🔒 HTTPS by default</li>
|
|
35
|
+
<li>📱 Mobile responsive</li>
|
|
36
|
+
<li>🤖 SEO optimized</li>
|
|
37
|
+
</ul>
|
|
38
|
+
</section>
|
|
39
|
+
</main>
|
|
40
|
+
|
|
41
|
+
<footer>
|
|
42
|
+
<p>© {{CURRENT_YEAR}} {{SERVICE_DISPLAY_NAME}}. Powered by Clodo Framework.</p>
|
|
43
|
+
<p><a href="/health">Health Check</a> | <a href="/info">Service Info</a></p>
|
|
44
|
+
</footer>
|
|
45
|
+
|
|
46
|
+
<script src="/app.js"></script>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|