@devaloop/devalang 0.0.1-alpha.10 → 0.0.1-alpha.11
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/.devalang +9 -4
- package/Cargo.toml +54 -49
- package/README.md +59 -142
- package/docs/CHANGELOG.md +42 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/TODO.md +1 -1
- package/examples/bank.deva +9 -0
- package/examples/duration.deva +9 -0
- package/examples/index.deva +0 -2
- package/out-tsc/bin/devalang.exe +0 -0
- package/package.json +1 -1
- package/project-version.json +3 -3
- package/rust/cli/bank.rs +455 -0
- package/rust/cli/build.rs +1 -1
- package/rust/cli/check.rs +1 -1
- package/rust/cli/driver.rs +280 -0
- package/rust/cli/install.rs +17 -0
- package/rust/cli/mod.rs +5 -200
- package/rust/cli/play.rs +1 -1
- package/rust/cli/update.rs +4 -0
- package/rust/common/cdn.rs +11 -0
- package/rust/common/mod.rs +1 -0
- package/rust/config/driver.rs +76 -0
- package/rust/config/loader.rs +98 -1
- package/rust/config/mod.rs +1 -15
- package/rust/core/audio/engine.rs +31 -3
- package/rust/core/audio/interpreter/arrow_call.rs +17 -4
- package/rust/core/audio/interpreter/trigger.rs +34 -1
- package/rust/core/audio/loader/trigger.rs +12 -0
- package/rust/core/lexer/handler/driver.rs +12 -1
- package/rust/core/lexer/handler/mod.rs +1 -0
- package/rust/core/lexer/handler/slash.rs +21 -0
- package/rust/core/lexer/token.rs +1 -0
- package/rust/core/parser/driver.rs +8 -0
- package/rust/core/parser/handler/arrow_call.rs +29 -4
- package/rust/core/parser/handler/dot.rs +103 -37
- package/rust/core/preprocessor/loader.rs +93 -14
- package/rust/core/preprocessor/resolver/driver.rs +5 -0
- package/rust/core/shared/bank.rs +21 -0
- package/rust/core/shared/duration.rs +1 -0
- package/rust/core/shared/mod.rs +2 -1
- package/rust/core/shared/value.rs +1 -0
- package/rust/installer/bank.rs +55 -0
- package/rust/installer/mod.rs +1 -0
- package/rust/lib.rs +1 -0
- package/rust/main.rs +62 -5
- package/rust/utils/installer.rs +56 -0
- package/rust/utils/mod.rs +2 -1
- package/docs/COMMANDS.md +0 -85
- package/docs/CONFIG.md +0 -30
- package/docs/SYNTAX.md +0 -230
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
use std::{ collections::HashMap, path::Path };
|
|
1
|
+
use std::{ collections::{ HashMap, HashSet }, path::Path };
|
|
2
2
|
use crate::{
|
|
3
3
|
core::{
|
|
4
4
|
error::ErrorHandler,
|
|
5
5
|
lexer::{ token::Token, Lexer },
|
|
6
|
-
parser::{ statement::{ Statement, StatementKind }
|
|
6
|
+
parser::{ driver::Parser, statement::{ Statement, StatementKind } },
|
|
7
7
|
preprocessor::{ module::Module, processor::process_modules },
|
|
8
|
+
shared::{ bank::BankFile, value::Value },
|
|
8
9
|
store::global::GlobalStore,
|
|
9
10
|
utils::path::normalize_path,
|
|
10
11
|
},
|
|
@@ -86,15 +87,20 @@ impl ModuleLoader {
|
|
|
86
87
|
let statements = parser.parse_tokens(tokens, global_store);
|
|
87
88
|
module.statements = statements;
|
|
88
89
|
|
|
90
|
+
// SECTION Injecting bank triggers if any
|
|
91
|
+
if let Err(e) = self.inject_bank_triggers(&mut module, "808") {
|
|
92
|
+
return Err(format!("Failed to inject bank triggers: {}", e));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
global_store.modules.insert(self.entry.clone(), module.clone());
|
|
96
|
+
|
|
89
97
|
// SECTION Error handling
|
|
90
98
|
let mut error_handler = ErrorHandler::new();
|
|
91
99
|
error_handler.detect_from_statements(&mut parser, &module.statements);
|
|
92
100
|
|
|
93
|
-
global_store.modules.insert(self.entry.clone(), module.clone());
|
|
94
|
-
|
|
95
101
|
Ok(module)
|
|
96
102
|
}
|
|
97
|
-
|
|
103
|
+
|
|
98
104
|
pub fn load_wasm_module(&self, global_store: &mut GlobalStore) -> Result<(), String> {
|
|
99
105
|
// Step one : Load the module from the global store
|
|
100
106
|
let module = {
|
|
@@ -170,6 +176,23 @@ impl ModuleLoader {
|
|
|
170
176
|
|
|
171
177
|
let statements = parser.parse_tokens(tokens.clone(), global_store);
|
|
172
178
|
|
|
179
|
+
// Insert module into store
|
|
180
|
+
let mut module = Module::new(&path);
|
|
181
|
+
module.tokens = tokens.clone();
|
|
182
|
+
module.statements = statements.clone();
|
|
183
|
+
|
|
184
|
+
// Inject triggers for each bank used in module
|
|
185
|
+
for bank_name in ModuleLoader::extract_bank_names(&statements) {
|
|
186
|
+
if let Err(e) = self.inject_bank_triggers(&mut module, &bank_name) {
|
|
187
|
+
return HashMap::new(); // Return empty map on error
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
global_store.insert_module(path.clone(), module);
|
|
192
|
+
|
|
193
|
+
// Load dependencies
|
|
194
|
+
self.load_module_imports(&path, global_store);
|
|
195
|
+
|
|
173
196
|
// Error handling
|
|
174
197
|
let mut error_handler = ErrorHandler::new();
|
|
175
198
|
error_handler.detect_from_statements(&mut parser, &statements);
|
|
@@ -182,15 +205,6 @@ impl ModuleLoader {
|
|
|
182
205
|
}
|
|
183
206
|
}
|
|
184
207
|
|
|
185
|
-
// Insert module into store
|
|
186
|
-
let mut module = Module::new(&path);
|
|
187
|
-
module.tokens = tokens.clone();
|
|
188
|
-
module.statements = statements.clone();
|
|
189
|
-
global_store.insert_module(path.clone(), module);
|
|
190
|
-
|
|
191
|
-
// Load dependencies
|
|
192
|
-
self.load_module_imports(&path, global_store);
|
|
193
|
-
|
|
194
208
|
// Return tokens per module
|
|
195
209
|
global_store.modules
|
|
196
210
|
.iter()
|
|
@@ -226,4 +240,69 @@ impl ModuleLoader {
|
|
|
226
240
|
self.load_module_recursively(&resolved, global_store);
|
|
227
241
|
}
|
|
228
242
|
}
|
|
243
|
+
|
|
244
|
+
pub fn inject_bank_triggers(&self, module: &mut Module, bank_name: &str) -> Result<(), String> {
|
|
245
|
+
let bank_path = Path::new("./.deva/bank").join(bank_name);
|
|
246
|
+
let bank_file_path = bank_path.join("bank.toml");
|
|
247
|
+
|
|
248
|
+
if !bank_file_path.exists() {
|
|
249
|
+
return Ok(()); // Pas d'erreur si la banque n'existe pas encore
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
let content = std::fs
|
|
253
|
+
::read_to_string(&bank_file_path)
|
|
254
|
+
.map_err(|e| format!("Failed to read '{}': {}", bank_file_path.display(), e))?;
|
|
255
|
+
|
|
256
|
+
let parsed: BankFile = toml
|
|
257
|
+
::from_str(&content)
|
|
258
|
+
.map_err(|e| format!("Failed to parse '{}': {}", bank_file_path.display(), e))?;
|
|
259
|
+
|
|
260
|
+
let mut bank_map = HashMap::new();
|
|
261
|
+
|
|
262
|
+
for bank_trigger in parsed.triggers.unwrap_or_default() {
|
|
263
|
+
let trigger_name = bank_trigger.name.clone().replace("./", "");
|
|
264
|
+
let bank_trigger_path = format!("devalang://bank/{}/{}", bank_name, trigger_name);
|
|
265
|
+
|
|
266
|
+
bank_map.insert(bank_trigger.name.clone(), Value::String(bank_trigger_path.clone()));
|
|
267
|
+
|
|
268
|
+
if module.variable_table.variables.contains_key(bank_name) {
|
|
269
|
+
eprintln!(
|
|
270
|
+
"⚠️ Trigger '{}' already defined in module '{}', skipping injection.",
|
|
271
|
+
bank_name, module.path
|
|
272
|
+
);
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
module.variable_table.set(
|
|
277
|
+
format!("{}.{}", bank_name, bank_trigger.name),
|
|
278
|
+
Value::String(bank_trigger_path.clone())
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Inject the map under the bank name
|
|
283
|
+
module.variable_table.set(bank_name.to_string(), Value::Map(bank_map));
|
|
284
|
+
|
|
285
|
+
Ok(())
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
fn extract_bank_names(statements: &[Statement]) -> HashSet<String> {
|
|
289
|
+
let mut banks = HashSet::new();
|
|
290
|
+
|
|
291
|
+
for stmt in statements {
|
|
292
|
+
if let StatementKind::Trigger { entity, .. } = &stmt.kind {
|
|
293
|
+
let parts: Vec<&str> = entity.split('.').collect();
|
|
294
|
+
if parts.len() >= 2 {
|
|
295
|
+
banks.insert(parts[0].to_string()); // "808.kick" → "808"
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
if let StatementKind::Bank = &stmt.kind {
|
|
300
|
+
if let Value::String(name) = &stmt.value {
|
|
301
|
+
banks.insert(name.clone());
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
banks
|
|
307
|
+
}
|
|
229
308
|
}
|
|
@@ -73,6 +73,11 @@ fn resolve_value(value: &Value, module: &Module, global_store: &mut GlobalStore)
|
|
|
73
73
|
Value::Null
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
Value::Beat(beat_str) => {
|
|
77
|
+
println!("[warn] '{:?}': unresolved beat '{}'", module.path, beat_str);
|
|
78
|
+
Value::Beat(beat_str.clone())
|
|
79
|
+
}
|
|
80
|
+
|
|
76
81
|
Value::Map(map) => {
|
|
77
82
|
let mut resolved = HashMap::new();
|
|
78
83
|
for (k, v) in map {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use serde::{ Deserialize, Serialize };
|
|
2
|
+
|
|
3
|
+
#[derive(Debug, Deserialize)]
|
|
4
|
+
pub struct BankInfo {
|
|
5
|
+
pub name: String,
|
|
6
|
+
pub version: String,
|
|
7
|
+
pub description: String,
|
|
8
|
+
pub author: String,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#[derive(Debug, Deserialize)]
|
|
12
|
+
pub struct BankFile {
|
|
13
|
+
pub bank: BankInfo,
|
|
14
|
+
pub triggers: Option<Vec<BankTrigger>>,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#[derive(Debug, Deserialize)]
|
|
18
|
+
pub struct BankTrigger {
|
|
19
|
+
pub name: String,
|
|
20
|
+
pub path: String,
|
|
21
|
+
}
|
package/rust/core/shared/mod.rs
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
use std::path::{ Path, PathBuf };
|
|
2
|
+
use crate::{
|
|
3
|
+
common::cdn::get_cdn_url,
|
|
4
|
+
config::loader::{ add_bank_to_config, load_config },
|
|
5
|
+
utils::installer::{ download_file, extract_archive },
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
pub async fn install_bank(name: &str, target_dir: &Path) -> Result<(), String> {
|
|
9
|
+
let cdn_url = get_cdn_url();
|
|
10
|
+
let url = format!("{}/bank/{}", cdn_url, name);
|
|
11
|
+
|
|
12
|
+
let bank_dir = target_dir.join("bank");
|
|
13
|
+
let archive_path = PathBuf::from(format!("./.deva/tmp/{}.devabank", name));
|
|
14
|
+
let extract_path = bank_dir.join(name);
|
|
15
|
+
|
|
16
|
+
if extract_path.exists() {
|
|
17
|
+
println!(
|
|
18
|
+
"Bank '{}' already exists at '{}'. Skipping install.",
|
|
19
|
+
name,
|
|
20
|
+
extract_path.display()
|
|
21
|
+
);
|
|
22
|
+
return Ok(());
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
download_file(&url, &archive_path).await.map_err(|e| format!("Failed to download: {}", e))?;
|
|
26
|
+
|
|
27
|
+
extract_archive(&archive_path, &extract_path).await.map_err(|e|
|
|
28
|
+
format!("Failed to extract: {}", e)
|
|
29
|
+
)?;
|
|
30
|
+
|
|
31
|
+
// Add the bank to the config
|
|
32
|
+
let root_dir = target_dir
|
|
33
|
+
.parent()
|
|
34
|
+
.ok_or_else(|| "Failed to determine root directory".to_string())?;
|
|
35
|
+
|
|
36
|
+
let config_path = root_dir.join(".devalang");
|
|
37
|
+
if !config_path.exists() {
|
|
38
|
+
return Err(
|
|
39
|
+
format!(
|
|
40
|
+
"Config file not found at '{}'. Please run 'devalang init' before adding an addon",
|
|
41
|
+
config_path.display()
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let mut config = load_config(Some(&config_path)).ok_or_else(||
|
|
47
|
+
format!("Failed to load config from '{}'", config_path.display())
|
|
48
|
+
)?;
|
|
49
|
+
|
|
50
|
+
let dependency_path = &format!("devalang://bank/{}", name);
|
|
51
|
+
|
|
52
|
+
add_bank_to_config(&mut config, &extract_path, &dependency_path);
|
|
53
|
+
|
|
54
|
+
Ok(())
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pub mod bank;
|
package/rust/lib.rs
CHANGED
package/rust/main.rs
CHANGED
|
@@ -4,24 +4,33 @@ pub mod core;
|
|
|
4
4
|
pub mod cli;
|
|
5
5
|
pub mod utils;
|
|
6
6
|
pub mod config;
|
|
7
|
+
pub mod common;
|
|
8
|
+
pub mod installer;
|
|
7
9
|
|
|
8
10
|
use std::io;
|
|
9
|
-
use cli::{ Cli };
|
|
10
11
|
use clap::Parser;
|
|
11
12
|
use crate::{
|
|
12
13
|
cli::{
|
|
14
|
+
bank::{
|
|
15
|
+
handle_bank_available_command,
|
|
16
|
+
handle_bank_info_command,
|
|
17
|
+
handle_bank_list_command,
|
|
18
|
+
handle_remove_bank_command, handle_update_bank_command,
|
|
19
|
+
},
|
|
13
20
|
build::handle_build_command,
|
|
14
21
|
check::handle_check_command,
|
|
22
|
+
driver::{ BankCommand, Cli, Commands, InstallCommand, TemplateCommand },
|
|
15
23
|
init::handle_init_command,
|
|
24
|
+
install::handle_install_bank_command,
|
|
16
25
|
play::handle_play_command,
|
|
17
26
|
template::{ handle_template_info_command, handle_template_list_command },
|
|
18
|
-
|
|
19
|
-
TemplateCommand,
|
|
27
|
+
update::handle_update_command,
|
|
20
28
|
},
|
|
21
|
-
config::{ loader::load_config
|
|
29
|
+
config::{ driver::Config, loader::load_config },
|
|
22
30
|
};
|
|
23
31
|
|
|
24
|
-
|
|
32
|
+
#[tokio::main]
|
|
33
|
+
async fn main() -> io::Result<()> {
|
|
25
34
|
let cli: Cli = Cli::parse();
|
|
26
35
|
let mut config: Option<Config> = None;
|
|
27
36
|
|
|
@@ -58,6 +67,54 @@ fn main() -> io::Result<()> {
|
|
|
58
67
|
handle_play_command(config, entry, output, watch, repeat);
|
|
59
68
|
}
|
|
60
69
|
|
|
70
|
+
Commands::Install { command } =>
|
|
71
|
+
match command {
|
|
72
|
+
InstallCommand::Bank { name } => {
|
|
73
|
+
if let Err(err) = handle_install_bank_command(name).await {
|
|
74
|
+
eprintln!("❌ Failed to install bank: {}", err);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Commands::Bank { command } =>
|
|
80
|
+
match command {
|
|
81
|
+
BankCommand::List => {
|
|
82
|
+
if let Err(err) = handle_bank_list_command().await {
|
|
83
|
+
eprintln!("❌ Failed to list local banks: {}", err);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
BankCommand::Available => {
|
|
88
|
+
if let Err(err) = handle_bank_available_command().await {
|
|
89
|
+
eprintln!("❌ Failed to list available banks: {}", err);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
BankCommand::Info { name } => {
|
|
94
|
+
if let Err(err) = handle_bank_info_command(name).await {
|
|
95
|
+
eprintln!("❌ Failed to get bank info: {}", err);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
BankCommand::Remove { name } => {
|
|
100
|
+
if let Err(err) = handle_remove_bank_command(name).await {
|
|
101
|
+
eprintln!("❌ Failed to remove bank: {}", err);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
BankCommand::Update { name } => {
|
|
106
|
+
if let Err(err) = handle_update_bank_command(name).await {
|
|
107
|
+
eprintln!("❌ Failed to update bank: {}", err);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
Commands::Update { only } => {
|
|
113
|
+
if let Err(err) = handle_update_command(only).await {
|
|
114
|
+
eprintln!("❌ Update failed: {}", err);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
61
118
|
_ => {}
|
|
62
119
|
}
|
|
63
120
|
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
use std::fs::File;
|
|
2
|
+
use std::path::Path;
|
|
3
|
+
use std::io::BufReader;
|
|
4
|
+
use std::error::Error;
|
|
5
|
+
use std::io::{ copy, Cursor };
|
|
6
|
+
use zip::ZipArchive;
|
|
7
|
+
|
|
8
|
+
pub async fn download_file(url: &str, destination: &Path) -> Result<(), Box<dyn Error>> {
|
|
9
|
+
let response = reqwest::get(url).await?;
|
|
10
|
+
|
|
11
|
+
if !response.status().is_success() {
|
|
12
|
+
return Err(format!("Failed to download file: HTTP {}", response.status()).into());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if let Some(parent) = destination.parent() {
|
|
16
|
+
std::fs::create_dir_all(parent)?;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
let bytes = response.bytes().await?;
|
|
20
|
+
let mut content = Cursor::new(bytes);
|
|
21
|
+
let mut file = File::create(destination)?;
|
|
22
|
+
copy(&mut content, &mut file)?;
|
|
23
|
+
|
|
24
|
+
Ok(())
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
pub async fn extract_archive(
|
|
28
|
+
zip_path: &Path,
|
|
29
|
+
destination: &Path
|
|
30
|
+
) -> Result<(), Box<dyn std::error::Error>> {
|
|
31
|
+
let file = File::open(zip_path)?;
|
|
32
|
+
let mut archive = ZipArchive::new(BufReader::new(file))?;
|
|
33
|
+
|
|
34
|
+
for i in 0..archive.len() {
|
|
35
|
+
let mut file = archive.by_index(i)?;
|
|
36
|
+
let outpath = destination.join(file.mangled_name());
|
|
37
|
+
|
|
38
|
+
if file.name().ends_with('/') {
|
|
39
|
+
std::fs::create_dir_all(&outpath)?;
|
|
40
|
+
} else {
|
|
41
|
+
if let Some(p) = outpath.parent() {
|
|
42
|
+
std::fs::create_dir_all(p)?;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let mut outfile = File::create(&outpath)?;
|
|
46
|
+
std::io::copy(&mut file, &mut outfile)?;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Clear the temporary folder after extraction
|
|
51
|
+
if zip_path.exists() {
|
|
52
|
+
std::fs::remove_file(zip_path)?;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
Ok(())
|
|
56
|
+
}
|
package/rust/utils/mod.rs
CHANGED
package/docs/COMMANDS.md
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<img src="https://firebasestorage.googleapis.com/v0/b/devaloop-labs.firebasestorage.app/o/devalang-teal-logo.svg?alt=media&token=d2a5705a-1eba-4b49-88e6-895a761fb7f7" alt="Devalang Logo">
|
|
3
|
-
</div>
|
|
4
|
-
|
|
5
|
-
# Devalang Commands Guide
|
|
6
|
-
|
|
7
|
-
## Initialization
|
|
8
|
-
|
|
9
|
-
Initialize a new Devalang project (current folder)
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
devalang init
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Initialize a new Devalang project (new folder)
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
devalang init --name <project-name> --template <template-name>
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Available arguments:
|
|
22
|
-
|
|
23
|
-
- `--name`: The name of the project (cannot be empty)
|
|
24
|
-
- `--template`: The template to use for the project (default to `welcome`)
|
|
25
|
-
|
|
26
|
-
## Checking
|
|
27
|
-
|
|
28
|
-
Checking syntax of .deva file(s)
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
devalang check --entry ./examples --output ./output --watch
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Available arguments :
|
|
35
|
-
|
|
36
|
-
- `--no-config`: Whether to ignore the configuration file (default to `false`)
|
|
37
|
-
- `--entry`: The input folder (default to `./src`)
|
|
38
|
-
- `--output`: The output folder (default to `./output`)
|
|
39
|
-
- `--watch`: Whether to watch for changes and re-analyze (default to `false`)
|
|
40
|
-
|
|
41
|
-
## Building
|
|
42
|
-
|
|
43
|
-
Building AST of .deva file(s)
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
devalang build --entry ./examples --output ./output --watch
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Available arguments :
|
|
50
|
-
|
|
51
|
-
- `--no-config`: Whether to ignore the configuration file (default to `false`)
|
|
52
|
-
- `--entry`: The input folder (default to `./src`)
|
|
53
|
-
- `--output`: The output folder (default to `./output`)
|
|
54
|
-
- `--watch`: Whether to watch for changes and rebuild (default to `false`)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## Playing
|
|
58
|
-
|
|
59
|
-
Playing .deva file(s) without audio playback (once)
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
devalang play --entry ./examples --output ./output
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Playing .deva file(s) with audio playback (once by file change)
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
devalang play --entry ./examples --output ./output --watch
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Playing .deva file(s) with audio playback (infinite loop)
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
devalang play --entry ./examples --output ./output --repeat
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Note : You cannot use `--watch` and `--repeat` options together. Use `--repeat` instead.
|
|
78
|
-
|
|
79
|
-
Available arguments :
|
|
80
|
-
|
|
81
|
-
- `--no-config`: Whether to ignore the configuration file (default to `false`)
|
|
82
|
-
- `--entry`: The input folder (default to `./src`)
|
|
83
|
-
- `--output`: The output folder (default to `./output`)
|
|
84
|
-
- `--watch`: Whether to watch for changes and rebuild + play (default to `false`)
|
|
85
|
-
- `--repeat`: Whether to repeat the playback of the audio file (default to `false`)
|
package/docs/CONFIG.md
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<img src="https://firebasestorage.googleapis.com/v0/b/devaloop-labs.firebasestorage.app/o/devalang-teal-logo.svg?alt=media&token=d2a5705a-1eba-4b49-88e6-895a761fb7f7" alt="Devalang Logo">
|
|
3
|
-
</div>
|
|
4
|
-
|
|
5
|
-
# Devalang Configuration File
|
|
6
|
-
|
|
7
|
-
Use a configuration file if you don't want to pass command-line arguments every time you run a command. The configuration file allows you to set default values for various settings, making it easier to manage your Devalang project.
|
|
8
|
-
|
|
9
|
-
## Ignoring the Configuration File
|
|
10
|
-
|
|
11
|
-
If you prefer not to use a configuration file, you can ignore it by passing the `--no-config` flag when running Devalang commands. This will bypass any settings defined in the configuration file and use only the command-line arguments you provide.
|
|
12
|
-
|
|
13
|
-
## Structure of the Configuration File
|
|
14
|
-
|
|
15
|
-
The configuration file is a TOML (Tom's Obvious, Minimal Language) file that contains key-value pairs to define various settings for your Devalang project. Below is a sample configuration file:
|
|
16
|
-
|
|
17
|
-
```toml
|
|
18
|
-
[defaults]
|
|
19
|
-
entry = "./src"
|
|
20
|
-
output = "./output"
|
|
21
|
-
watch = false
|
|
22
|
-
repeat = true
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Available Settings
|
|
26
|
-
|
|
27
|
-
- `entry`: (String) The entry point for your Devalang project (default to `./src`)
|
|
28
|
-
- `output`: (String) The output directory for generated files (default to `./output`)
|
|
29
|
-
- `watch`: (Boolean) Whether to watch for changes in files and automatically rebuild or check them (default to `false`)
|
|
30
|
-
- `repeat`: (Boolean) Whether to repeat the playback of audio files (default to `false`)
|