@devaloop/devalang 0.0.1-alpha.16-hotfix.0 → 0.0.1-alpha.16-hotfix.3
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/.github/workflows/ci.yml +20 -8
- package/Cargo.toml +1 -1
- package/README.md +29 -31
- package/docs/CHANGELOG.md +17 -0
- package/docs/ROADMAP.md +2 -1
- package/docs/TODO.md +15 -3
- package/out-tsc/index.js +1 -1
- package/package.json +5 -5
- package/rust/cli/driver.rs +12 -0
- package/rust/cli/mod.rs +0 -1
- package/rust/cli/telemetry.rs +22 -19
- package/rust/config/settings.rs +31 -19
- package/rust/utils/first_usage.rs +19 -12
- package/tsconfig.json +11 -9
- package/typescript/index.ts +1 -1
- package/typescript/scripts/postinstall.ts +45 -32
- package/out-tsc/scripts/postbuild.js +0 -10
- package/rust/cli/generator.rs +0 -1
- package/typescript/scripts/postbuild.ts +0 -12
package/.github/workflows/ci.yml
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
name: CI & Release
|
|
2
2
|
|
|
3
|
+
permissions:
|
|
4
|
+
contents: write
|
|
5
|
+
|
|
3
6
|
on:
|
|
4
7
|
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
8
|
tags:
|
|
8
9
|
- "v*"
|
|
9
|
-
pull_request:
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
12
|
build:
|
|
@@ -77,16 +77,28 @@ jobs:
|
|
|
77
77
|
Copy-Item "target\${{ matrix.target }}\release\devalang${{ matrix.bin_ext }}" "out-tsc\bin\devalang-${{ matrix.target }}${{ matrix.bin_ext }}" -Force
|
|
78
78
|
|
|
79
79
|
- name: Upload artifact (CI)
|
|
80
|
-
if: startsWith(github.ref, 'refs/heads/')
|
|
81
80
|
uses: actions/upload-artifact@v4
|
|
82
81
|
with:
|
|
83
82
|
name: devalang-${{ matrix.target }}
|
|
84
83
|
path: out-tsc/bin/*
|
|
85
84
|
|
|
85
|
+
release:
|
|
86
|
+
name: Create GitHub Release
|
|
87
|
+
runs-on: ubuntu-latest
|
|
88
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
89
|
+
needs: build
|
|
90
|
+
steps:
|
|
91
|
+
- name: Download all build artifacts
|
|
92
|
+
uses: actions/download-artifact@v4
|
|
93
|
+
with:
|
|
94
|
+
path: dist
|
|
95
|
+
pattern: devalang-*
|
|
96
|
+
merge-multiple: true
|
|
97
|
+
|
|
98
|
+
- name: List files
|
|
99
|
+
run: ls -la dist
|
|
100
|
+
|
|
86
101
|
- name: Upload to GitHub Release
|
|
87
|
-
if: startsWith(github.ref, 'refs/tags/')
|
|
88
102
|
uses: softprops/action-gh-release@v2
|
|
89
103
|
with:
|
|
90
|
-
files:
|
|
91
|
-
env:
|
|
92
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
104
|
+
files: dist/*
|
package/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "devalang"
|
|
3
|
-
version = "0.0.1-alpha.16-hotfix.
|
|
3
|
+
version = "0.0.1-alpha.16-hotfix.3"
|
|
4
4
|
authors = ["Devaloop <contact@devaloop.com>"]
|
|
5
5
|
description = "Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text."
|
|
6
6
|
license = "MIT"
|
package/README.md
CHANGED
|
@@ -9,12 +9,15 @@
|
|
|
9
9
|

|
|
10
10
|

|
|
11
11
|

|
|
12
|
-
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
13
16
|
|
|
14
17
|

|
|
15
18
|

|
|
16
19
|
|
|
17
|
-
|
|
20
|
+

|
|
18
21
|
|
|
19
22
|
# 🦊 Devalang (CORE) — Compose music with code
|
|
20
23
|
|
|
@@ -29,8 +32,9 @@ From studio sketches to live sets, Devalang gives you rhythmic control — with
|
|
|
29
32
|
>
|
|
30
33
|
> Includes synthesis, playback, and rendering features, but is still in early development.
|
|
31
34
|
>
|
|
32
|
-
>
|
|
33
|
-
>
|
|
35
|
+
> NEW: [Devaforge is now available for creating addons](https://github.com/devaloop-labs/devaforge).
|
|
36
|
+
>
|
|
37
|
+
> NEW: Devalang is now available for **Windows**, **Linux**, and **macOS**.
|
|
34
38
|
|
|
35
39
|
## 📚 Quick Access
|
|
36
40
|
|
|
@@ -41,7 +45,8 @@ From studio sketches to live sets, Devalang gives you rhythmic control — with
|
|
|
41
45
|
- [📜 Changelog](./docs/CHANGELOG.md)
|
|
42
46
|
- [💡 Examples](./examples/)
|
|
43
47
|
- [🌐 Project Website](https://devalang.com)
|
|
44
|
-
- [📦
|
|
48
|
+
- [📦 Devaforge on npm](https://www.npmjs.com/package/@devaloop/devaforge)
|
|
49
|
+
- [📦 Devalang on npm](https://www.npmjs.com/package/@devaloop/devalang)
|
|
45
50
|
|
|
46
51
|
## ⏱️ Try it now !
|
|
47
52
|
|
|
@@ -53,11 +58,10 @@ From studio sketches to live sets, Devalang gives you rhythmic control — with
|
|
|
53
58
|
|
|
54
59
|
```bash
|
|
55
60
|
# Install Devalang CLI globally
|
|
56
|
-
npm install -g @devaloop/devalang
|
|
61
|
+
npm install -g @devaloop/devalang@latest
|
|
57
62
|
|
|
58
63
|
# Create a new Devalang project
|
|
59
64
|
devalang init --name my-project --template minimal
|
|
60
|
-
cd my-project
|
|
61
65
|
```
|
|
62
66
|
|
|
63
67
|
Create a new Devalang file `src/index.deva` in the project directory:
|
|
@@ -65,45 +69,40 @@ Create a new Devalang file `src/index.deva` in the project directory:
|
|
|
65
69
|
```deva
|
|
66
70
|
# src/index.deva
|
|
67
71
|
|
|
68
|
-
group
|
|
69
|
-
let
|
|
72
|
+
group myGroup:
|
|
73
|
+
let myLead = synth sine {
|
|
70
74
|
attack: 0,
|
|
71
75
|
decay: 100,
|
|
72
76
|
sustain: 100,
|
|
73
77
|
release: 100
|
|
74
78
|
}
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
automate lead:
|
|
78
|
-
param volume {
|
|
79
|
-
0% = 0.0
|
|
80
|
-
100% = 1.0
|
|
81
|
-
}
|
|
82
|
-
param pan {
|
|
83
|
-
0% = -1.0
|
|
84
|
-
100% = 1.0
|
|
85
|
-
}
|
|
80
|
+
automate myLead:
|
|
86
81
|
param pitch {
|
|
87
82
|
0% = -12.0
|
|
88
83
|
100% = 12.0
|
|
89
84
|
}
|
|
90
85
|
|
|
91
|
-
|
|
86
|
+
myLead -> note(C4, {
|
|
92
87
|
duration: 400,
|
|
93
88
|
velocity: 0.8,
|
|
94
|
-
automate: {
|
|
89
|
+
automate: {
|
|
90
|
+
pan: {
|
|
91
|
+
0%: -1.0,
|
|
92
|
+
100%: 0.0
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
95
|
})
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
myLead -> note(E4, { duration: 400 })
|
|
98
|
+
myLead -> note(G4, { duration: 600, glide: true, target_freq: 659.25 })
|
|
99
|
+
myLead -> note(B3, { duration: 400, slide: true, target_amp: 0.3 })
|
|
100
100
|
|
|
101
101
|
for i in [1, 2, 3]:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
# Play the lead
|
|
102
|
+
myLead -> note(C5, { duration: 200 })
|
|
103
|
+
print "Playing note C5 for " + i
|
|
105
104
|
|
|
106
|
-
call
|
|
105
|
+
call myGroup
|
|
107
106
|
```
|
|
108
107
|
|
|
109
108
|
### And the best part ? You can play it directly from the command line:
|
|
@@ -156,9 +155,8 @@ devalang play --repeat
|
|
|
156
155
|
|
|
157
156
|
For more info, see [docs/ROADMAP.md](./docs/ROADMAP.md)
|
|
158
157
|
|
|
159
|
-
- ⏳ Other statements (e.g `
|
|
160
|
-
- ⏳
|
|
161
|
-
- ⏳ More built-in instruments (e.g. snare, hi-hat, etc.)
|
|
158
|
+
- ⏳ Other statements (e.g `pattern`, ...)
|
|
159
|
+
- ⏳ Addon generator
|
|
162
160
|
|
|
163
161
|
## 🛡️ License
|
|
164
162
|
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
# Changelog
|
|
6
6
|
|
|
7
|
+
## Version 0.0.1-alpha.16-hotfix.2 (2025-08-29)
|
|
8
|
+
|
|
9
|
+
### 🌎 Ecosystem
|
|
10
|
+
|
|
11
|
+
- Published `@devaloop/devaforge` on npm. A tool for creating and managing Devalang addons.
|
|
12
|
+
|
|
13
|
+
### 🔎 Telemetry
|
|
14
|
+
|
|
15
|
+
- Patched first usage and user configuration.
|
|
16
|
+
|
|
17
|
+
## Version 0.0.1-alpha.16-hotfix.1 (2025-08-29)
|
|
18
|
+
|
|
19
|
+
### 🌎 Ecosystem
|
|
20
|
+
|
|
21
|
+
- Fixed Github Actions to build and release binaries for multiple platforms.
|
|
22
|
+
- Fixed `postinstall` script to launch properly postinstall.js when installing core package
|
|
23
|
+
|
|
7
24
|
## Version 0.0.1-alpha.16 (2025-08-28)
|
|
8
25
|
|
|
9
26
|
### 🌎 Ecosystem
|
package/docs/ROADMAP.md
CHANGED
|
@@ -22,9 +22,10 @@ Devalang is a work in progress. Here’s what we’re planning next:
|
|
|
22
22
|
- ✅ **Sample loading**: Add `@load` assignment to load samples (.mp3, .wav) for use as values.
|
|
23
23
|
- ✅ **WASM support**: Compile Devalang to WebAssembly for use in web applications and other environments.
|
|
24
24
|
- ✅ **VSCode extension**: Create a VSCode extension for syntax highlighting and code completion.
|
|
25
|
+
- ✅ **Addon generator**: Implement addon generation for creating reusable plugins, banks and presets.
|
|
25
26
|
|
|
26
27
|
## Upcoming
|
|
27
28
|
|
|
28
29
|
- ⏳ **Smart modules**: Let Devalang detect and use groups, samples, and variables without needing to import them manually.
|
|
29
|
-
- ⏳ **Other statements**: Implement `pattern`,
|
|
30
|
+
- ⏳ **Other statements**: Implement `pattern`, and other control structures.
|
|
30
31
|
- ⏳ **Testing**: Expand test coverage for all features.
|
package/docs/TODO.md
CHANGED
|
@@ -11,18 +11,15 @@ This is a list of tasks and features to be implemented in Devalang. Note that th
|
|
|
11
11
|
- [x] Init project
|
|
12
12
|
- [x] Implement init command
|
|
13
13
|
- [x] Implement template selector
|
|
14
|
-
- [ ] Implement project name validation
|
|
15
14
|
- [x] Template
|
|
16
15
|
- [x] Implement template list
|
|
17
16
|
- [x] Implement template info
|
|
18
17
|
- [x] Checking
|
|
19
18
|
- [x] Implement watch mode
|
|
20
19
|
- [x] Implement debug mode
|
|
21
|
-
- [ ] Implement compilation mode
|
|
22
20
|
- [x] Building
|
|
23
21
|
- [x] Implement watch mode
|
|
24
22
|
- [x] Implement debug mode
|
|
25
|
-
- [ ] Implement compilation mode
|
|
26
23
|
- [x] Implement compression mode
|
|
27
24
|
- [x] Play
|
|
28
25
|
- [x] Implement Audio Engine
|
|
@@ -64,6 +61,21 @@ This is a list of tasks and features to be implemented in Devalang. Note that th
|
|
|
64
61
|
- [x] Built-in triggers
|
|
65
62
|
- [x] Custom triggers
|
|
66
63
|
|
|
64
|
+
## Banks
|
|
65
|
+
|
|
66
|
+
- [x] Implement bank management (e.g. install, remove, list)
|
|
67
|
+
- [x] Create example banks
|
|
68
|
+
|
|
69
|
+
## Plugins
|
|
70
|
+
|
|
71
|
+
- [x] Implement plugin system (e.g. install, remove, list)
|
|
72
|
+
- [ ] Create example plugins
|
|
73
|
+
|
|
74
|
+
## Addon generator
|
|
75
|
+
|
|
76
|
+
- [ ] Implement addon generator
|
|
77
|
+
- [ ] Create example addons
|
|
78
|
+
|
|
67
79
|
## Other TODOs
|
|
68
80
|
|
|
69
81
|
- [ ] Comment all core components
|
package/out-tsc/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devaloop/devalang",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.1-alpha.16-hotfix.
|
|
4
|
+
"version": "0.0.1-alpha.16-hotfix.3",
|
|
5
5
|
"description": "Write music like code. Devalang is a domain-specific language (DSL) for sound designers and music hackers. Compose, automate, and control sound — in plain text.",
|
|
6
6
|
"main": "out-tsc/index.js",
|
|
7
7
|
"bin": {
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"rust:dev:play": "cargo run play --entry examples --output output --repeat --debug",
|
|
15
15
|
"rust:wasm:web": "wasm-pack build --target=web --no-default-features",
|
|
16
16
|
"rust:wasm:node": "wasm-pack build --target=nodejs --no-default-features",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
17
|
+
"rust:prepack": "cargo build --release",
|
|
18
|
+
"scripts:build": "tsc",
|
|
19
|
+
"scripts:postbuild": "tsc && node out-tsc/scripts/postbuild.js",
|
|
20
|
+
"scripts:version:bump": "tsc && node out-tsc/scripts/version/index.js",
|
|
21
21
|
"postinstall": "node out-tsc/scripts/postinstall.js"
|
|
22
22
|
},
|
|
23
23
|
"homepage": "https://devalang.com",
|
package/rust/cli/driver.rs
CHANGED
|
@@ -287,6 +287,18 @@ pub enum Commands {
|
|
|
287
287
|
command: TelemetryCommand,
|
|
288
288
|
},
|
|
289
289
|
|
|
290
|
+
/// Generate addon scaffolding for Devalang.
|
|
291
|
+
///
|
|
292
|
+
/// ### Subcommands
|
|
293
|
+
/// - `bank` - Generates a bank scaffold.
|
|
294
|
+
/// - `plugin` - Generates a plugin scaffold.
|
|
295
|
+
/// - `preset` - Generates a preset scaffold.
|
|
296
|
+
///
|
|
297
|
+
// Scaffold {
|
|
298
|
+
// #[command(subcommand)]
|
|
299
|
+
// command: ScaffoldCommand,
|
|
300
|
+
// },
|
|
301
|
+
|
|
290
302
|
/// Log in to your Devaloop account.
|
|
291
303
|
///
|
|
292
304
|
Login {},
|
package/rust/cli/mod.rs
CHANGED
package/rust/cli/telemetry.rs
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
use crate::config::settings::set_user_config_bool;
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
use crate::config::settings::set_user_config_bool;
|
|
2
|
+
use crate::utils::logger::{LogLevel, Logger};
|
|
3
|
+
|
|
4
|
+
#[cfg(feature = "cli")]
|
|
5
|
+
pub async fn handle_telemetry_enable_command() -> Result<(), String> {
|
|
6
|
+
set_user_config_bool("telemetry", true);
|
|
7
|
+
|
|
8
|
+
let logger = Logger::new();
|
|
9
|
+
logger.log_message(LogLevel::Info, "Telemetry has been enabled.");
|
|
10
|
+
|
|
11
|
+
Ok(())
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
#[cfg(feature = "cli")]
|
|
15
|
+
pub async fn handle_telemetry_disable_command() -> Result<(), String> {
|
|
16
|
+
set_user_config_bool("telemetry", false);
|
|
17
|
+
|
|
18
|
+
let logger = Logger::new();
|
|
19
|
+
logger.log_message(LogLevel::Info, "Telemetry has been disabled.");
|
|
20
|
+
|
|
21
|
+
Ok(())
|
|
22
|
+
}
|
package/rust/config/settings.rs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
use serde::{Deserialize, Serialize};
|
|
2
|
-
use std::
|
|
2
|
+
use std::io::Write;
|
|
3
3
|
|
|
4
4
|
#[derive(Serialize, Deserialize, Default, Debug)]
|
|
5
5
|
pub struct UserSettings {
|
|
@@ -15,12 +15,16 @@ pub struct TelemetrySettings {
|
|
|
15
15
|
pub enabled: bool,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
pub fn get_home_dir() -> std::path::PathBuf {
|
|
19
|
-
dirs::home_dir()
|
|
18
|
+
pub fn get_home_dir() -> Option<std::path::PathBuf> {
|
|
19
|
+
dirs::home_dir()
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
pub fn get_devalang_homedir() -> std::path::PathBuf {
|
|
23
|
-
|
|
23
|
+
if let Some(home_dir) = get_home_dir() {
|
|
24
|
+
home_dir.join(".devalang")
|
|
25
|
+
} else {
|
|
26
|
+
std::path::PathBuf::from("~/.devalang")
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
|
|
26
30
|
pub fn get_default_user_config() -> UserSettings {
|
|
@@ -36,8 +40,7 @@ pub fn get_default_user_config() -> UserSettings {
|
|
|
36
40
|
}
|
|
37
41
|
|
|
38
42
|
pub fn get_user_config() -> Option<UserSettings> {
|
|
39
|
-
let config_path = get_devalang_homedir().join("config.json")
|
|
40
|
-
if config_path.try_exists().is_ok() {
|
|
43
|
+
if let Some(config_path) = get_devalang_homedir().join("config.json").into() {
|
|
41
44
|
let file = std::fs::File::open(config_path).ok()?;
|
|
42
45
|
let settings = serde_json::from_reader(file).ok()?;
|
|
43
46
|
Some(settings)
|
|
@@ -47,13 +50,16 @@ pub fn get_user_config() -> Option<UserSettings> {
|
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
pub fn write_user_config_file() {
|
|
50
|
-
let
|
|
53
|
+
if let Some(config_path) = get_devalang_homedir().join("config.json").into() {
|
|
54
|
+
let settings = get_user_config().unwrap_or_else(get_default_user_config);
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
let config_json = serde_json::to_string(&settings).unwrap();
|
|
56
|
+
let mut file = std::fs::File::create(config_path).unwrap();
|
|
57
|
+
let config_json = serde_json::to_string(&settings).unwrap();
|
|
55
58
|
|
|
56
|
-
|
|
59
|
+
file.write_all(config_json.as_bytes()).unwrap();
|
|
60
|
+
} else {
|
|
61
|
+
println!("Could not create config file");
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
pub fn set_user_config_bool(key: &str, value: bool) {
|
|
@@ -66,11 +72,14 @@ pub fn set_user_config_bool(key: &str, value: bool) {
|
|
|
66
72
|
_ => {}
|
|
67
73
|
}
|
|
68
74
|
|
|
69
|
-
let config_path = get_devalang_homedir().join("config.json")
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
if let Some(config_path) = get_devalang_homedir().join("config.json").into() {
|
|
76
|
+
let config_json = serde_json::to_string(&settings).unwrap();
|
|
77
|
+
let mut file = std::fs::File::create(config_path).unwrap();
|
|
72
78
|
|
|
73
|
-
|
|
79
|
+
file.write_all(config_json.as_bytes()).unwrap();
|
|
80
|
+
} else {
|
|
81
|
+
println!("Could not create config file");
|
|
82
|
+
}
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
pub fn set_user_config_string(key: &str, value: String) {
|
|
@@ -83,9 +92,12 @@ pub fn set_user_config_string(key: &str, value: String) {
|
|
|
83
92
|
_ => {}
|
|
84
93
|
}
|
|
85
94
|
|
|
86
|
-
let config_path = get_devalang_homedir().join("config.json")
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
if let Some(config_path) = get_devalang_homedir().join("config.json").into() {
|
|
96
|
+
let config_json = serde_json::to_string(&settings).unwrap();
|
|
97
|
+
let mut file = std::fs::File::create(config_path).unwrap();
|
|
89
98
|
|
|
90
|
-
|
|
99
|
+
file.write_all(config_json.as_bytes()).unwrap();
|
|
100
|
+
} else {
|
|
101
|
+
println!("Could not create config file");
|
|
102
|
+
}
|
|
91
103
|
}
|
|
@@ -3,15 +3,14 @@ use std::fmt::Write;
|
|
|
3
3
|
|
|
4
4
|
use crate::{
|
|
5
5
|
config::settings::{get_devalang_homedir, set_user_config_bool, write_user_config_file},
|
|
6
|
-
utils::
|
|
6
|
+
utils::{
|
|
7
|
+
logger::{LogLevel, Logger},
|
|
8
|
+
signature::get_signature,
|
|
9
|
+
},
|
|
7
10
|
};
|
|
8
11
|
|
|
9
12
|
pub fn check_is_first_usage() {
|
|
10
|
-
if get_devalang_homedir()
|
|
11
|
-
.join("config.json")
|
|
12
|
-
.try_exists()
|
|
13
|
-
.is_ok()
|
|
14
|
-
{
|
|
13
|
+
if get_devalang_homedir().exists() == true {
|
|
15
14
|
// Do nothing
|
|
16
15
|
} else {
|
|
17
16
|
first_usage_welcome();
|
|
@@ -20,18 +19,22 @@ pub fn check_is_first_usage() {
|
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
pub fn first_usage_welcome() {
|
|
22
|
+
std::fs::create_dir_all(get_devalang_homedir()).ok();
|
|
23
|
+
|
|
23
24
|
let version = env!("CARGO_PKG_VERSION");
|
|
24
25
|
print!("{}", get_signature(version));
|
|
25
26
|
|
|
26
|
-
let
|
|
27
|
+
let homedir = get_devalang_homedir().display().to_string();
|
|
28
|
+
|
|
27
29
|
let welcome_msg = format!(
|
|
28
30
|
"Welcome to Devalang ! \n\
|
|
29
31
|
It looks like this is your first time using the tool.\n\
|
|
30
32
|
A configuration file will be created in your home directory.\n\
|
|
31
|
-
({})",
|
|
32
|
-
|
|
33
|
+
(location: '{}')",
|
|
34
|
+
homedir
|
|
33
35
|
);
|
|
34
36
|
|
|
37
|
+
let mut s = String::new();
|
|
35
38
|
write!(&mut s, "{}", SetAttribute(Attribute::Bold)).unwrap();
|
|
36
39
|
write!(&mut s, "{}", welcome_msg).unwrap();
|
|
37
40
|
write!(&mut s, "{}", SetAttribute(Attribute::Reset)).unwrap();
|
|
@@ -56,17 +59,21 @@ pub fn first_usage_ask_for_telemetry() {
|
|
|
56
59
|
|
|
57
60
|
write_user_config_file();
|
|
58
61
|
|
|
62
|
+
let logger = Logger::new();
|
|
63
|
+
|
|
59
64
|
if telemetry_response == true {
|
|
60
65
|
println!("");
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
logger.log_message(
|
|
67
|
+
LogLevel::Info,
|
|
68
|
+
"Telemetry enabled. You can opt-out at any time by using 'devalang telemetry disable'",
|
|
63
69
|
);
|
|
64
70
|
println!("");
|
|
65
71
|
|
|
66
72
|
set_user_config_bool("telemetry", true);
|
|
67
73
|
} else {
|
|
68
74
|
println!("");
|
|
69
|
-
|
|
75
|
+
logger.log_message(
|
|
76
|
+
LogLevel::Info,
|
|
70
77
|
"Telemetry disabled. You can enable it at any time by using 'devalang telemetry enable'"
|
|
71
78
|
);
|
|
72
79
|
println!("");
|
package/tsconfig.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
12
|
|
|
13
13
|
/* Language and Environment */
|
|
14
|
-
"target": "es2016"
|
|
14
|
+
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
15
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
16
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
17
|
// "libReplacement": true, /* Enable lib replacement. */
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
27
27
|
|
|
28
28
|
/* Modules */
|
|
29
|
-
"module": "commonjs"
|
|
30
|
-
"rootDir": "./typescript"
|
|
29
|
+
"module": "commonjs" /* Specify what module code is generated. */,
|
|
30
|
+
"rootDir": "./typescript" /* Specify the root folder within your source files. */,
|
|
31
31
|
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
32
32
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
33
33
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
60
60
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
61
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
62
|
-
"outDir": "./out-tsc"
|
|
62
|
+
"outDir": "./out-tsc" /* Specify an output folder for all emitted files. */,
|
|
63
63
|
// "removeComments": true, /* Disable emitting comments. */
|
|
64
64
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
65
65
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
81
81
|
// "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
|
|
82
82
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
83
|
-
"esModuleInterop": true
|
|
83
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
84
84
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
85
|
-
"forceConsistentCasingInFileNames": true
|
|
85
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
86
86
|
|
|
87
87
|
/* Type Checking */
|
|
88
|
-
"strict": true
|
|
88
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
89
89
|
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
90
90
|
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
91
91
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
@@ -108,6 +108,8 @@
|
|
|
108
108
|
|
|
109
109
|
/* Completeness */
|
|
110
110
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
111
|
-
"skipLibCheck": true
|
|
112
|
-
}
|
|
111
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
112
|
+
},
|
|
113
|
+
"include": ["typescript/**/*.ts"],
|
|
114
|
+
"exclude": ["node_modules", "out-tsc", "target", "dist", "**/*.spec.ts"]
|
|
113
115
|
}
|
package/typescript/index.ts
CHANGED
|
@@ -4,17 +4,15 @@ import { https } from "follow-redirects";
|
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import path from "path";
|
|
6
6
|
|
|
7
|
-
const projectVersionPath = path.join(
|
|
8
|
-
__dirname,
|
|
9
|
-
"../../project-version.json"
|
|
10
|
-
);
|
|
7
|
+
const projectVersionPath = path.join(__dirname, "../../project-version.json");
|
|
11
8
|
|
|
12
9
|
const version = fs.readFileSync(projectVersionPath, "utf-8").trim();
|
|
13
10
|
const versionString = JSON.parse(version).version;
|
|
14
11
|
|
|
15
12
|
const platform = process.platform;
|
|
16
13
|
|
|
17
|
-
let binaryName: string;
|
|
14
|
+
let binaryName: string = "";
|
|
15
|
+
|
|
18
16
|
switch (platform) {
|
|
19
17
|
case "win32":
|
|
20
18
|
binaryName = "devalang-x86_64-pc-windows-msvc.exe";
|
|
@@ -25,32 +23,47 @@ switch (platform) {
|
|
|
25
23
|
case "linux":
|
|
26
24
|
binaryName = "devalang-x86_64-unknown-linux-gnu";
|
|
27
25
|
break;
|
|
28
|
-
default:
|
|
29
|
-
console.error(`❌ Unsupported platform: ${platform}`);
|
|
30
|
-
process.exit(1);
|
|
31
26
|
}
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
28
|
+
if (binaryName !== "") {
|
|
29
|
+
const destDir = join(__dirname, "..", "..", "out-tsc", "bin");
|
|
30
|
+
const dest = join(destDir, binaryName);
|
|
31
|
+
|
|
32
|
+
const url = `https://github.com/devaloop-labs/devalang/releases/download/v${versionString}/${binaryName}`;
|
|
33
|
+
|
|
34
|
+
mkdirSync(destDir, { recursive: true });
|
|
35
|
+
|
|
36
|
+
console.log(`⬇️ Downloading ${binaryName} from ${url}`);
|
|
37
|
+
|
|
38
|
+
https
|
|
39
|
+
.get(url, (res: any) => {
|
|
40
|
+
if (res.statusCode === 404) {
|
|
41
|
+
console.warn(
|
|
42
|
+
`⚠️ Asset not found (HTTP 404). Skipping binary download.`
|
|
43
|
+
);
|
|
44
|
+
res.resume();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (res.statusCode !== 200) {
|
|
49
|
+
console.error(
|
|
50
|
+
`❌ Failed (HTTP ${res.statusCode}). Skipping binary download.`
|
|
51
|
+
);
|
|
52
|
+
res.resume();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const file = createWriteStream(dest, { mode: 0o755 });
|
|
57
|
+
res.pipe(file);
|
|
58
|
+
file.on("finish", () => {
|
|
59
|
+
file.close();
|
|
60
|
+
console.log(`✅ Downloaded ${binaryName} to ${dest}`);
|
|
61
|
+
});
|
|
62
|
+
})
|
|
63
|
+
.on("error", (err) => {
|
|
64
|
+
// Network or other errors should not fail CI; log and continue
|
|
65
|
+
console.error(`❌ Error: ${err.message}. Skipping binary download.`);
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
console.error(`❌ Unsupported platform: ${platform}`);
|
|
69
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* NOTE: This script is deprecated since we use Github Actions
|
|
4
|
-
*/
|
|
5
|
-
// import fs from "fs";
|
|
6
|
-
// import path from "path";
|
|
7
|
-
// const source = path.join(__dirname, "..", "..", "target", "release", "devalang.exe");
|
|
8
|
-
// const destination = path.join(__dirname, "..", "bin", "devalang.exe");
|
|
9
|
-
// fs.copyFileSync(source, destination);
|
|
10
|
-
// fs.chmodSync(destination, 0o755);
|
package/rust/cli/generator.rs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
// TODO: Plugin generator
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NOTE: This script is deprecated since we use Github Actions
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// import fs from "fs";
|
|
6
|
-
// import path from "path";
|
|
7
|
-
|
|
8
|
-
// const source = path.join(__dirname, "..", "..", "target", "release", "devalang.exe");
|
|
9
|
-
// const destination = path.join(__dirname, "..", "bin", "devalang.exe");
|
|
10
|
-
|
|
11
|
-
// fs.copyFileSync(source, destination);
|
|
12
|
-
// fs.chmodSync(destination, 0o755);
|