You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To view all the commands you can run, type `sbpf help`. Here are the available commands:
29
30
30
-
-`init`: Create a new project scaffold.
31
-
-`build`: Compile into a Solana program executable.
32
-
-`deploy`: Build and deploy the program.
33
-
-`test`: Test the deployed program.
34
-
-`e2e`: Build, deploy, and test a program.
35
-
-`clean`: Clean up build and deploy artifacts.
36
-
-`help`: Print this message or the help of the given subcommand(s).
31
+
-`init`: Create a new project scaffold.
32
+
-`build`: Compile into a Solana program executable.
33
+
-`deploy`: Build and deploy the program.
34
+
-`test`: Test the deployed program.
35
+
-`e2e`: Build, deploy, and test a program.
36
+
-`clean`: Clean up build and deploy artifacts.
37
+
-`config`: Manage project configuration files.
38
+
-`help`: Print this message or the help of the given subcommand(s).
37
39
40
+
Options:
41
+
42
+
-`-h`, --help Print help
43
+
-`-V`, --version Print version
44
+
45
+
Usage: sbpf `<COMMAND>`
46
+
47
+
### Configuration System
48
+
49
+
sbpf now supports project-aware configuration through `sbpf.toml` files. This eliminates the need to repeatedly specify build settings, deployment targets, and other options.
50
+
51
+
#### Quick Start with Configuration
52
+
53
+
```bash
54
+
# Create a new project (automatically includes sbpf.toml)
55
+
sbpf init my-solana-program
56
+
57
+
# Or add configuration to an existing project
58
+
sbpf config init
59
+
60
+
# View current configuration
61
+
sbpf config show
62
+
63
+
# Modify settings
64
+
sbpf config set deploy.cluster mainnet
65
+
sbpf config set scripts.test "cargo test --verbose"
38
66
```
39
-
Usage: sbpf <COMMAND>
40
67
41
-
Commands:
42
-
init Create a new project scaffold
43
-
build Compile into a Solana program executable
44
-
deploy Build and deploy the program
45
-
test Test deployed program
46
-
e2e Build, deploy and test a program
47
-
clean Clean up build and deploy artifacts
48
-
help Print this message or the help of the given subcommand(s)
68
+
#### Configuration File Format
49
69
50
-
Options:
51
-
-h, --help Print help
52
-
-V, --version Print version
70
+
The `sbpf.toml` file supports the following sections:
71
+
72
+
```toml
73
+
[project]
74
+
name = "sbpf"
75
+
version = "0.1.0"
76
+
77
+
[scripts]
78
+
test = "cargo test"
79
+
80
+
[deploy]
81
+
cluster = "localhost"
82
+
wallet = "~/.config/solana/id.json"
83
+
```
84
+
85
+
#### Scripts System
86
+
87
+
Define custom commands in your configuration that can be run with `sbpf script <name>`:
88
+
89
+
```toml
90
+
[scripts]
91
+
# Override built-in commands
92
+
test = "cargo test --verbose"
93
+
build = "echo 'Custom build' && sbpf build"
94
+
95
+
# Custom scripts
96
+
lint = "cargo clippy -- -D warnings"
97
+
format = "cargo fmt"
98
+
deploy-staging = "sbpf deploy --cluster devnet"
99
+
audit = "cargo audit"
100
+
```
101
+
102
+
**Usage:**
103
+
104
+
```bash
105
+
sbpf script lint # Run custom lint script
106
+
sbpf script deploy-staging # Run staging deployment
107
+
sbpf script audit # Run security audit
53
108
```
54
109
55
110
### Command Details
@@ -73,27 +128,83 @@ Options:
73
128
-V, --version Print version information
74
129
```
75
130
76
-
##### Examples
131
+
####Configuration Management
77
132
78
-
###### Create a new project with Rust tests (default)
133
+
Manage project configuration without manually editing TOML files:
134
+
135
+
```sh
136
+
sbpf config --help
137
+
Initialize or manage configuration
138
+
139
+
Usage: sbpf config <COMMAND>
140
+
141
+
Commands:
142
+
show Show current configuration
143
+
init Initialize default configuration
144
+
set Set a configuration value
145
+
help Print this message or the help of the given subcommand(s)
146
+
```
147
+
148
+
### Examples
149
+
150
+
**Create a new project with Rust tests (includes sbpf.toml):**
79
151
80
152
```sh
81
153
sbpf init my-project
82
154
```
83
155
84
-
###### Create a new project with TypeScript tests
156
+
**Create a new project with TypeScript tests:**
85
157
86
158
```sh
87
159
sbpf init my-project --ts-tests
88
160
```
89
161
90
-
After initializing the project, you can navigate into the project directory and use other commands to build, deploy, and test your program.
162
+
**Add configuration to existing project:**
163
+
164
+
```sh
165
+
sbpf config init
166
+
```
167
+
168
+
**View current settings:**
169
+
170
+
```sh
171
+
sbpf config show
172
+
```
173
+
174
+
**Modify settings:**
175
+
176
+
```sh
177
+
sbpf config set deploy.cluster mainnet
178
+
```
179
+
180
+
**Build with configuration:**
181
+
182
+
```sh
183
+
# Uses settings from sbpf.toml automatically
184
+
sbpf build
185
+
sbpf deploy
186
+
sbpf test
187
+
```
188
+
189
+
**Custom build pipeline:**
190
+
191
+
```bash
192
+
# Configure custom scripts
193
+
sbpf config set scripts.build "echo 'Building...' && sbpf build"
194
+
sbpf config set scripts.test "cargo test --verbose"
195
+
sbpf config set scripts.deploy-all "sbpf build && sbpf deploy"
196
+
197
+
# Use custom pipeline
198
+
sbpf script build
199
+
sbpf script test
200
+
sbpf script deploy-all
201
+
```
91
202
92
203
### Advanced Usage
93
204
94
205
You can override the default linker with a [custom linker file](https://github.com/deanmlittle/sbpf-asm-noop/blob/master/src/noop/noop.ld) by including it in the src directory with the same name as your program. For example:
0 commit comments