@itayzrihan/create-box-app 1.0.0

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/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # create-box-app
2
+
3
+ > Scaffold a new BOX Framework project in seconds
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npx create-box-app my-project
9
+ cd my-project
10
+ npm install
11
+ npm run dev
12
+ ```
13
+
14
+ That's it! Your BOX app is ready at `http://localhost:3000`
15
+
16
+ ## What's Inside
17
+
18
+ The scaffolder creates a minimal BOX project with:
19
+
20
+ - ✅ Pre-configured `.vscode` settings for HTML syntax highlighting
21
+ - ✅ Sample `main.box` component demonstrating the framework
22
+ - ✅ Example API endpoint (`api+hello.box`)
23
+ - ✅ Ready-to-use npm scripts (`dev`, `build`, `start`)
24
+ - ✅ Clean folder structure following BOX conventions
25
+
26
+ ## Features
27
+
28
+ - **Zero Setup**: No global installs. Just `npx` and go.
29
+ - **Fast**: Generates a working project in under 5 seconds
30
+ - **Minimal**: Only essential files, no bloat
31
+ - **Beautiful**: Includes a stylish welcome component
32
+
33
+ ## Commands
34
+
35
+ Once your project is created:
36
+
37
+ ```bash
38
+ npm run dev # Start dev server with HMR
39
+ npm run build # Build for production
40
+ npm start # Run production server
41
+ ```
42
+
43
+ ## Learn More
44
+
45
+ - [BOX Framework Docs](https://github.com/itayzrihan/box)
46
+ - [GitHub Repository](https://github.com/itayzrihan/box)
47
+
48
+ ## License
49
+
50
+ MIT © Itay Zrihan
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * create-box-app
5
+ * Scaffolding CLI for BOX Framework
6
+ * Usage: npx create-box-app my-project
7
+ */
8
+
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ const projectName = process.argv[2] || 'my-box-app';
13
+ const targetDir = path.join(process.cwd(), projectName);
14
+ const templateDir = path.join(__dirname, '..', 'template');
15
+
16
+ async function init() {
17
+ console.log(`\n╔══════════════════════════════════════════════════════════════╗
18
+ ║ 📦 BOX Framework Setup ║
19
+ ╚══════════════════════════════════════════════════════════════╝\n`);
20
+
21
+ console.log(`📁 Creating your BOX project: ${projectName}\n`);
22
+
23
+ // Check if folder already exists
24
+ if (fs.existsSync(targetDir)) {
25
+ console.error(`❌ Folder already exists: ${projectName}`);
26
+ process.exit(1);
27
+ }
28
+
29
+ try {
30
+ // Create directory
31
+ fs.mkdirSync(targetDir, { recursive: true });
32
+
33
+ // Copy template directory recursively
34
+ copyDir(templateDir, targetDir);
35
+
36
+ // Customize package.json
37
+ const pkgPath = path.join(targetDir, 'package.json');
38
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
39
+ pkg.name = projectName;
40
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
41
+
42
+ console.log(`✅ Project created successfully!\n`);
43
+ console.log(`📋 Next steps:\n`);
44
+ console.log(` 1. Navigate to your project:`);
45
+ console.log(` cd ${projectName}\n`);
46
+ console.log(` 2. Install dependencies:`);
47
+ console.log(` npm install\n`);
48
+ console.log(` 3. Start the dev server:`);
49
+ console.log(` npm run dev\n`);
50
+ console.log(` 4. Open in VS Code:`);
51
+ console.log(` code .\n`);
52
+ console.log(`📚 Learn more: https://github.com/itayzrihan/box\n`);
53
+ console.log(`Happy BOXing! 🚀\n`);
54
+ } catch (error) {
55
+ console.error(`❌ Error: ${error.message}`);
56
+ process.exit(1);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Recursively copy directory
62
+ */
63
+ function copyDir(src, dest) {
64
+ if (!fs.existsSync(dest)) {
65
+ fs.mkdirSync(dest, { recursive: true });
66
+ }
67
+
68
+ const files = fs.readdirSync(src);
69
+
70
+ files.forEach(file => {
71
+ const srcPath = path.join(src, file);
72
+ const destPath = path.join(dest, file);
73
+ const stat = fs.statSync(srcPath);
74
+
75
+ if (stat.isDirectory()) {
76
+ copyDir(srcPath, destPath);
77
+ } else {
78
+ fs.copyFileSync(srcPath, destPath);
79
+ }
80
+ });
81
+ }
82
+
83
+ init();
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@itayzrihan/create-box-app",
3
+ "version": "1.0.0",
4
+ "description": "Create a new BOX Framework application with one command",
5
+ "main": "bin/create-box-app.js",
6
+ "bin": {
7
+ "create-box-app": "./bin/create-box-app.js"
8
+ },
9
+ "files": [
10
+ "bin/",
11
+ "template/",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "test": "echo \"Error: no test specified\" && exit 1"
16
+ },
17
+ "keywords": [
18
+ "box",
19
+ "framework",
20
+ "scaffolding",
21
+ "cli",
22
+ "boilerplate",
23
+ "template",
24
+ "generator",
25
+ "create",
26
+ "vanilla",
27
+ "zero-dependency"
28
+ ],
29
+ "author": "Itay Zrihan <itayzrihan@github.com>",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/itayzrihan/box.git"
34
+ },
35
+ "bugs": {
36
+ "url": "https://github.com/itayzrihan/box/issues"
37
+ },
38
+ "homepage": "https://github.com/itayzrihan/box#readme",
39
+ "engines": {
40
+ "node": ">=16.0.0"
41
+ }
42
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "files.associations": {
3
+ "*.box": "html"
4
+ },
5
+ "emmet.includeLanguages": {
6
+ "box": "html"
7
+ },
8
+ "editor.quickSuggestions": {
9
+ "strings": true
10
+ }
11
+ }
@@ -0,0 +1,12 @@
1
+ # BOX Project
2
+
3
+ Auto-generated BOX Framework project. Edit your `.box` files in the `src/` folder and run `npm run dev` to see live updates!
4
+
5
+ ## Quick Start
6
+
7
+ ```bash
8
+ npm install
9
+ npm run dev
10
+ ```
11
+
12
+ Visit http://localhost:3000
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "my-box-app",
3
+ "version": "1.0.0",
4
+ "description": "A BOX Framework application",
5
+ "scripts": {
6
+ "build": "box build",
7
+ "dev": "box dev",
8
+ "start": "node dist/server.js"
9
+ },
10
+ "keywords": [
11
+ "box",
12
+ "framework"
13
+ ],
14
+ "author": "",
15
+ "license": "MIT",
16
+ "devDependencies": {
17
+ "box-framework": "^1.0.0"
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ /* BOX_CONFIG: { "method": "GET", "auth": false } */
2
+
3
+ export default async (req, res, context) => {
4
+ try {
5
+ const greeting = {
6
+ message: "Hello from BOX API!",
7
+ timestamp: new Date().toISOString(),
8
+ framework: "BOX Framework v1.0.0"
9
+ };
10
+
11
+ return { status: 200, data: greeting };
12
+ } catch (err) {
13
+ return { status: 500, error: "Server error" };
14
+ }
15
+ };
@@ -0,0 +1,17 @@
1
+ <style>
2
+ .app {
3
+ min-height: 100vh;
4
+ display: flex;
5
+ flex-direction: column;
6
+ }
7
+ </style>
8
+
9
+ <template>
10
+ <div class="app">
11
+ <include src="./welcome.box" />
12
+ </div>
13
+ </template>
14
+
15
+ <script>
16
+ console.log('📦 BOX App initialized!');
17
+ </script>
@@ -0,0 +1,82 @@
1
+ <style>
2
+ .welcome {
3
+ text-align: center;
4
+ padding: 3rem 2rem;
5
+ min-height: 100vh;
6
+ display: flex;
7
+ flex-direction: column;
8
+ justify-content: center;
9
+ align-items: center;
10
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
11
+ color: white;
12
+ }
13
+
14
+ .welcome-title {
15
+ font-size: 3.5rem;
16
+ font-weight: bold;
17
+ margin-bottom: 1rem;
18
+ text-shadow: 0 2px 10px rgba(0,0,0,0.2);
19
+ }
20
+
21
+ .welcome-subtitle {
22
+ font-size: 1.25rem;
23
+ margin-bottom: 2rem;
24
+ opacity: 0.95;
25
+ }
26
+
27
+ .welcome-box {
28
+ background: rgba(255, 255, 255, 0.1);
29
+ backdrop-filter: blur(10px);
30
+ padding: 2rem;
31
+ border-radius: 16px;
32
+ border: 1px solid rgba(255, 255, 255, 0.2);
33
+ max-width: 600px;
34
+ margin: 2rem 0;
35
+ }
36
+
37
+ .welcome-text {
38
+ font-size: 1rem;
39
+ line-height: 1.6;
40
+ }
41
+
42
+ .welcome-link {
43
+ display: inline-block;
44
+ margin-top: 1.5rem;
45
+ padding: 0.75rem 1.5rem;
46
+ background: white;
47
+ color: #667eea;
48
+ text-decoration: none;
49
+ border-radius: 8px;
50
+ font-weight: 600;
51
+ transition: transform 0.2s;
52
+ }
53
+
54
+ .welcome-link:hover {
55
+ transform: scale(1.05);
56
+ }
57
+ </style>
58
+
59
+ <template>
60
+ <div class="welcome">
61
+ <h1 class="welcome-title">Welcome to BOX 📦</h1>
62
+ <p class="welcome-subtitle">A zero-dependency, full-stack framework</p>
63
+
64
+ <div class="welcome-box">
65
+ <p class="welcome-text">
66
+ Your BOX project is ready! Edit <strong>src/main.box</strong> to get started.
67
+ </p>
68
+ <p class="welcome-text">
69
+ This welcome component demonstrates the power of reactive state management.
70
+ </p>
71
+ <a href="https://github.com/itayzrihan/box" class="welcome-link">
72
+ Learn More →
73
+ </a>
74
+ </div>
75
+ </div>
76
+ </template>
77
+
78
+ <script>
79
+ console.log('🎉 Welcome component loaded!');
80
+ console.log('💡 Tip: Run "npm run dev" to start the dev server');
81
+ console.log('📚 Read the docs: https://github.com/itayzrihan/box#readme');
82
+ </script>