Skip to content

Commit 71dd9e8

Browse files
committed
add instructions for pack, unpack, studio cmds
1 parent b21b623 commit 71dd9e8

File tree

1 file changed

+122
-8
lines changed

1 file changed

+122
-8
lines changed

packages/cli/README.md

Lines changed: 122 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
A command-line tool for scaffolding Skuilder course applications.
44

5+
A Skuilder course consists of:
6+
- a Vue.js application
7+
- a data layer (static or dynamic)
8+
9+
Static data-layer courses are self-contained as JSON files, and can be deployed as a static site.
10+
11+
Dynamic data-layer courses are served from a CouchDB database and require a more involved setup ⚠️ **which is not currently well documented** ⚠️.
12+
513
## Installation
614

715
Install globally via npm:
@@ -16,9 +24,11 @@ Or use npx to run without installing:
1624
npx skuilder init my-course
1725
```
1826

19-
## Usage
27+
## Commands
28+
29+
### Project Initialization
2030

21-
### Create a new project
31+
#### Create a new project
2232

2333
```bash
2434
skuilder init my-anatomy-course
@@ -29,9 +39,9 @@ This will start an interactive prompt to configure your project:
2939
- Data layer type (static or dynamic)
3040
- CouchDB connection details (for dynamic)
3141
- Theme selection
32-
- Course ID to import (optional)
42+
- Course ID to import (optional import from a live CouchDB server)
3343

34-
### Non-interactive mode
44+
#### Non-interactive mode
3545

3646
```bash
3747
skuilder init physics-101 \
@@ -40,7 +50,7 @@ skuilder init physics-101 \
4050
--no-interactive
4151
```
4252

43-
### Dynamic data layer with CouchDB
53+
#### Dynamic data layer with CouchDB
4454

4555
```bash
4656
skuilder init biology-course \
@@ -50,14 +60,113 @@ skuilder init biology-course \
5060
--theme=medical
5161
```
5262

53-
## Command Options
63+
#### Command Options
5464

5565
- `--data-layer <type>` - Choose data layer: `static` or `dynamic` (default: dynamic)
5666
- `--theme <name>` - Select theme: `default`, `medical`, `educational`, or `corporate` (default: default)
5767
- `--no-interactive` - Skip interactive prompts and use provided options
5868
- `--couchdb-url <url>` - CouchDB server URL (required for dynamic data layer)
5969
- `--course-id <id>` - Course ID to import from CouchDB (optional)
6070

71+
### Studio Mode (Content Editing)
72+
73+
Studio mode provides a complete visual editing environment for static courses:
74+
75+
```bash
76+
skuilder studio # Launch in current directory
77+
skuilder studio ./my-course # Launch against specific packed course directory
78+
skuilder studio --port 6000 # Use custom CouchDB port
79+
skuilder studio --no-browser # Don't auto-open browser
80+
```
81+
82+
#### What Studio Mode Does
83+
84+
Studio mode creates a full editing environment by starting multiple services:
85+
86+
1. **CouchDB Instance** (Docker container on port 5985+)
87+
- Temporary database for editing course content
88+
- Automatically loads your static course data
89+
90+
2. **Express API Server** (port 3001+)
91+
- Handles database operations and file writes
92+
- Provides REST API for the web editor
93+
94+
3. **Studio Web Interface** (port 7174+)
95+
- Visual course editor with Vue.js
96+
- Create/edit cards, manage tags, bulk import
97+
- Live preview of changes
98+
99+
#### Studio Workflow
100+
101+
1. **Load Course Data**: Unpacks your `public/static-courses/` JSON files into temporary CouchDB
102+
2. **Visual Editing**: Use the web interface to modify course content
103+
3. **Save Changes**: Click "Flush to Static" to write changes back to your course files
104+
4. **Important**: Studio mode **overwrites** your source files - backup before major edits
105+
106+
#### Requirements
107+
108+
- **Docker**: Required for CouchDB instance
109+
- **Static Course Project**: Valid package.json with vue-skuilder dependencies
110+
- **Course Data**: Existing content in `public/static-courses/` directory
111+
112+
#### Studio Mode vs Regular Development
113+
114+
| Feature | Regular Dev (`npm run dev`) | Studio Mode (`skuilder studio`) |
115+
|---------|----------------------------|--------------------------------|
116+
| Purpose | View/test course | Edit course content |
117+
| Data Source | Static JSON files | Temporary CouchDB + Web Editor |
118+
| Editing | Manual JSON editing | Visual web interface |
119+
| Services | Just Vite dev server | CouchDB + Express + Studio UI |
120+
| File Changes | Manual | Automatic via "Flush to Static" |
121+
122+
### Course Data Management
123+
124+
#### Pack/Unpack Commands
125+
126+
For advanced users working with CouchDB data:
127+
128+
```bash
129+
# Convert CouchDB course to static files
130+
skuilder pack my-course-id \
131+
--server http://localhost:5984 \
132+
--username admin \
133+
--password secret \
134+
--output ./exported-course
135+
136+
# Convert static files to CouchDB course
137+
skuilder unpack ./course-data \
138+
--server http://localhost:5984 \
139+
--username admin \
140+
--password secret \
141+
--database coursedb-imported \
142+
--validate
143+
```
144+
145+
**Pack Command Options:**
146+
- `--server <url>` - CouchDB server URL (default: http://localhost:5984)
147+
- `--username <user>` - CouchDB username for authentication
148+
- `--password <pass>` - CouchDB password for authentication
149+
- `--output <dir>` - Output directory for static files (default: ./static-courses)
150+
- `--chunk-size <size>` - Documents per chunk for large courses (default: 1000)
151+
- `--no-attachments` - Skip downloading course attachments
152+
153+
**Unpack Command Options:**
154+
- `--server <url>` - CouchDB server URL (default: http://localhost:5984)
155+
- `--username <user>` - CouchDB username for authentication
156+
- `--password <pass>` - CouchDB password for authentication
157+
- `--database <name>` - Target database name (auto-generated if not provided)
158+
- `--as <name>` - Custom name for the unpacked course
159+
- `--chunk-size <size>` - Documents per batch upload (default: 100)
160+
- `--validate` - Run migration validation after unpack
161+
- `--cleanup-on-error` - Remove database if migration fails
162+
163+
**Use Cases:**
164+
- **Studio Mode Internal**: These commands power studio mode's load/save operations
165+
- **Migration**: Move courses between static and dynamic deployments
166+
- **Backup/Restore**: Export course data for safekeeping or transfer
167+
- **CI/CD Workflows**: Automate course deployment and synchronization
168+
- **Development**: Test with production course data locally
169+
61170
## Generated Project Structure
62171

63172
```
@@ -138,8 +247,13 @@ node packages/cli/dist/cli.js init test-project
138247

139248
## Requirements
140249

141-
- Node.js 18.0.0 or higher
142-
- npm or yarn package manager
250+
### System Requirements
251+
252+
- **Node.js 18.0.0 or higher**
253+
- **npm or yarn package manager**
254+
- **Docker** (required for studio mode only)
255+
- Used to run temporary CouchDB instances
256+
- Not needed for basic project creation or static course viewing
143257

144258
## Dependencies
145259

0 commit comments

Comments
 (0)