@devaloop/devalang 0.0.1-alpha.15 → 0.0.1-alpha.16

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.
Files changed (173) hide show
  1. package/.devalang +2 -0
  2. package/.github/workflows/ci.yml +92 -0
  3. package/Cargo.toml +60 -58
  4. package/README.md +1 -1
  5. package/docs/CHANGELOG.md +34 -1
  6. package/docs/CONTRIBUTING.md +101 -1
  7. package/docs/ROADMAP.md +1 -1
  8. package/docs/TODO.md +1 -1
  9. package/examples/automation.deva +1 -3
  10. package/examples/bank.deva +4 -4
  11. package/examples/events.deva +12 -0
  12. package/examples/function.deva +4 -4
  13. package/examples/index.deva +3 -5
  14. package/examples/loop.deva +5 -11
  15. package/examples/pattern.deva +8 -0
  16. package/examples/plugin.deva +12 -11
  17. package/examples/variables.deva +1 -1
  18. package/out-tsc/bin/index.js +51 -7
  19. package/out-tsc/index.js +3 -1
  20. package/out-tsc/scripts/postbuild.js +9 -10
  21. package/out-tsc/scripts/postinstall.js +49 -0
  22. package/package.json +12 -4
  23. package/project-version.json +3 -3
  24. package/rust/cli/bank.rs +462 -455
  25. package/rust/cli/build.rs +252 -199
  26. package/rust/cli/check.rs +221 -180
  27. package/rust/cli/driver.rs +297 -292
  28. package/rust/cli/generator.rs +1 -0
  29. package/rust/cli/init.rs +87 -79
  30. package/rust/cli/install.rs +35 -32
  31. package/rust/cli/login.rs +127 -134
  32. package/rust/cli/mod.rs +13 -11
  33. package/rust/cli/play.rs +1123 -218
  34. package/rust/cli/telemetry.rs +19 -0
  35. package/rust/cli/template.rs +69 -57
  36. package/rust/cli/update.rs +6 -4
  37. package/rust/common/api.rs +5 -5
  38. package/rust/common/mod.rs +3 -3
  39. package/rust/config/driver.rs +118 -94
  40. package/rust/config/loader.rs +165 -156
  41. package/rust/config/mod.rs +4 -2
  42. package/rust/config/settings.rs +91 -0
  43. package/rust/config/stats.rs +257 -0
  44. package/rust/core/audio/engine.rs +696 -659
  45. package/rust/core/audio/evaluator.rs +263 -132
  46. package/rust/core/audio/interpreter/arrow_call.rs +198 -187
  47. package/rust/core/audio/interpreter/call.rs +98 -95
  48. package/rust/core/audio/interpreter/condition.rs +70 -71
  49. package/rust/core/audio/interpreter/driver.rs +487 -231
  50. package/rust/core/audio/interpreter/function.rs +26 -21
  51. package/rust/core/audio/interpreter/let_.rs +38 -26
  52. package/rust/core/audio/interpreter/load.rs +18 -18
  53. package/rust/core/audio/interpreter/loop_.rs +113 -106
  54. package/rust/core/audio/interpreter/mod.rs +14 -14
  55. package/rust/core/audio/interpreter/sleep.rs +27 -28
  56. package/rust/core/audio/interpreter/spawn.rs +105 -102
  57. package/rust/core/audio/interpreter/tempo.rs +19 -16
  58. package/rust/core/audio/interpreter/trigger.rs +239 -210
  59. package/rust/core/audio/loader/mod.rs +1 -1
  60. package/rust/core/audio/loader/trigger.rs +100 -94
  61. package/rust/core/audio/mod.rs +7 -7
  62. package/rust/core/audio/player.rs +64 -64
  63. package/rust/core/audio/renderer.rs +56 -53
  64. package/rust/core/audio/special/easing.rs +189 -120
  65. package/rust/core/audio/special/env.rs +43 -41
  66. package/rust/core/audio/special/math.rs +102 -92
  67. package/rust/core/audio/special/mod.rs +9 -9
  68. package/rust/core/audio/special/modulator.rs +143 -120
  69. package/rust/core/builder/mod.rs +80 -85
  70. package/rust/core/debugger/lexer.rs +27 -27
  71. package/rust/core/debugger/mod.rs +24 -23
  72. package/rust/core/debugger/module.rs +55 -47
  73. package/rust/core/debugger/preprocessor.rs +27 -27
  74. package/rust/core/debugger/store.rs +40 -39
  75. package/rust/core/error/mod.rs +80 -69
  76. package/rust/core/lexer/handler/arrow.rs +82 -82
  77. package/rust/core/lexer/handler/at.rs +21 -21
  78. package/rust/core/lexer/handler/brace.rs +41 -41
  79. package/rust/core/lexer/handler/colon.rs +21 -21
  80. package/rust/core/lexer/handler/comment.rs +30 -30
  81. package/rust/core/lexer/handler/dot.rs +21 -21
  82. package/rust/core/lexer/handler/driver.rs +337 -292
  83. package/rust/core/lexer/handler/identifier.rs +46 -43
  84. package/rust/core/lexer/handler/indent.rs +66 -66
  85. package/rust/core/lexer/handler/mod.rs +16 -16
  86. package/rust/core/lexer/handler/newline.rs +23 -23
  87. package/rust/core/lexer/handler/number.rs +31 -31
  88. package/rust/core/lexer/handler/operator.rs +46 -46
  89. package/rust/core/lexer/handler/parenthesis.rs +41 -41
  90. package/rust/core/lexer/handler/slash.rs +21 -21
  91. package/rust/core/lexer/handler/string.rs +63 -63
  92. package/rust/core/lexer/mod.rs +54 -51
  93. package/rust/core/lexer/token.rs +97 -94
  94. package/rust/core/mod.rs +11 -11
  95. package/rust/core/parser/driver.rs +513 -490
  96. package/rust/core/parser/handler/arrow_call.rs +233 -227
  97. package/rust/core/parser/handler/at.rs +245 -162
  98. package/rust/core/parser/handler/bank.rs +94 -69
  99. package/rust/core/parser/handler/condition.rs +80 -74
  100. package/rust/core/parser/handler/dot.rs +143 -135
  101. package/rust/core/parser/handler/identifier/automate.rs +257 -194
  102. package/rust/core/parser/handler/identifier/call.rs +91 -88
  103. package/rust/core/parser/handler/identifier/emit.rs +66 -0
  104. package/rust/core/parser/handler/identifier/function.rs +100 -91
  105. package/rust/core/parser/handler/identifier/group.rs +85 -75
  106. package/rust/core/parser/handler/identifier/let_.rs +158 -143
  107. package/rust/core/parser/handler/identifier/mod.rs +54 -56
  108. package/rust/core/parser/handler/identifier/on.rs +98 -0
  109. package/rust/core/parser/handler/identifier/print.rs +52 -29
  110. package/rust/core/parser/handler/identifier/sleep.rs +36 -33
  111. package/rust/core/parser/handler/identifier/spawn.rs +91 -88
  112. package/rust/core/parser/handler/identifier/synth.rs +65 -63
  113. package/rust/core/parser/handler/loop_.rs +170 -89
  114. package/rust/core/parser/handler/mod.rs +8 -8
  115. package/rust/core/parser/handler/tempo.rs +53 -47
  116. package/rust/core/parser/mod.rs +4 -4
  117. package/rust/core/parser/statement.rs +142 -113
  118. package/rust/core/plugin/loader.rs +123 -48
  119. package/rust/core/plugin/mod.rs +2 -1
  120. package/rust/core/plugin/runner.rs +296 -0
  121. package/rust/core/preprocessor/loader.rs +515 -326
  122. package/rust/core/preprocessor/mod.rs +4 -4
  123. package/rust/core/preprocessor/module.rs +60 -58
  124. package/rust/core/preprocessor/processor.rs +99 -101
  125. package/rust/core/preprocessor/resolver/bank.rs +51 -48
  126. package/rust/core/preprocessor/resolver/call.rs +100 -101
  127. package/rust/core/preprocessor/resolver/condition.rs +97 -97
  128. package/rust/core/preprocessor/resolver/driver.rs +310 -280
  129. package/rust/core/preprocessor/resolver/function.rs +69 -68
  130. package/rust/core/preprocessor/resolver/group.rs +96 -91
  131. package/rust/core/preprocessor/resolver/let_.rs +32 -28
  132. package/rust/core/preprocessor/resolver/loop_.rs +320 -121
  133. package/rust/core/preprocessor/resolver/mod.rs +15 -15
  134. package/rust/core/preprocessor/resolver/spawn.rs +76 -73
  135. package/rust/core/preprocessor/resolver/synth.rs +56 -50
  136. package/rust/core/preprocessor/resolver/tempo.rs +50 -49
  137. package/rust/core/preprocessor/resolver/trigger.rs +113 -115
  138. package/rust/core/preprocessor/resolver/value.rs +81 -81
  139. package/rust/core/shared/duration.rs +9 -9
  140. package/rust/core/shared/mod.rs +3 -3
  141. package/rust/core/shared/value.rs +35 -32
  142. package/rust/core/store/function.rs +34 -34
  143. package/rust/core/store/global.rs +55 -38
  144. package/rust/core/store/mod.rs +5 -5
  145. package/rust/core/store/variable.rs +37 -34
  146. package/rust/core/utils/mod.rs +2 -2
  147. package/rust/core/utils/path.rs +37 -31
  148. package/rust/core/utils/validation.rs +35 -36
  149. package/rust/installer/addon.rs +84 -80
  150. package/rust/installer/bank.rs +62 -65
  151. package/rust/installer/mod.rs +5 -5
  152. package/rust/installer/plugin.rs +54 -55
  153. package/rust/installer/utils.rs +56 -56
  154. package/rust/lib.rs +156 -164
  155. package/rust/main.rs +250 -144
  156. package/rust/utils/error.rs +200 -51
  157. package/rust/utils/file.rs +38 -35
  158. package/rust/utils/first_usage.rs +76 -0
  159. package/rust/utils/logger.rs +195 -143
  160. package/rust/utils/mod.rs +9 -7
  161. package/rust/utils/signature.rs +19 -17
  162. package/rust/utils/spinner.rs +22 -19
  163. package/rust/utils/telemetry.rs +292 -0
  164. package/rust/utils/watcher.rs +34 -33
  165. package/templates/minimal/README.md +97 -121
  166. package/templates/welcome/README.md +97 -121
  167. package/typescript/bin/index.ts +19 -5
  168. package/typescript/index.ts +3 -1
  169. package/typescript/scripts/postbuild.ts +10 -6
  170. package/typescript/scripts/postinstall.ts +56 -0
  171. package/typescript/scripts/version/bump.ts +0 -1
  172. package/typescript/scripts/version/index.ts +0 -1
  173. package/out-tsc/bin/devalang.exe +0 -0
@@ -1,5 +1,5 @@
1
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">
2
+ <img src="https://devalang.com/images/devalang-logo-min.png" alt="Devalang Logo" width="100" />
3
3
  </div>
4
4
 
5
5
  ![Rust](https://img.shields.io/badge/Made%20with-Rust-orange?logo=rust)
@@ -7,184 +7,156 @@
7
7
  ![Node.js](https://img.shields.io/badge/Node.js-18%2B-brightgreen?logo=node.js)
8
8
 
9
9
  ![Project Status](https://img.shields.io/badge/status-alpha-red)
10
- ![Version](https://img.shields.io/badge/version-0.0.1-blue)
10
+ ![Version](https://img.shields.io/npm/v/@devaloop/devalang)
11
11
  ![License: MIT](https://img.shields.io/badge/license-MIT-green)
12
12
  ![Platform](https://img.shields.io/badge/platform-Windows-blue)
13
13
 
14
14
  ![npm](https://img.shields.io/npm/dt/@devaloop/devalang)
15
15
  ![crates](https://img.shields.io/crates/d/devalang)
16
16
 
17
- ## 🎼 Devalang, by **Devaloop Labs**
17
+ [![VSCode Extension](https://img.shields.io/visual-studio-marketplace/v/devaloop.devalang-vscode?label=VSCode%20Extension)](https://marketplace.visualstudio.com/items?itemName=devaloop.devalang-vscode)
18
18
 
19
- 🎶 Compose music with code — simple, structured, sonic.
19
+ # 🦊 Devalang (CORE) — Compose music with code
20
20
 
21
21
  Devalang is a tiny domain-specific language (DSL) for music makers, sound designers, and audio hackers.
22
22
  Compose loops, control samples, render and play audio — all in clean, readable text.
23
23
 
24
- 🦊 Whether you're building a track, shaping textures, or performing live, Devalang helps you think in rhythms. It’s designed to be simple, expressive, and fast — because your ideas shouldn’t wait.
24
+ Whether you're building a track, shaping textures, or performing live, Devalang helps you think in rhythms. It’s designed to be simple, expressive, and fast — because your ideas shouldn’t wait.
25
25
 
26
26
  From studio sketches to live sets, Devalang gives you rhythmic control — with the elegance of code.
27
27
 
28
- > 🚧 **v0.0.1-alpha.5 Notice** 🚧
28
+ > 🚧 Alpha Notice 🚧
29
29
  >
30
- > Currently, Devalang CLI is only available for **Windows**.
30
+ > Includes synthesis, playback, and rendering features, but is still in early development.
31
+ >
32
+ > Currently, Devalang CLI is only available for **Windows**.
31
33
  > Linux and macOS binaries will be added in future releases via cross-platform builds.
32
34
 
33
- ---
34
-
35
35
  ## 📚 Quick Access
36
36
 
37
- - [📖 Documentation](./docs/)
37
+ - [▶️ Playground](https://playground.devalang.com)
38
+ - [📖 Documentation](https://docs.devalang.com)
39
+ - [🧩 VSCode Extension](https://marketplace.visualstudio.com/items?itemName=devaloop.devalang-vscode)
40
+ - [🎨 Prettier Plugin](https://www.npmjs.com/package/@devaloop/prettier-plugin-devalang)
41
+ - [📜 Changelog](./docs/CHANGELOG.md)
38
42
  - [💡 Examples](./examples/)
39
43
  - [🌐 Project Website](https://devalang.com)
44
+ - [📦 Devalang CLI on npm](https://www.npmjs.com/package/@devaloop/devalang)
40
45
 
41
- ## 🚀 Features
46
+ ## ⏱️ Try it now !
42
47
 
43
- - 🎵 **Audio Engine**: Integrated audio playback and rendering
44
- - 🧩 **Module system** for importing and exporting variables between files
45
- - 📜 **Structured AST** generation for debugging and future compilation
46
- - 🔢 **Basic data types**: strings, numbers, booleans, maps, arrays
47
- - 👁️ **Watch mode** for `build`, `check` and `play` commands
48
- - 📂 **Project templates** for quick setup
48
+ ### Try Devalang in your browser
49
49
 
50
- ## 📆 Installation
50
+ > Have a look at the [Playground](https://playground.devalang.com) to try Devalang directly in your browser
51
51
 
52
- ### For users
53
-
54
- > - ⚠️ Requires [Node.js 18+](https://nodejs.org/en/download)
55
-
56
- Install the package globally (NPM)
52
+ ### Try Devalang CLI
57
53
 
58
54
  ```bash
55
+ # Install Devalang CLI globally
59
56
  npm install -g @devaloop/devalang
60
- ```
61
-
62
- Usage without install (NPX)
63
-
64
- ```bash
65
- npx @devaloop/devalang <command>
66
- ```
67
-
68
- ### For contributors
69
57
 
70
- > - ⚠️ Requires [Node.js 18+](https://nodejs.org/en/download)
71
- > - ⚠️ Requires [Rust 1.70+](https://www.rust-lang.org/learn/get-started#installing-rust)
72
-
73
- ```bash
74
- > git clone https://github.com/devaloop-labs/devalang.git
75
- > cd devalang
76
- > npm install
77
- > cargo install --path .
78
- ```
79
-
80
- Development usage (you can customize arguments in package.json)
81
-
82
- ```bash
83
- # For syntax checking test
84
- npm run rust:dev:check
85
- # For building test
86
- npm run rust:dev:build
87
- ```
88
-
89
- ## ❔ Usage
90
-
91
- NOTE: Commands are available via `devalang` or `npx @devaloop/devalang`.
92
-
93
- NOTE: Arguments can be passed to commands using `--<argument>` syntax. You can also use a configuration file to set default values for various settings, making it easier to manage your Devalang project.
94
-
95
- NOTE: Some commands require a mandatory `--entry` argument to specify the input folder, and a `--output` argument to specify the output folder. If not specified, they default to `./src` and `./output` respectively.
96
-
97
- For more examples, see [docs/COMMANDS.md](./docs/COMMANDS.md)
98
-
99
- ### Initialize a new project
100
-
101
- In the current directory
102
-
103
- ```bash
104
- devalang init
58
+ # Create a new Devalang project
59
+ devalang init --name my-project --template minimal
60
+ cd my-project
105
61
  ```
106
62
 
107
- Or use optional arguments to specify a directory name and a template
63
+ Create a new Devalang file `src/index.deva` in the project directory:
108
64
 
109
- ```bash
110
- devalang init --name <project-name> --template <template-name>
111
- ```
112
-
113
- ### Checking syntax only
114
-
115
- ```bash
116
- devalang check --watch
65
+ ```deva
66
+ # src/index.deva
67
+
68
+ group main:
69
+ let lead = synth sine {
70
+ attack: 0,
71
+ decay: 100,
72
+ sustain: 100,
73
+ release: 100
74
+ }
75
+
76
+ # Global automation for this synth (applies to subsequent notes)
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
+ }
86
+ param pitch {
87
+ 0% = -12.0
88
+ 100% = 12.0
89
+ }
90
+
91
+ lead -> note(C4, {
92
+ duration: 400,
93
+ velocity: 0.8,
94
+ automate: { pan: { 0%: -1.0, 100%: 0.0 } }
95
+ })
96
+
97
+ lead -> note(E4, { duration: 400 })
98
+ lead -> note(G4, { duration: 600, glide: true, target_freq: 659.25 })
99
+ lead -> note(B3, { duration: 400, slide: true, target_amp: 0.3 })
100
+
101
+ for i in [1, 2, 3]:
102
+ lead -> note(C5, { duration: 200 })
103
+
104
+ # Play the lead
105
+
106
+ call main
117
107
  ```
118
108
 
119
- ### Building output files
109
+ ### And the best part ? You can play it directly from the command line:
120
110
 
121
111
  ```bash
122
- devalang build --watch
123
- ```
124
-
125
- ### Playing audio files (once by file change)
112
+ # Play the Devalang file
113
+ devalang play
126
114
 
127
- ```bash
115
+ # Play the Devalang file with watch mode
128
116
  devalang play --watch
129
- ```
130
117
 
131
- ### Playing audio files (continuous playback, even without file changes)
132
-
133
- ```bash
118
+ # LIVE mode (repeat the playback + watch mode)
134
119
  devalang play --repeat
135
120
  ```
136
121
 
137
- ## ⚙️ Configuration
138
-
139
- You can use a configuration file to set default values for various settings, making it easier to manage your Devalang project.
140
-
141
- To do this, create a `.devalang` file in the root of your project directory.
142
-
143
- See [docs/CONFIG.md](./docs/CONFIG.md) for more information.
144
-
145
- ## 📄 Syntax example
122
+ ### 🎉 You can now hear your Devalang code in action
146
123
 
147
- For more examples, see [docs/SYNTAX.md](./docs/SYNTAX.md)
124
+ > For more examples, check out the [examples directory](./examples/)
148
125
 
149
- ```deva
150
- # index.deva
151
-
152
- @import { globalBpm, globalBank, kickDuration } from "global.deva"
153
-
154
- @load "./examples/samples/kick-808.wav" as customKick
155
-
156
- bpm globalBpm
157
- # Will declare the tempo at the globalBpm variable beats per minute
126
+ ## ❓ Why Devalang ?
158
127
 
159
- bank globalBank
160
- # Will declare a custom instrument bank using the globalBank variable
128
+ - 🎹 Prototype audio ideas without opening a DAW, even VSCode
129
+ - 💻 Integrate sound into code-based workflows
130
+ - 🎛️ Control audio parameters through readable syntax
131
+ - 🧪 Build musical logic with variables and conditions
132
+ - 🔄 Create complex patterns with ease
161
133
 
162
- loop 5:
163
- .customKick kickDuration {reverb=50, drive=25}
164
- # Will play 5 times a kick for the duration of the kickDuration variable with reverb and drive effects
165
- ```
134
+ ## 🚀 Features
166
135
 
167
- ```deva
168
- # global.deva
136
+ - 🎵 **Audio Engine**: Integrated audio playback and rendering
137
+ - 🧩 **Module system** for importing and exporting variables between files
138
+ - 📦 **Addon manager** for managing external banks, plugins and more
139
+ - 📜 **Structured AST** generation for debugging and future compilation
140
+ - 🔢 **Basic data types**: strings, numbers, booleans, maps, arrays
141
+ - 👁️ **Watch mode** for `build`, `check` and `play` commands
142
+ - 📂 **Project templates** for quick setup
143
+ - 🎛️ **Custom samples**: easily load and trigger your own audio files
144
+ - 🔄 **Looping and grouping**: create complex patterns with ease
169
145
 
170
- let globalBpm = 120
171
- let globalBank = 808
172
- let kickDuration = 500
146
+ ## 📄 Documentation
173
147
 
174
- @export { globalBpm, globalBank, kickDuration }
175
- ```
148
+ ### Please refer to the [online documentation](https://docs.devalang.com) for detailed information on syntax, features, and usage examples
176
149
 
177
150
  ## 🧯 Known issues
178
151
 
179
- - No support yet for `if`, `else`, `else if` statements
180
- - No support yet for `@group`, `@pattern`, `@function` statements
152
+ - No smart modules yet, all groups, variables, and samples must be explicitly imported where used
181
153
  - No support yet for cross-platform builds (Linux, macOS)
182
154
 
183
155
  ## 🧪 Roadmap Highlights
184
156
 
185
157
  For more info, see [docs/ROADMAP.md](./docs/ROADMAP.md)
186
158
 
187
- - ⏳ Other statements (e.g `if`, `@group`, ...)
159
+ - ⏳ Other statements (e.g `function`, `pattern`, ...)
188
160
  - ⏳ Cross-platform support (Linux, macOS)
189
161
  - ⏳ More built-in instruments (e.g. snare, hi-hat, etc.)
190
162
 
@@ -197,6 +169,10 @@ MIT — see [LICENSE](./LICENSE)
197
169
  Contributions, bug reports and suggestions are welcome !
198
170
  Feel free to open an issue or submit a pull request.
199
171
 
172
+ For more info, see [docs/CONTRIBUTING.md](./docs/CONTRIBUTING.md).
173
+
200
174
  ## 📢 Contact
201
175
 
176
+ Feel free to reach out for any inquiries or feedback.
177
+
202
178
  📧 [contact@devaloop.com](mailto:contact@devaloop.com)
@@ -1,14 +1,28 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawn } from "child_process";
4
- import path from "path";
4
+ import * as path from "path";
5
5
 
6
- const binaryPath = path.join(__dirname, "devalang.exe");
6
+ let binaryName: string;
7
7
 
8
- const subCommand = process.argv[2] || "help";
8
+ switch (process.platform) {
9
+ case "win32":
10
+ binaryName = "devalang-x86_64-pc-windows-msvc.exe";
11
+ break;
12
+ case "darwin":
13
+ binaryName = "devalang-x86_64-apple-darwin";
14
+ break;
15
+ case "linux":
16
+ binaryName = "devalang-x86_64-unknown-linux-gnu";
17
+ break;
18
+ default:
19
+ console.error(`Unsupported platform: ${process.platform}`);
20
+ process.exit(1);
21
+ }
22
+
23
+ const binaryPath = path.join(__dirname, binaryName);
9
24
 
10
25
  const args = process.argv.slice(2);
11
26
  const child = spawn(binaryPath, args, { stdio: "inherit" });
12
27
 
13
-
14
- child.on("exit", (code) => process.exit(code));
28
+ child.on("exit", (code) => process.exit(code ?? 1));
@@ -1 +1,3 @@
1
- // This file is part of the Devalang project
1
+ /**
2
+ * TypeScript wrapper for Devalang.
3
+ */
@@ -1,8 +1,12 @@
1
- import fs from "fs";
2
- import path from "path";
1
+ /**
2
+ * NOTE: This script is deprecated since we use Github Actions
3
+ */
3
4
 
4
- const source = path.join(__dirname, "..", "..", "target", "release", "devalang.exe");
5
- const destination = path.join(__dirname, "..", "bin", "devalang.exe");
5
+ // import fs from "fs";
6
+ // import path from "path";
6
7
 
7
- fs.copyFileSync(source, destination);
8
- fs.chmodSync(destination, 0o755);
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);
@@ -0,0 +1,56 @@
1
+ import { createWriteStream, mkdirSync } from "fs";
2
+ import { join } from "path";
3
+ import { https } from "follow-redirects";
4
+ import fs from "fs";
5
+ import path from "path";
6
+
7
+ const projectVersionPath = path.join(
8
+ __dirname,
9
+ "../../project-version.json"
10
+ );
11
+
12
+ const version = fs.readFileSync(projectVersionPath, "utf-8").trim();
13
+ const versionString = JSON.parse(version).version;
14
+
15
+ const platform = process.platform;
16
+
17
+ let binaryName: string;
18
+ switch (platform) {
19
+ case "win32":
20
+ binaryName = "devalang-x86_64-pc-windows-msvc.exe";
21
+ break;
22
+ case "darwin":
23
+ binaryName = "devalang-x86_64-apple-darwin";
24
+ break;
25
+ case "linux":
26
+ binaryName = "devalang-x86_64-unknown-linux-gnu";
27
+ break;
28
+ default:
29
+ console.error(`❌ Unsupported platform: ${platform}`);
30
+ process.exit(1);
31
+ }
32
+
33
+ const destDir = join(__dirname, "..", "..", "out-tsc", "bin");
34
+ const dest = join(destDir, binaryName);
35
+
36
+ const url = `https://github.com/devaloop-labs/devalang/releases/download/v${versionString}/${binaryName}`;
37
+
38
+ mkdirSync(destDir, { recursive: true });
39
+
40
+ console.log(`⬇️ Downloading ${binaryName} from ${url}`);
41
+
42
+ https.get(url, (res: any) => {
43
+ if (res.statusCode !== 200) {
44
+ console.error(`❌ Failed (HTTP ${res.statusCode})`);
45
+ process.exit(1);
46
+ }
47
+ const file = createWriteStream(dest, { mode: 0o755 });
48
+ res.pipe(file);
49
+ file.on("finish", () => {
50
+ file.close();
51
+ console.log(`✅ Downloaded ${binaryName} to ${dest}`);
52
+ });
53
+ }).on("error", (err) => {
54
+ console.error(`❌ Error: ${err.message}`);
55
+ process.exit(1);
56
+ });
@@ -1,5 +1,4 @@
1
1
  import fs from "fs";
2
- import path from "path";
3
2
 
4
3
  export const bumpVersion = async (bumpType: string, projectVersionPath: string) => {
5
4
  const versionData = JSON.parse(fs.readFileSync(projectVersionPath, "utf-8"));
@@ -1,5 +1,4 @@
1
1
  import path from "path";
2
- import fs from "fs";
3
2
 
4
3
  import { bumpVersion } from "./bump";
5
4
  import { syncVersion } from "./sync";
Binary file