create-brightsy-component-lib 0.1.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 +201 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1105 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# create-brightsy-component-lib
|
|
2
|
+
|
|
3
|
+
CLI tool to scaffold and deploy Brightsy component library projects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Use directly with npx (recommended)
|
|
9
|
+
npx create-brightsy-component-lib
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
12
|
+
npm install -g create-brightsy-component-lib
|
|
13
|
+
|
|
14
|
+
# Or install locally in a project
|
|
15
|
+
npm install --save-dev create-brightsy-component-lib
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Create a Project
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Create a new component library
|
|
24
|
+
npx create-brightsy-component-lib my-components
|
|
25
|
+
|
|
26
|
+
# Create a custom application
|
|
27
|
+
npx create-brightsy-component-lib my-app --template app
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Authentication
|
|
31
|
+
|
|
32
|
+
The CLI uses OAuth for secure authentication (no API keys needed):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Login - opens browser for OAuth flow
|
|
36
|
+
npx create-brightsy-component-lib login
|
|
37
|
+
|
|
38
|
+
# Check who you're logged in as
|
|
39
|
+
npx create-brightsy-component-lib whoami
|
|
40
|
+
|
|
41
|
+
# Logout
|
|
42
|
+
npx create-brightsy-component-lib logout
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Credentials are stored securely in `~/.brightsy/config.json` with restricted permissions.
|
|
46
|
+
|
|
47
|
+
### Deploy to Brightsy
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Deploy (will prompt for login if needed)
|
|
51
|
+
npx create-brightsy-component-lib deploy
|
|
52
|
+
|
|
53
|
+
# Deploy with options
|
|
54
|
+
npx create-brightsy-component-lib deploy \
|
|
55
|
+
--env-name production \
|
|
56
|
+
--version 1.0.0
|
|
57
|
+
|
|
58
|
+
# Deploy and register with existing library
|
|
59
|
+
npx create-brightsy-component-lib deploy \
|
|
60
|
+
--lib-id your-library-uuid \
|
|
61
|
+
--env-name production
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Commands
|
|
65
|
+
|
|
66
|
+
### `login`
|
|
67
|
+
|
|
68
|
+
Authenticate with Brightsy using OAuth 2.1 with PKCE:
|
|
69
|
+
- Opens your browser for secure login
|
|
70
|
+
- Stores tokens locally
|
|
71
|
+
- Supports multiple accounts (prompts if you have more than one)
|
|
72
|
+
|
|
73
|
+
### `logout`
|
|
74
|
+
|
|
75
|
+
Remove stored credentials.
|
|
76
|
+
|
|
77
|
+
### `whoami`
|
|
78
|
+
|
|
79
|
+
Show current authenticated account and token status.
|
|
80
|
+
|
|
81
|
+
### `deploy`
|
|
82
|
+
|
|
83
|
+
Deploy the library:
|
|
84
|
+
1. Builds the library (if not already built)
|
|
85
|
+
2. Uploads to Brightsy file storage
|
|
86
|
+
3. Optionally registers the environment with a library
|
|
87
|
+
|
|
88
|
+
| Option | Description | Default |
|
|
89
|
+
|--------|-------------|---------|
|
|
90
|
+
| `-e, --endpoint` | API endpoint | `https://brightsy.ai` |
|
|
91
|
+
| `-l, --lib-id` | Library ID to register environment | (optional) |
|
|
92
|
+
| `-n, --env-name` | Environment name | `production` |
|
|
93
|
+
| `-v, --version` | Version to deploy | From `package.json` |
|
|
94
|
+
|
|
95
|
+
### Deployment Flow
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Login (OAuth - one time)
|
|
99
|
+
↓
|
|
100
|
+
Build library (npm run build)
|
|
101
|
+
↓
|
|
102
|
+
Upload to Brightsy Files (libs/{name}/{version}/index.js)
|
|
103
|
+
↓
|
|
104
|
+
Get public URL (https://files.brightsy.ai/...)
|
|
105
|
+
↓
|
|
106
|
+
(Optional) Register library environment with URL
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Templates
|
|
110
|
+
|
|
111
|
+
### Component Library (default)
|
|
112
|
+
|
|
113
|
+
Creates a project with:
|
|
114
|
+
- Multiple components for the page builder
|
|
115
|
+
- Example HelloWorld component
|
|
116
|
+
- Puck configurations
|
|
117
|
+
- LLM instructions
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
my-components/
|
|
121
|
+
src/
|
|
122
|
+
components/
|
|
123
|
+
HelloWorld/
|
|
124
|
+
HelloWorld.tsx
|
|
125
|
+
HelloWorld.config.ts
|
|
126
|
+
HelloWorld.llm.ts
|
|
127
|
+
index.ts
|
|
128
|
+
index.tsx
|
|
129
|
+
vite.config.ts
|
|
130
|
+
tsconfig.json
|
|
131
|
+
package.json
|
|
132
|
+
README.md
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Custom Application
|
|
136
|
+
|
|
137
|
+
Creates a project with:
|
|
138
|
+
- Single App component that IS the entire application
|
|
139
|
+
- Handles its own routing and state
|
|
140
|
+
- Minimal page builder config
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
my-app/
|
|
144
|
+
src/
|
|
145
|
+
App/
|
|
146
|
+
App.tsx
|
|
147
|
+
App.config.ts
|
|
148
|
+
App.llm.ts
|
|
149
|
+
index.ts
|
|
150
|
+
index.tsx
|
|
151
|
+
vite.config.ts
|
|
152
|
+
tsconfig.json
|
|
153
|
+
package.json
|
|
154
|
+
README.md
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
After scaffolding:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
cd my-components
|
|
163
|
+
npm install
|
|
164
|
+
npm run dev
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Building
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
npm run build
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Output goes to `dist/` ready for deployment.
|
|
174
|
+
|
|
175
|
+
## Complete Workflow
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
# 1. Create the project
|
|
179
|
+
npx create-brightsy-component-lib my-components
|
|
180
|
+
cd my-components
|
|
181
|
+
npm install
|
|
182
|
+
|
|
183
|
+
# 2. Develop components
|
|
184
|
+
npm run dev
|
|
185
|
+
|
|
186
|
+
# 3. Login (one-time)
|
|
187
|
+
npx create-brightsy-component-lib login
|
|
188
|
+
|
|
189
|
+
# 4. Build and deploy
|
|
190
|
+
npm run build
|
|
191
|
+
npx create-brightsy-component-lib deploy
|
|
192
|
+
|
|
193
|
+
# 5. Register via MCP (if not using --lib-id)
|
|
194
|
+
# MCP: create_lib --name "My Components"
|
|
195
|
+
# MCP: create_lib_env --lib_id xxx --name production --module_url <returned-url>
|
|
196
|
+
# MCP: assign_lib_to_page_type --page_type_id xxx --lib_id xxx
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* create-brightsy-component-lib
|
|
4
|
+
*
|
|
5
|
+
* CLI tool to scaffold and deploy Brightsy component library projects.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* npx create-brightsy-component-lib my-components
|
|
9
|
+
* npx create-brightsy-component-lib my-components --template app
|
|
10
|
+
* npx create-brightsy-component-lib login
|
|
11
|
+
* npx create-brightsy-component-lib deploy
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG"}
|