@fugood/bricks-ctor 2.24.0-beta.40
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/compile/action-name-map.ts +988 -0
- package/compile/index.ts +1245 -0
- package/compile/util.ts +358 -0
- package/index.ts +6 -0
- package/package.json +28 -0
- package/skills/bricks-design/LICENSE.txt +180 -0
- package/skills/bricks-design/SKILL.md +66 -0
- package/skills/bricks-project/SKILL.md +32 -0
- package/skills/bricks-project/rules/animation.md +159 -0
- package/skills/bricks-project/rules/architecture-patterns.md +69 -0
- package/skills/bricks-project/rules/automations.md +221 -0
- package/skills/bricks-project/rules/buttress.md +156 -0
- package/skills/bricks-project/rules/data-calculation.md +208 -0
- package/skills/bricks-project/rules/local-sync.md +129 -0
- package/skills/bricks-project/rules/media-flow.md +158 -0
- package/skills/bricks-project/rules/remote-data-bank.md +196 -0
- package/skills/bricks-project/rules/standby-transition.md +124 -0
- package/skills/rive-marketplace/SKILL.md +99 -0
- package/tools/deploy.ts +151 -0
- package/tools/icons/.gitattributes +1 -0
- package/tools/icons/fa6pro-glyphmap.json +4686 -0
- package/tools/icons/fa6pro-meta.json +3671 -0
- package/tools/mcp-server.ts +28 -0
- package/tools/mcp-tools/compile.ts +91 -0
- package/tools/mcp-tools/huggingface.ts +762 -0
- package/tools/mcp-tools/icons.ts +70 -0
- package/tools/mcp-tools/lottie.ts +102 -0
- package/tools/mcp-tools/media.ts +110 -0
- package/tools/postinstall.ts +229 -0
- package/tools/preview-main.mjs +293 -0
- package/tools/preview.ts +143 -0
- package/tools/pull.ts +116 -0
- package/tsconfig.json +16 -0
- package/types/animation.ts +100 -0
- package/types/automation.ts +235 -0
- package/types/brick-base.ts +80 -0
- package/types/bricks/Camera.ts +246 -0
- package/types/bricks/Chart.ts +372 -0
- package/types/bricks/GenerativeMedia.ts +276 -0
- package/types/bricks/Icon.ts +98 -0
- package/types/bricks/Image.ts +114 -0
- package/types/bricks/Items.ts +476 -0
- package/types/bricks/Lottie.ts +168 -0
- package/types/bricks/Maps.ts +262 -0
- package/types/bricks/QrCode.ts +117 -0
- package/types/bricks/Rect.ts +150 -0
- package/types/bricks/RichText.ts +128 -0
- package/types/bricks/Rive.ts +220 -0
- package/types/bricks/Slideshow.ts +201 -0
- package/types/bricks/Svg.ts +99 -0
- package/types/bricks/Text.ts +148 -0
- package/types/bricks/TextInput.ts +242 -0
- package/types/bricks/Video.ts +175 -0
- package/types/bricks/VideoStreaming.ts +112 -0
- package/types/bricks/WebRtcStream.ts +65 -0
- package/types/bricks/WebView.ts +168 -0
- package/types/bricks/index.ts +21 -0
- package/types/canvas.ts +82 -0
- package/types/common.ts +144 -0
- package/types/data-calc-command.ts +7005 -0
- package/types/data-calc-script.ts +21 -0
- package/types/data-calc.ts +11 -0
- package/types/data.ts +95 -0
- package/types/generators/AlarmClock.ts +110 -0
- package/types/generators/Assistant.ts +621 -0
- package/types/generators/BleCentral.ts +247 -0
- package/types/generators/BlePeripheral.ts +208 -0
- package/types/generators/CanvasMap.ts +74 -0
- package/types/generators/CastlesPay.ts +87 -0
- package/types/generators/DataBank.ts +160 -0
- package/types/generators/File.ts +432 -0
- package/types/generators/GraphQl.ts +132 -0
- package/types/generators/Http.ts +222 -0
- package/types/generators/HttpServer.ts +176 -0
- package/types/generators/Information.ts +103 -0
- package/types/generators/Intent.ts +168 -0
- package/types/generators/Iterator.ts +108 -0
- package/types/generators/Keyboard.ts +105 -0
- package/types/generators/LlmAnthropicCompat.ts +212 -0
- package/types/generators/LlmAppleBuiltin.ts +159 -0
- package/types/generators/LlmGgml.ts +861 -0
- package/types/generators/LlmMediaTekNeuroPilot.ts +235 -0
- package/types/generators/LlmMlx.ts +227 -0
- package/types/generators/LlmOnnx.ts +213 -0
- package/types/generators/LlmOpenAiCompat.ts +244 -0
- package/types/generators/LlmQualcommAiEngine.ts +247 -0
- package/types/generators/Mcp.ts +637 -0
- package/types/generators/McpServer.ts +289 -0
- package/types/generators/MediaFlow.ts +170 -0
- package/types/generators/MqttBroker.ts +141 -0
- package/types/generators/MqttClient.ts +141 -0
- package/types/generators/Question.ts +408 -0
- package/types/generators/RealtimeTranscription.ts +279 -0
- package/types/generators/RerankerGgml.ts +191 -0
- package/types/generators/SerialPort.ts +151 -0
- package/types/generators/SoundPlayer.ts +94 -0
- package/types/generators/SoundRecorder.ts +130 -0
- package/types/generators/SpeechToTextGgml.ts +415 -0
- package/types/generators/SpeechToTextOnnx.ts +236 -0
- package/types/generators/SpeechToTextPlatform.ts +85 -0
- package/types/generators/SqLite.ts +159 -0
- package/types/generators/Step.ts +107 -0
- package/types/generators/SttAppleBuiltin.ts +130 -0
- package/types/generators/Tcp.ts +126 -0
- package/types/generators/TcpServer.ts +147 -0
- package/types/generators/TextToSpeechAppleBuiltin.ts +127 -0
- package/types/generators/TextToSpeechGgml.ts +221 -0
- package/types/generators/TextToSpeechOnnx.ts +178 -0
- package/types/generators/TextToSpeechOpenAiLike.ts +121 -0
- package/types/generators/ThermalPrinter.ts +191 -0
- package/types/generators/Tick.ts +83 -0
- package/types/generators/Udp.ts +120 -0
- package/types/generators/VadGgml.ts +250 -0
- package/types/generators/VadOnnx.ts +231 -0
- package/types/generators/VadTraditional.ts +138 -0
- package/types/generators/VectorStore.ts +257 -0
- package/types/generators/Watchdog.ts +107 -0
- package/types/generators/WebCrawler.ts +103 -0
- package/types/generators/WebRtc.ts +181 -0
- package/types/generators/WebSocket.ts +148 -0
- package/types/generators/index.ts +57 -0
- package/types/index.ts +13 -0
- package/types/subspace.ts +59 -0
- package/types/switch.ts +51 -0
- package/types/system.ts +707 -0
- package/utils/calc.ts +126 -0
- package/utils/data.ts +497 -0
- package/utils/event-props.ts +836 -0
- package/utils/id.ts +80 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Standby Transition
|
|
2
|
+
|
|
3
|
+
Easy-to-configure animation for Bricks based on Canvas render/change. Provides smooth enter animations when bricks appear and position transitions when canvas changes.
|
|
4
|
+
|
|
5
|
+
## How It Works
|
|
6
|
+
|
|
7
|
+
Two transition cases:
|
|
8
|
+
1. **First Render**: Run position transition based on `standbyMode` setting
|
|
9
|
+
2. **Canvas Change**: Existing bricks animate to new positions instead of re-rendering
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
Standby transition is configured in the **canvas item frame**, not the brick itself.
|
|
14
|
+
|
|
15
|
+
### Standby Mode
|
|
16
|
+
|
|
17
|
+
| Mode | Description |
|
|
18
|
+
|------|-------------|
|
|
19
|
+
| `top` | Slide in from top |
|
|
20
|
+
| `bottom` | Slide in from bottom |
|
|
21
|
+
| `left` | Slide in from left |
|
|
22
|
+
| `right` | Slide in from right |
|
|
23
|
+
| `custom` | Use custom `standbyFrame` values |
|
|
24
|
+
|
|
25
|
+
### Frame Options
|
|
26
|
+
|
|
27
|
+
| Option | Description |
|
|
28
|
+
|--------|-------------|
|
|
29
|
+
| `standbyMode` | Direction or `'custom'` |
|
|
30
|
+
| `standbyFrame` | Custom start frame `{ x?, y?, width?, height? }` |
|
|
31
|
+
| `standbyOpacity` | Start opacity (0.0 - 1.0) |
|
|
32
|
+
| `standbyDelay` | Delay before transition starts (ms) |
|
|
33
|
+
| `standbyDelayRandom` | Random delay variance (ms) |
|
|
34
|
+
| `standbyEasing` | Per-property easing config |
|
|
35
|
+
|
|
36
|
+
### Easing Configuration
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
standbyEasing: {
|
|
40
|
+
default?: { method: Easing, duration: number },
|
|
41
|
+
x?: { method: Easing, duration: number },
|
|
42
|
+
y?: { method: Easing, duration: number },
|
|
43
|
+
width?: { method: Easing, duration: number },
|
|
44
|
+
height?: { method: Easing, duration: number },
|
|
45
|
+
opacity?: { method: Easing, duration: number },
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## TypeScript Example
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { makeId } from 'bricks-ctor'
|
|
53
|
+
|
|
54
|
+
const canvas: Canvas = {
|
|
55
|
+
__typename: 'Canvas',
|
|
56
|
+
id: makeId('canvas'),
|
|
57
|
+
title: 'Home',
|
|
58
|
+
description: '',
|
|
59
|
+
property: {
|
|
60
|
+
backgroundColor: '#ffffff',
|
|
61
|
+
},
|
|
62
|
+
events: {},
|
|
63
|
+
switches: [],
|
|
64
|
+
items: [
|
|
65
|
+
{
|
|
66
|
+
item: () => heroCard,
|
|
67
|
+
frame: {
|
|
68
|
+
x: 100,
|
|
69
|
+
y: 50,
|
|
70
|
+
width: 400,
|
|
71
|
+
height: 300,
|
|
72
|
+
// Standby transition config
|
|
73
|
+
standbyMode: 'bottom',
|
|
74
|
+
standbyOpacity: 0,
|
|
75
|
+
standbyDelay: 100,
|
|
76
|
+
standbyEasing: {
|
|
77
|
+
default: { method: 'easeOutCubic', duration: 400 },
|
|
78
|
+
opacity: { method: 'easeOutQuad', duration: 300 },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Canvas Change Transition
|
|
87
|
+
|
|
88
|
+
When navigating between canvases, bricks with the same ID smoothly transition:
|
|
89
|
+
- Position interpolates from old to new location
|
|
90
|
+
- Size interpolates if dimensions change
|
|
91
|
+
- Opacity interpolates if visibility changes
|
|
92
|
+
|
|
93
|
+
This creates a "shared element transition" effect.
|
|
94
|
+
|
|
95
|
+
## Related Events
|
|
96
|
+
|
|
97
|
+
- `standby`: Triggered when brick completes standby transition
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// In brick definition
|
|
101
|
+
events: {
|
|
102
|
+
standby: [
|
|
103
|
+
{
|
|
104
|
+
handler: 'system',
|
|
105
|
+
action: {
|
|
106
|
+
__actionName: 'DYNAMIC_ANIMATION',
|
|
107
|
+
parent: 'System',
|
|
108
|
+
params: [
|
|
109
|
+
{ input: 'brickId', value: () => heroCard },
|
|
110
|
+
{ input: 'animationId', value: () => pulseAnimation },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Best Practices
|
|
119
|
+
|
|
120
|
+
1. **Stagger delays**: Use incremental delays for list items (e.g., 0, 50, 100ms)
|
|
121
|
+
2. **Keep it short**: 200-400ms transitions feel responsive
|
|
122
|
+
3. **Match content**: Use directional transitions that match scroll direction
|
|
123
|
+
4. **Opacity for polish**: Combine position transition with opacity fade
|
|
124
|
+
5. **Same-ID trick**: Reuse brick IDs across canvases for smooth transitions
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rive-marketplace
|
|
3
|
+
description: Search and download assets from Rive Marketplace. Use when searching for Rive animations, downloading .riv files, or exploring Rive community assets. Supports keyword search, tag browsing, and direct file downloads via public API. Requires browser tool for searching; API calls work without browser.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Rive Marketplace
|
|
7
|
+
|
|
8
|
+
Download animated assets (.riv files) from Rive's community marketplace.
|
|
9
|
+
|
|
10
|
+
## URL Structure
|
|
11
|
+
|
|
12
|
+
- **Featured**: `https://rive.app/marketplace/featured/`
|
|
13
|
+
- **Latest**: `https://rive.app/marketplace/latest/`
|
|
14
|
+
- **Search**: `https://rive.app/marketplace/search/{query}/`
|
|
15
|
+
- **Tags**: `https://rive.app/marketplace/tag/{TagName}/`
|
|
16
|
+
- **Item**: `https://rive.app/marketplace/{post_id}-{revision_id}-{slug}/`
|
|
17
|
+
|
|
18
|
+
## API (Public, No Auth)
|
|
19
|
+
|
|
20
|
+
### Get Post Details
|
|
21
|
+
```bash
|
|
22
|
+
curl -s "https://api.rive.app/api/community-posts/{post_id}" | jq '.'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Response contains:**
|
|
26
|
+
- `community_post_id` — Post ID
|
|
27
|
+
- `owner.username` — Creator name
|
|
28
|
+
- `community_revisions[0].title` — Asset title
|
|
29
|
+
- `community_revisions[0].description` — Description
|
|
30
|
+
- `community_revisions[0].tags` — Tags array
|
|
31
|
+
- `community_revisions[0].community_files[0].file_url` — **Download URL**
|
|
32
|
+
|
|
33
|
+
### Download .riv File
|
|
34
|
+
```bash
|
|
35
|
+
# Extract file_url from API response
|
|
36
|
+
curl -s "https://api.rive.app/api/community-posts/{post_id}" | jq -r '.community_revisions[0].community_files[0].file_url'
|
|
37
|
+
|
|
38
|
+
# Download directly
|
|
39
|
+
curl -O "https://public.rive.app/community/runtime-files/{post_id}-{revision_id}-{slug}.riv"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Workflow: Search → Download
|
|
43
|
+
|
|
44
|
+
### 1. Browse via Browser (profile=clawd)
|
|
45
|
+
```
|
|
46
|
+
Open: https://rive.app/marketplace/search/{keyword}/
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Get Post ID from URL
|
|
50
|
+
Item URL format: `/marketplace/{post_id}-{revision_id}-{slug}/`
|
|
51
|
+
Example: `/marketplace/1683-3324-like-button/` → post_id = **1683**
|
|
52
|
+
|
|
53
|
+
### 3. Fetch Download URL via API
|
|
54
|
+
```bash
|
|
55
|
+
curl -s "https://api.rive.app/api/community-posts/1683" | jq -r '.community_revisions[0].community_files[0].file_url'
|
|
56
|
+
# Output: https://public.rive.app/community/runtime-files/1683-3324-like-button.riv
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 4. Download File
|
|
60
|
+
```bash
|
|
61
|
+
curl -O "https://public.rive.app/community/runtime-files/1683-3324-like-button.riv"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Example: Full Flow
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Search for "button" assets, pick one, get post_id from URL
|
|
68
|
+
POST_ID=1683
|
|
69
|
+
|
|
70
|
+
# Get file URL
|
|
71
|
+
FILE_URL=$(curl -s "https://api.rive.app/api/community-posts/$POST_ID" | jq -r '.community_revisions[0].community_files[0].file_url')
|
|
72
|
+
|
|
73
|
+
# Download
|
|
74
|
+
curl -o "my-button.riv" "$FILE_URL"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Batch Download Script
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
#!/bin/bash
|
|
81
|
+
# Download multiple Rive assets by post IDs
|
|
82
|
+
for POST_ID in 1683 3548 3703; do
|
|
83
|
+
FILE_URL=$(curl -s "https://api.rive.app/api/community-posts/$POST_ID" | jq -r '.community_revisions[0].community_files[0].file_url')
|
|
84
|
+
FILENAME=$(basename "$FILE_URL")
|
|
85
|
+
echo "Downloading $FILENAME..."
|
|
86
|
+
curl -sO "$FILE_URL"
|
|
87
|
+
done
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
All Marketplace files are shared under **CC BY** (Creative Commons Attribution 4.0).
|
|
93
|
+
Attribution required when using assets.
|
|
94
|
+
|
|
95
|
+
## Notes
|
|
96
|
+
|
|
97
|
+
- No official search API; browse via browser or scrape search results
|
|
98
|
+
- API is public but undocumented; may change without notice
|
|
99
|
+
- Remix/Like/Comment requires authentication
|
package/tools/deploy.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { $ } from 'bun'
|
|
2
|
+
import { parseArgs } from 'util'
|
|
3
|
+
|
|
4
|
+
const cwd = process.cwd()
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
values: {
|
|
8
|
+
changelogs: changelogsArg,
|
|
9
|
+
'changelogs-file': changelogsFile,
|
|
10
|
+
'auto-commit': autoCommit,
|
|
11
|
+
'auto-version': autoVersion,
|
|
12
|
+
version: versionArg,
|
|
13
|
+
yes,
|
|
14
|
+
help,
|
|
15
|
+
},
|
|
16
|
+
} = parseArgs({
|
|
17
|
+
args: Bun.argv.slice(2),
|
|
18
|
+
options: {
|
|
19
|
+
changelogs: { type: 'string' },
|
|
20
|
+
'changelogs-file': { type: 'string' },
|
|
21
|
+
'auto-commit': { type: 'boolean' },
|
|
22
|
+
'auto-version': { type: 'boolean' },
|
|
23
|
+
version: { type: 'string' },
|
|
24
|
+
yes: { type: 'boolean', short: 'y' },
|
|
25
|
+
help: { type: 'boolean', short: 'h' },
|
|
26
|
+
},
|
|
27
|
+
allowPositionals: true,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
if (help) {
|
|
31
|
+
console.log(`Options:
|
|
32
|
+
--changelogs <text> Changelogs text for the release
|
|
33
|
+
--changelogs-file <path> Read changelogs from a file
|
|
34
|
+
--auto-commit Auto-commit unstaged changes before deploying
|
|
35
|
+
--auto-version Auto-bump patch version before deploying
|
|
36
|
+
--version <version> Set explicit version for the release
|
|
37
|
+
-y, --yes Skip all prompts
|
|
38
|
+
-h, --help Show this help message`)
|
|
39
|
+
process.exit(0)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check git status
|
|
43
|
+
const { exitCode } = await $`cd ${cwd} && git status`.quiet().nothrow()
|
|
44
|
+
const isGitRepo = exitCode === 0
|
|
45
|
+
|
|
46
|
+
if (!isGitRepo && !yes) {
|
|
47
|
+
const confirmContinue = prompt('No git repository found, continue? (y/n)')
|
|
48
|
+
if (confirmContinue !== 'y') throw new Error('Deployment cancelled')
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Read application.json
|
|
52
|
+
const app = await Bun.file(`${cwd}/application.json`).json()
|
|
53
|
+
const config = await Bun.file(`${cwd}/.bricks/build/application-config.json`).json()
|
|
54
|
+
|
|
55
|
+
// Resolve version: explicit flag > auto-bump > package.json
|
|
56
|
+
const pkgFile = Bun.file(`${cwd}/package.json`)
|
|
57
|
+
const pkgExists = await pkgFile.exists()
|
|
58
|
+
let version: string | undefined
|
|
59
|
+
|
|
60
|
+
if (versionArg) {
|
|
61
|
+
version = versionArg
|
|
62
|
+
if (pkgExists) {
|
|
63
|
+
const pkg = await pkgFile.json()
|
|
64
|
+
pkg.version = version
|
|
65
|
+
await Bun.write(`${cwd}/package.json`, JSON.stringify(pkg, null, 2) + '\n')
|
|
66
|
+
}
|
|
67
|
+
} else if (autoVersion && pkgExists) {
|
|
68
|
+
const pkg = await pkgFile.json()
|
|
69
|
+
const parts = (pkg.version || '0.0.0').split('.')
|
|
70
|
+
parts[2] = String(Number(parts[2] || 0) + 1)
|
|
71
|
+
version = parts.join('.')
|
|
72
|
+
pkg.version = version
|
|
73
|
+
await Bun.write(`${cwd}/package.json`, JSON.stringify(pkg, null, 2) + '\n')
|
|
74
|
+
} else {
|
|
75
|
+
version = pkgExists ? (await pkgFile.json()).version : undefined
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Get changelog from flag or file
|
|
79
|
+
let changelogs = ''
|
|
80
|
+
if (changelogsArg) {
|
|
81
|
+
changelogs = changelogsArg
|
|
82
|
+
} else if (changelogsFile) {
|
|
83
|
+
const file = Bun.file(changelogsFile)
|
|
84
|
+
if (!(await file.exists())) {
|
|
85
|
+
throw new Error(`Changelogs file not found: ${changelogsFile}`)
|
|
86
|
+
}
|
|
87
|
+
changelogs = await file.text()
|
|
88
|
+
} else if (!yes) {
|
|
89
|
+
changelogs = prompt('Enter changelogs (optional, press Enter to skip):') || ''
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Handle unstaged changes
|
|
93
|
+
let commitId = ''
|
|
94
|
+
if (isGitRepo) {
|
|
95
|
+
const unstagedChanges = await $`cd ${cwd} && git diff --name-only --diff-filter=ACMR`.text()
|
|
96
|
+
if (unstagedChanges) {
|
|
97
|
+
if (autoCommit) {
|
|
98
|
+
const commitMsg = `chore: release ${version || 'new version'}`
|
|
99
|
+
const commitBody = changelogs || '[no changelogs]'
|
|
100
|
+
await $`cd ${cwd} && git add -A && git commit -m ${commitMsg} -m ${commitBody}`
|
|
101
|
+
} else {
|
|
102
|
+
throw new Error(
|
|
103
|
+
'Unstaged changes found, please commit or stash your changes before deploying',
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
commitId = (await $`cd ${cwd} && git rev-parse HEAD`.text()).trim()
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Ask for confirmation
|
|
111
|
+
if (!yes) {
|
|
112
|
+
const confirm = prompt('Are you sure you want to deploy? (y/n)')
|
|
113
|
+
if (confirm !== 'y') throw new Error('Deployment cancelled')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const isModule = app.type === 'module'
|
|
117
|
+
const command = isModule ? 'module' : 'app'
|
|
118
|
+
|
|
119
|
+
// Add project-specific fields to config and write to temp file
|
|
120
|
+
const releaseConfig = {
|
|
121
|
+
...config,
|
|
122
|
+
title: version || config.title,
|
|
123
|
+
bricks_project_last_commit_id: commitId || undefined,
|
|
124
|
+
}
|
|
125
|
+
const configPath = `${cwd}/.bricks/build/release-config.json`
|
|
126
|
+
await Bun.write(configPath, JSON.stringify(releaseConfig))
|
|
127
|
+
|
|
128
|
+
const args = ['bricks', command, 'release', app.id, '-c', configPath, '--json']
|
|
129
|
+
|
|
130
|
+
if (version) {
|
|
131
|
+
args.push('--version', version)
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (changelogs) {
|
|
135
|
+
args.push('--changelogs', changelogs)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const result = await $`${args}`.quiet().nothrow()
|
|
139
|
+
|
|
140
|
+
if (result.exitCode !== 0) {
|
|
141
|
+
const output = result.stderr.toString() || result.stdout.toString()
|
|
142
|
+
try {
|
|
143
|
+
const json = JSON.parse(output)
|
|
144
|
+
throw new Error(json.error || 'Release failed')
|
|
145
|
+
} catch {
|
|
146
|
+
throw new Error(output || 'Release failed')
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const output = JSON.parse(result.stdout.toString())
|
|
151
|
+
console.log(`${isModule ? 'Module' : 'App'} deployed: ${output.name}`)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* text=auto eol=lf
|